Implement Program::load to specify startup Command
This commit is contained in:
parent
5a986897d2
commit
93ae790da1
8 changed files with 122 additions and 77 deletions
|
|
@ -11,12 +11,11 @@ static SCROLLABLE_ID: Lazy<scrollable::Id> = Lazy::new(scrollable::Id::unique);
|
|||
|
||||
pub fn main() -> iced::Result {
|
||||
iced::application(
|
||||
ScrollableDemo::new,
|
||||
"Scrollable - Iced",
|
||||
ScrollableDemo::update,
|
||||
ScrollableDemo::view,
|
||||
)
|
||||
.theme(ScrollableDemo::theme)
|
||||
.title("Scrollable - Iced")
|
||||
.run()
|
||||
}
|
||||
|
||||
|
|
@ -49,18 +48,15 @@ enum Message {
|
|||
}
|
||||
|
||||
impl ScrollableDemo {
|
||||
fn new() -> (Self, Command<Message>) {
|
||||
(
|
||||
ScrollableDemo {
|
||||
scrollable_direction: Direction::Vertical,
|
||||
scrollbar_width: 10,
|
||||
scrollbar_margin: 0,
|
||||
scroller_width: 10,
|
||||
current_scroll_offset: scrollable::RelativeOffset::START,
|
||||
alignment: scrollable::Alignment::Start,
|
||||
},
|
||||
Command::none(),
|
||||
)
|
||||
fn new() -> Self {
|
||||
ScrollableDemo {
|
||||
scrollable_direction: Direction::Vertical,
|
||||
scrollbar_width: 10,
|
||||
scrollbar_margin: 0,
|
||||
scroller_width: 10,
|
||||
current_scroll_offset: scrollable::RelativeOffset::START,
|
||||
alignment: scrollable::Alignment::Start,
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, message: Message) -> Command<Message> {
|
||||
|
|
@ -339,6 +335,12 @@ impl ScrollableDemo {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for ScrollableDemo {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
fn progress_bar_custom_style(theme: &Theme) -> progress_bar::Appearance {
|
||||
progress_bar::Appearance {
|
||||
background: theme.extended_palette().background.strong.color.into(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue