diff options
author | 2025-01-24 15:55:24 +0100 | |
---|---|---|
committer | 2025-01-24 15:55:24 +0100 | |
commit | f8337b8da7ff6bcf876b54d1c7dac460d2e03747 (patch) | |
tree | 495d96fc62b23af7ce2622e87892ca823f1c61fc /examples/tour/src/main.rs | |
parent | 75a6f32a5ef49bb8e6d16506d84b07822a33c41b (diff) | |
download | iced-f8337b8da7ff6bcf876b54d1c7dac460d2e03747.tar.gz iced-f8337b8da7ff6bcf876b54d1c7dac460d2e03747.tar.bz2 iced-f8337b8da7ff6bcf876b54d1c7dac460d2e03747.zip |
Add helper functions for alignment to `widget` module
Diffstat (limited to '')
-rw-r--r-- | examples/tour/src/main.rs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index d8c0b29a..32720c47 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -1,6 +1,6 @@ use iced::widget::{ - button, checkbox, column, container, horizontal_space, image, radio, row, - scrollable, slider, text, text_input, toggler, vertical_space, + button, center_x, center_y, checkbox, column, horizontal_space, image, + radio, row, scrollable, slider, text, text_input, toggler, vertical_space, }; use iced::widget::{Button, Column, Container, Slider}; use iced::{Center, Color, Element, Fill, Font, Pixels}; @@ -166,16 +166,13 @@ impl Tour { .padding(20) .into(); - let scrollable = scrollable( - container(if self.debug { - content.explain(Color::BLACK) - } else { - content - }) - .center_x(Fill), - ); + let scrollable = scrollable(center_x(if self.debug { + content.explain(Color::BLACK) + } else { + content + })); - container(scrollable).center_y(Fill).into() + center_y(scrollable).into() } fn can_continue(&self) -> bool { @@ -543,7 +540,7 @@ fn ferris<'a>( width: u16, filter_method: image::FilterMethod, ) -> Container<'a, Message> { - container( + center_x( // This should go away once we unify resource loading on native // platforms if cfg!(target_arch = "wasm32") { @@ -554,7 +551,6 @@ fn ferris<'a>( .filter_method(filter_method) .width(width), ) - .center_x(Fill) } fn padded_button<Message: Clone>(label: &str) -> Button<'_, Message> { |