aboutsummaryrefslogtreecommitdiff
path: root/examples/styling.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--examples/styling.rs35
1 files changed, 7 insertions, 28 deletions
diff --git a/examples/styling.rs b/examples/styling.rs
index 6336da3..2bfd36f 100644
--- a/examples/styling.rs
+++ b/examples/styling.rs
@@ -3,11 +3,8 @@ use iced::widget::{
Button, center, checkbox, column, container, pick_list, progress_bar, row,
rule, scrollable, slider, space, text, text_input, toggler,
};
-use iced::{Center, Fill, Subscription, border};
-use iced_material::{
- Theme, button,
- utils::{disabled_container, disabled_text},
-};
+use iced::{Center, Fill, Subscription};
+use iced_material::{Theme, button};
type Element<'a, Message> = iced::Element<'a, Message, Theme>;
@@ -93,30 +90,12 @@ impl Styling {
text("Theme:"),
row![
if self.system_theme {
- Element::from(
- container(text(self.theme.to_string()))
- .padding([5, 10])
- .width(Fill)
- .style(|theme: &Theme| {
- let color = theme.colors().surface.text;
- container::Style {
- background: Some(
- disabled_container(color).into(),
- ),
- text_color: Some(disabled_text(color)),
- border: border::rounded(4),
- ..Default::default()
- }
- }),
- )
+ pick_list(Some(&self.theme), Theme::ALL, Theme::to_string)
+ .width(Fill)
} else {
- pick_list(
- Theme::ALL,
- Some(&self.theme),
- Message::ThemeChanged,
- )
- .width(Fill)
- .into()
+ pick_list(Some(&self.theme), Theme::ALL, Theme::to_string)
+ .on_select(Message::ThemeChanged)
+ .width(Fill)
},
checkbox(self.system_theme)
.label("Use system theme")