From c275fde67a7f5d1d5789540dc7905250a2f01fe7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 Jun 2022 01:56:46 +0200 Subject: Implement theme styling for `Rule` --- examples/scrollable/src/main.rs | 2 +- examples/scrollable/src/style.rs | 26 ++------------------------ 2 files changed, 3 insertions(+), 25 deletions(-) (limited to 'examples/scrollable') diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index e49aa63b..e95f296c 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -179,7 +179,7 @@ impl Sandbox for ScrollableDemo { .spacing(20) .padding(20) .push(choose_theme) - .push(Rule::horizontal(20).style(self.theme)) + .push(Rule::horizontal(20)) .push(scrollable_row); Container::new(content) diff --git a/examples/scrollable/src/style.rs b/examples/scrollable/src/style.rs index 0581a8c8..e15bf125 100644 --- a/examples/scrollable/src/style.rs +++ b/examples/scrollable/src/style.rs @@ -1,4 +1,4 @@ -use iced::{container, rule, scrollable}; +use iced::{container, scrollable}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Theme { @@ -34,17 +34,8 @@ impl<'a> From for Box { } } -impl From for Box { - fn from(theme: Theme) -> Self { - match theme { - Theme::Light => Default::default(), - Theme::Dark => dark::Rule.into(), - } - } -} - mod dark { - use iced::{container, rule, scrollable, Color}; + use iced::{container, scrollable, Color}; const BACKGROUND: Color = Color::from_rgb( 0x36 as f32 / 255.0, @@ -139,17 +130,4 @@ mod dark { } } } - - pub struct Rule; - - impl rule::StyleSheet for Rule { - fn style(&self) -> rule::Style { - rule::Style { - color: SURFACE, - width: 2, - radius: 1.0, - fill_mode: rule::FillMode::Percent(30.0), - } - } - } } -- cgit