From e8049af23dbf4988ff24b75b90104295f61098a2 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 15 Feb 2024 02:08:22 +0100 Subject: Make `horizontal_space` and `vertical_space` fill by default --- examples/toast/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/toast') diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs index 7f067e2f..ae947acb 100644 --- a/examples/toast/src/main.rs +++ b/examples/toast/src/main.rs @@ -274,7 +274,7 @@ mod toast { container( row![ text(toast.title.as_str()), - horizontal_space(Length::Fill), + horizontal_space(), button("X") .on_press((on_close)(index)) .padding(3), -- cgit From feab96f323189ebae070a5d025531f86e436e21f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 15 Feb 2024 02:38:07 +0100 Subject: Add `push_maybe` to `Column` and `Row` --- examples/toast/src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'examples/toast') 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![ -- cgit