diff options
| author | Polesznyák Márk <contact@pml68.dev> | 2025-10-01 22:59:11 +0200 |
|---|---|---|
| committer | Polesznyák Márk <contact@pml68.dev> | 2025-10-01 22:59:11 +0200 |
| commit | 3a180597cc907ad616a20ba77a2fa0ab5d533471 (patch) | |
| tree | f8a424ea6710c30a2d50d81ed6d7401f98855d15 | |
| parent | feat: update `styling` example to work with new system theme tracking (diff) | |
| download | iced_material-3a180597cc907ad616a20ba77a2fa0ab5d533471.tar.gz | |
feat!: remove `Default` impl
| -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()) |
