summaryrefslogtreecommitdiffstats
path: root/examples/styling
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-06-01 02:40:42 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-06-01 02:40:42 +0200
commit77dc9dc2cb4ac092ce88c2700253fbfc54292e2b (patch)
treeff0754b29e7703de1ab48b4867e0ab058990d55b /examples/styling
parente4ca779e436561bf48e5d34cdf554292fd4761e4 (diff)
downloadiced-77dc9dc2cb4ac092ce88c2700253fbfc54292e2b.tar.gz
iced-77dc9dc2cb4ac092ce88c2700253fbfc54292e2b.tar.bz2
iced-77dc9dc2cb4ac092ce88c2700253fbfc54292e2b.zip
Implement theme styling for `ProgressBar`
Diffstat (limited to 'examples/styling')
-rw-r--r--examples/styling/src/main.rs28
1 files changed, 3 insertions, 25 deletions
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs
index e6e4681a..e19b4279 100644
--- a/examples/styling/src/main.rs
+++ b/examples/styling/src/main.rs
@@ -91,8 +91,7 @@ impl Sandbox for Styling {
Message::SliderChanged,
);
- let progress_bar =
- ProgressBar::new(0.0..=100.0, self.slider_value).style(self.theme);
+ let progress_bar = ProgressBar::new(0.0..=100.0, self.slider_value);
let scrollable = Scrollable::new(&mut self.scroll)
.width(Length::Fill)
@@ -159,7 +158,7 @@ impl Sandbox for Styling {
}
mod style {
- use iced::{checkbox, progress_bar, scrollable, text_input};
+ use iced::{checkbox, scrollable, text_input};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Theme {
@@ -195,15 +194,6 @@ mod style {
}
}
- impl From<Theme> for Box<dyn progress_bar::StyleSheet> {
- fn from(theme: Theme) -> Self {
- match theme {
- Theme::Light => Default::default(),
- Theme::Dark => dark::ProgressBar.into(),
- }
- }
- }
-
impl<'a> From<Theme> for Box<dyn checkbox::StyleSheet + 'a> {
fn from(theme: Theme) -> Self {
match theme {
@@ -214,7 +204,7 @@ mod style {
}
mod dark {
- use iced::{checkbox, progress_bar, scrollable, text_input, Color};
+ use iced::{checkbox, scrollable, text_input, Color};
const SURFACE: Color = Color::from_rgb(
0x40 as f32 / 255.0,
@@ -325,18 +315,6 @@ mod style {
}
}
- pub struct ProgressBar;
-
- impl progress_bar::StyleSheet for ProgressBar {
- fn style(&self) -> progress_bar::Style {
- progress_bar::Style {
- background: SURFACE.into(),
- bar: ACTIVE.into(),
- border_radius: 10.0,
- }
- }
- }
-
pub struct Checkbox;
impl checkbox::StyleSheet for Checkbox {