summaryrefslogtreecommitdiff
path: root/theme_test
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2025-04-17 03:00:52 +0200
committerpml68 <contact@pml68.dev>2025-04-17 03:06:43 +0200
commitce62ff16fbd8e839b5f707f8d9637db083945803 (patch)
tree8d7651817fbf17b24f4baae9cc72c83fd224ca71 /theme_test
parentfeat(material_theme): implement `radio::Catalog` (diff)
downloadiced-builder-ce62ff16fbd8e839b5f707f8d9637db083945803.tar.gz
refactor: inline Dark and Light theme definitions, remove toml files
Diffstat (limited to '')
-rw-r--r--theme_test/src/main.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/theme_test/src/main.rs b/theme_test/src/main.rs
index 953d4e0..9aab2fe 100644
--- a/theme_test/src/main.rs
+++ b/theme_test/src/main.rs
@@ -1,7 +1,7 @@
use iced::Element;
use iced::Length::Fill;
use iced::widget::{
- button, checkbox, column, container, pick_list, row, text_input,
+ button, checkbox, column, container, pick_list, radio, row, text_input,
};
use iced_anim::{Animated, Animation, Event};
use iced_dialog::dialog;
@@ -29,6 +29,7 @@ enum Message {
CloseDialog,
Input(String),
CheckBox(bool),
+ Radio(Choice),
SwitchTheme(Event<Theme>),
}
@@ -38,6 +39,14 @@ pub struct State {
show_dialog: bool,
content: String,
is_checked: bool,
+ selection: Option<Choice>,
+}
+
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum Choice {
+ A,
+ B,
+ C,
}
impl State {
@@ -52,6 +61,7 @@ impl State {
}
Message::Input(content) => self.content = content,
Message::CheckBox(is_checked) => self.is_checked = is_checked,
+ Message::Radio(choice) => self.selection = Some(choice),
Message::SwitchTheme(event) => {
self.theme.update(event);
}
@@ -133,6 +143,9 @@ impl State {
.on_toggle(Message::CheckBox)
.style(material_theme::checkbox::error),
checkbox("Disabled", self.is_checked),
+ radio("A", Choice::A, self.selection, Message::Radio,),
+ radio("B", Choice::B, self.selection, Message::Radio,),
+ radio("C", Choice::C, self.selection, Message::Radio,),
]
.spacing(10)
]