summaryrefslogtreecommitdiffstats
path: root/examples/toast
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-15 02:38:07 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-15 02:38:07 +0100
commitfeab96f323189ebae070a5d025531f86e436e21f (patch)
treebc15f73541151ef27e23ba1a908713b95c027d44 /examples/toast
parente57668d6776d4354b6d3df049aee64be0dc8eda2 (diff)
downloadiced-feab96f323189ebae070a5d025531f86e436e21f.tar.gz
iced-feab96f323189ebae070a5d025531f86e436e21f.tar.bz2
iced-feab96f323189ebae070a5d025531f86e436e21f.zip
Add `push_maybe` to `Column` and `Row`
Diffstat (limited to 'examples/toast')
-rw-r--r--examples/toast/src/main.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs
index ae947acb..c1d29193 100644
--- a/examples/toast/src/main.rs
+++ b/examples/toast/src/main.rs
@@ -111,11 +111,10 @@ impl Application for App {
column![text(title).size(14), content].spacing(5)
};
- let mut add_toast = button("Add Toast");
-
- if !self.editing.body.is_empty() && !self.editing.title.is_empty() {
- add_toast = add_toast.on_press(Message::Add);
- }
+ let add_toast = button("Add Toast").on_press_maybe(
+ (!self.editing.body.is_empty() && !self.editing.title.is_empty())
+ .then_some(Message::Add),
+ );
let content = container(
column![