diff options
| author | 2023-05-23 02:30:46 +0200 | |
|---|---|---|
| committer | 2023-05-23 02:30:46 +0200 | |
| commit | f0073e3d71bb4866d204c8c8ba43a608380b7e50 (patch) | |
| tree | b0d86dfba6a8aad6d2b2402fdcd89588de080b31 /examples | |
| parent | 3d354fd33746aba56fdc75069e81309558e7d91f (diff) | |
| parent | d20493c8a0cc6e2e250434ed4cb6f350ed39d7e8 (diff) | |
| download | iced-f0073e3d71bb4866d204c8c8ba43a608380b7e50.tar.gz iced-f0073e3d71bb4866d204c8c8ba43a608380b7e50.tar.bz2 iced-f0073e3d71bb4866d204c8c8ba43a608380b7e50.zip  | |
Merge pull request #1861 from marienz/from-pointers
Support conversion from Fn trait to custom theme
Diffstat (limited to '')
| -rw-r--r-- | examples/scrollable/src/main.rs | 27 | 
1 files changed, 8 insertions, 19 deletions
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index 97344c94..9d57cb94 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -289,18 +289,13 @@ impl Application for ScrollableDemo {              }              Direction::Horizontal => {                  progress_bar(0.0..=1.0, self.current_scroll_offset.x) -                    .style(theme::ProgressBar::Custom(Box::new( -                        ProgressBarCustomStyle, -                    ))) +                    .style(progress_bar_custom_style)                      .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( -                    theme::ProgressBar::Custom(Box::new( -                        ProgressBarCustomStyle, -                    )) -                ) +                progress_bar(0.0..=1.0, self.current_scroll_offset.x) +                    .style(progress_bar_custom_style)              ]              .spacing(10)              .into(), @@ -372,16 +367,10 @@ impl scrollable::StyleSheet for ScrollbarCustomStyle {      }  } -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, -        } +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,      }  }  | 
