diff options
author | 2023-05-23 12:26:16 +0200 | |
---|---|---|
committer | 2023-05-23 14:50:29 +0200 | |
commit | 1c86defab5f5491b5f6b6e45faabf1b91ed195a3 (patch) | |
tree | ed8059727e8d3b1845b98b4e66af5d37116efd5d /examples/scrollable | |
parent | 8300d86c242aa3147ec97b2820f774048c285ae8 (diff) | |
download | iced-1c86defab5f5491b5f6b6e45faabf1b91ed195a3.tar.gz iced-1c86defab5f5491b5f6b6e45faabf1b91ed195a3.tar.bz2 iced-1c86defab5f5491b5f6b6e45faabf1b91ed195a3.zip |
Extend border radius on relevant widgets
Diffstat (limited to 'examples/scrollable')
-rw-r--r-- | examples/scrollable/src/main.rs | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index 9d57cb94..efc880e3 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -289,13 +289,18 @@ impl Application for ScrollableDemo { } Direction::Horizontal => { progress_bar(0.0..=1.0, self.current_scroll_offset.x) - .style(progress_bar_custom_style) + .style(theme::ProgressBar::Custom(Box::new( + ProgressBarCustomStyle, + ))) .into() } Direction::Multi => column![ progress_bar(0.0..=1.0, self.current_scroll_offset.y), - progress_bar(0.0..=1.0, self.current_scroll_offset.x) - .style(progress_bar_custom_style) + progress_bar(0.0..=1.0, self.current_scroll_offset.x).style( + theme::ProgressBar::Custom(Box::new( + ProgressBarCustomStyle, + )) + ) ] .spacing(10) .into(), @@ -351,12 +356,12 @@ impl scrollable::StyleSheet for ScrollbarCustomStyle { background: style .active(&theme::Scrollable::default()) .background, - border_radius: 0.0, + border_radius: 0.0.into(), border_width: 0.0, border_color: Default::default(), scroller: Scroller { color: Color::from_rgb8(250, 85, 134), - border_radius: 0.0, + border_radius: 0.0.into(), border_width: 0.0, border_color: Default::default(), }, @@ -367,10 +372,16 @@ impl scrollable::StyleSheet for ScrollbarCustomStyle { } } -fn progress_bar_custom_style(theme: &Theme) -> progress_bar::Appearance { - progress_bar::Appearance { - background: theme.extended_palette().background.strong.color.into(), - bar: Color::from_rgb8(250, 85, 134).into(), - border_radius: 0.0, +struct ProgressBarCustomStyle; + +impl progress_bar::StyleSheet for ProgressBarCustomStyle { + type Style = Theme; + + fn appearance(&self, style: &Self::Style) -> progress_bar::Appearance { + progress_bar::Appearance { + background: style.extended_palette().background.strong.color.into(), + bar: Color::from_rgb8(250, 85, 134).into(), + border_radius: 0.0.into(), + } } } |