diff options
author | 2023-10-02 20:18:15 +0200 | |
---|---|---|
committer | 2024-02-01 13:16:28 +0100 | |
commit | b5f1ca169567f47b3976de5b4c5a2b1ce37656d5 (patch) | |
tree | 326fae951f16d98ba6141e6cd20d6e7d02e8c71d /examples/tour/src | |
parent | b95f3ab12f863f4de668e4e6f8a75b7d3acdf2b7 (diff) | |
download | iced-b5f1ca169567f47b3976de5b4c5a2b1ce37656d5.tar.gz iced-b5f1ca169567f47b3976de5b4c5a2b1ce37656d5.tar.bz2 iced-b5f1ca169567f47b3976de5b4c5a2b1ce37656d5.zip |
Introduce support for disabling a `checkbox`
Diffstat (limited to 'examples/tour/src')
-rw-r--r-- | examples/tour/src/main.rs | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index b656289a..6d24b5ec 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -554,11 +554,13 @@ impl<'a> Step { .width(Length::Fill) .horizontal_alignment(alignment::Horizontal::Center), ) - .push(checkbox( - "Use nearest interpolation", - filter_method == image::FilterMethod::Nearest, - StepMessage::ImageUseNearestToggled, - )) + .push( + checkbox( + "Use nearest interpolation", + filter_method == image::FilterMethod::Nearest, + ) + .on_toggle(StepMessage::ImageUseNearestToggled), + ) .align_items(Alignment::Center) } @@ -616,16 +618,14 @@ impl<'a> Step { } else { text_input }) - .push(checkbox( - "Enable password mode", - is_secure, - StepMessage::ToggleSecureInput, - )) - .push(checkbox( - "Show icon", - is_showing_icon, - StepMessage::ToggleTextInputIcon, - )) + .push( + checkbox("Enable password mode", is_secure) + .on_toggle(StepMessage::ToggleSecureInput), + ) + .push( + checkbox("Show icon", is_showing_icon) + .on_toggle(StepMessage::ToggleTextInputIcon), + ) .push( "A text input produces a message every time it changes. It is \ very easy to keep track of its contents:", @@ -658,7 +658,8 @@ impl<'a> Step { .horizontal_alignment(alignment::Horizontal::Center), ) } else { - checkbox("Explain layout", debug, StepMessage::DebugToggled) + checkbox("Explain layout", debug) + .on_toggle(StepMessage::DebugToggled) .into() }) .push("Feel free to go back and take a look.") |