diff options
author | 2020-01-05 19:29:12 +0100 | |
---|---|---|
committer | 2020-01-05 19:29:12 +0100 | |
commit | 1a0effa961344677daf17b4192243423a154f1bf (patch) | |
tree | 954d2431d69004c1037d19c3bb930273347df8d4 /examples/todos.rs | |
parent | 2116fbb3c2412030a676c60d65784b9dfa467a0a (diff) | |
download | iced-1a0effa961344677daf17b4192243423a154f1bf.tar.gz iced-1a0effa961344677daf17b4192243423a154f1bf.tar.bz2 iced-1a0effa961344677daf17b4192243423a154f1bf.zip |
Add border and shadow styling to `Button`
Diffstat (limited to 'examples/todos.rs')
-rw-r--r-- | examples/todos.rs | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/examples/todos.rs b/examples/todos.rs index ca20183f..1563aad5 100644 --- a/examples/todos.rs +++ b/examples/todos.rs @@ -551,7 +551,7 @@ impl SavedState { } mod style { - use iced::{button, Background, Color}; + use iced::{button, Background, Color, Vector}; pub enum Button { Filter { selected: bool }, @@ -569,31 +569,25 @@ mod style { Color::from_rgb(0.2, 0.2, 0.7), )), border_radius: 10, - shadow_offset: 0.0, text_color: Color::WHITE, + ..button::Style::default() } } else { - button::Style { - background: None, - border_radius: 0, - shadow_offset: 0.0, - text_color: Color::BLACK, - } + button::Style::default() } } Button::Icon => button::Style { - background: None, - border_radius: 0, - shadow_offset: 0.0, text_color: Color::from_rgb(0.5, 0.5, 0.5), + ..button::Style::default() }, Button::Destructive => button::Style { background: Some(Background::Color(Color::from_rgb( 0.8, 0.2, 0.2, ))), border_radius: 5, - shadow_offset: 1.0, text_color: Color::WHITE, + shadow_offset: Vector::new(1.0, 1.0), + ..button::Style::default() }, } } @@ -609,7 +603,7 @@ mod style { } _ => active.text_color, }, - shadow_offset: active.shadow_offset + 1.0, + shadow_offset: active.shadow_offset + Vector::new(0.0, 1.0), ..active } } |