summaryrefslogtreecommitdiffstats
path: root/examples/modal
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-14 01:47:39 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-14 01:47:39 +0200
commita25b1af45690bdd8e1cbb20ee3a5b1c4342de455 (patch)
tree432044cf682dd73d1019a2f964749e78db178865 /examples/modal
parente6d0b3bda5042a1017a5944a5227c97e0ed6caf9 (diff)
downloadiced-a25b1af45690bdd8e1cbb20ee3a5b1c4342de455.tar.gz
iced-a25b1af45690bdd8e1cbb20ee3a5b1c4342de455.tar.bz2
iced-a25b1af45690bdd8e1cbb20ee3a5b1c4342de455.zip
Replace `Command` with a new `Task` API with chain support
Diffstat (limited to 'examples/modal')
-rw-r--r--examples/modal/src/main.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/modal/src/main.rs b/examples/modal/src/main.rs
index a012c310..d185cf3b 100644
--- a/examples/modal/src/main.rs
+++ b/examples/modal/src/main.rs
@@ -5,7 +5,7 @@ use iced::widget::{
self, button, center, column, container, horizontal_space, mouse_area,
opaque, pick_list, row, stack, text, text_input,
};
-use iced::{Alignment, Color, Command, Element, Length, Subscription};
+use iced::{Alignment, Color, Element, Length, Subscription, Task};
use std::fmt;
@@ -39,7 +39,7 @@ impl App {
event::listen().map(Message::Event)
}
- fn update(&mut self, message: Message) -> Command<Message> {
+ fn update(&mut self, message: Message) -> Task<Message> {
match message {
Message::ShowModal => {
self.show_modal = true;
@@ -47,26 +47,26 @@ impl App {
}
Message::HideModal => {
self.hide_modal();
- Command::none()
+ Task::none()
}
Message::Email(email) => {
self.email = email;
- Command::none()
+ Task::none()
}
Message::Password(password) => {
self.password = password;
- Command::none()
+ Task::none()
}
Message::Plan(plan) => {
self.plan = plan;
- Command::none()
+ Task::none()
}
Message::Submit => {
if !self.email.is_empty() && !self.password.is_empty() {
self.hide_modal();
}
- Command::none()
+ Task::none()
}
Message::Event(event) => match event {
Event::Keyboard(keyboard::Event::KeyPressed {
@@ -85,9 +85,9 @@ impl App {
..
}) => {
self.hide_modal();
- Command::none()
+ Task::none()
}
- _ => Command::none(),
+ _ => Task::none(),
},
}
}