diff options
author | 2022-05-31 05:27:27 +0200 | |
---|---|---|
committer | 2022-06-01 01:46:08 +0200 | |
commit | a206d22670eda60d6364444f690633dc11e75a41 (patch) | |
tree | 892b25cdcedc37aad052274f6dcbd9ea6d282c61 /examples/styling | |
parent | 3e2b6247f72815b6e928237f242c2d66478cf15d (diff) | |
download | iced-a206d22670eda60d6364444f690633dc11e75a41.tar.gz iced-a206d22670eda60d6364444f690633dc11e75a41.tar.bz2 iced-a206d22670eda60d6364444f690633dc11e75a41.zip |
Use `Theme` background in `styling` example
Diffstat (limited to 'examples/styling')
-rw-r--r-- | examples/styling/src/main.rs | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs index 044f75a9..3109d7fb 100644 --- a/examples/styling/src/main.rs +++ b/examples/styling/src/main.rs @@ -147,7 +147,6 @@ impl Sandbox for Styling { .height(Length::Fill) .center_x() .center_y() - .style(self.theme) .into() } @@ -160,9 +159,7 @@ impl Sandbox for Styling { } mod style { - use iced::{ - checkbox, container, progress_bar, rule, scrollable, text_input, - }; + use iced::{checkbox, progress_bar, rule, scrollable, text_input}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Theme { @@ -180,15 +177,6 @@ mod style { } } - impl<'a> From<Theme> for Box<dyn container::StyleSheet + 'a> { - fn from(theme: Theme) -> Self { - match theme { - Theme::Light => Default::default(), - Theme::Dark => dark::Container.into(), - } - } - } - impl<'a> From<Theme> for Box<dyn text_input::StyleSheet + 'a> { fn from(theme: Theme) -> Self { match theme { @@ -236,8 +224,7 @@ mod style { mod dark { use iced::{ - checkbox, container, progress_bar, rule, scrollable, text_input, - Color, + checkbox, progress_bar, rule, scrollable, text_input, Color, }; const SURFACE: Color = Color::from_rgb( @@ -264,18 +251,6 @@ mod style { 0xC4 as f32 / 255.0, ); - pub struct Container; - - impl container::StyleSheet for Container { - fn style(&self) -> container::Style { - container::Style { - background: Color::from_rgb8(0x36, 0x39, 0x3F).into(), - text_color: Color::WHITE.into(), - ..container::Style::default() - } - } - } - pub struct TextInput; impl text_input::StyleSheet for TextInput { |