diff options
Diffstat (limited to '')
| -rw-r--r-- | examples/styling.rs | 14 | ||||
| -rw-r--r-- | src/lib.rs | 6 |
2 files changed, 12 insertions, 8 deletions
diff --git a/examples/styling.rs b/examples/styling.rs index 2a45321..cff0b77 100644 --- a/examples/styling.rs +++ b/examples/styling.rs @@ -12,13 +12,12 @@ use iced_material::{ type Element<'a, Message> = iced::Element<'a, Message, Theme>; pub fn main() -> iced::Result { - iced::application(Styling::default, Styling::update, Styling::view) + iced::application(Styling::new, Styling::update, Styling::view) .subscription(Styling::subscription) .theme(Styling::theme) .run() } -#[derive(Default)] struct Styling { theme: Theme, system_theme: bool, @@ -42,6 +41,17 @@ enum Message { } impl Styling { + fn new() -> Self { + Self { + theme: Theme::Dark, + system_theme: false, + input_value: String::new(), + slider_value: 0.0, + checkbox_value: false, + toggler_value: false, + } + } + fn update(&mut self, message: Message) { match message { Message::ThemeChanged(theme) => { @@ -107,12 +107,6 @@ impl Theme { } } -impl Default for Theme { - fn default() -> Self { - Self::Dark - } -} - impl std::fmt::Display for Theme { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.name()) |
