summaryrefslogtreecommitdiffstats
path: root/examples/styling
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 05:33:47 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 05:33:47 +0100
commitc22269bff3085012d326a0df77bf27ad5bcb41b7 (patch)
tree1083f21d012ab2bac88fb51537d4dc431bc7f170 /examples/styling
parent0524e9b4571d264018656418f02a1f9e27e268d7 (diff)
downloadiced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.gz
iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.bz2
iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.zip
Introduce `Program` API
Diffstat (limited to 'examples/styling')
-rw-r--r--examples/styling/src/main.rs19
1 files changed, 6 insertions, 13 deletions
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs
index befdfc1b..c00c8caf 100644
--- a/examples/styling/src/main.rs
+++ b/examples/styling/src/main.rs
@@ -3,10 +3,13 @@ use iced::widget::{
progress_bar, row, scrollable, slider, text, text_input, toggler,
vertical_rule, vertical_space,
};
-use iced::{Alignment, Element, Length, Sandbox, Settings, Theme};
+use iced::{Alignment, Element, Length, Theme};
pub fn main() -> iced::Result {
- Styling::run(Settings::default())
+ iced::sandbox(Styling::update, Styling::view)
+ .theme(Styling::theme)
+ .title("Styling - Iced")
+ .run()
}
#[derive(Default)]
@@ -28,17 +31,7 @@ enum Message {
TogglerToggled(bool),
}
-impl Sandbox for Styling {
- type Message = Message;
-
- fn new() -> Self {
- Styling::default()
- }
-
- fn title(&self) -> String {
- String::from("Styling - Iced")
- }
-
+impl Styling {
fn update(&mut self, message: Message) {
match message {
Message::ThemeChanged(theme) => {