summaryrefslogtreecommitdiffstats
path: root/examples/scrollable
diff options
context:
space:
mode:
authorLibravatar Casper Storm <casper.storm@lich.io>2023-05-23 12:26:16 +0200
committerLibravatar Casper Storm <casper.storm@lich.io>2023-05-23 14:50:29 +0200
commit1c86defab5f5491b5f6b6e45faabf1b91ed195a3 (patch)
treeed8059727e8d3b1845b98b4e66af5d37116efd5d /examples/scrollable
parent8300d86c242aa3147ec97b2820f774048c285ae8 (diff)
downloadiced-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.rs31
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(),
+ }
}
}