diff options
Diffstat (limited to 'examples/component/src/main.rs')
-rw-r--r-- | examples/component/src/main.rs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/examples/component/src/main.rs b/examples/component/src/main.rs index 5625f12a..a5d2e508 100644 --- a/examples/component/src/main.rs +++ b/examples/component/src/main.rs @@ -34,9 +34,8 @@ impl Component { } mod numeric_input { - use iced::alignment::{self, Alignment}; use iced::widget::{button, component, row, text, text_input, Component}; - use iced::{Element, Length, Size}; + use iced::{Center, Element, Fill, Length, Size}; pub struct NumericInput<Message> { value: Option<u32>, @@ -104,16 +103,10 @@ mod numeric_input { fn view(&self, _state: &Self::State) -> Element<'_, Event, Theme> { let button = |label, on_press| { - button( - text(label) - .width(Length::Fill) - .height(Length::Fill) - .horizontal_alignment(alignment::Horizontal::Center) - .vertical_alignment(alignment::Vertical::Center), - ) - .width(40) - .height(40) - .on_press(on_press) + button(text(label).width(Fill).height(Fill).center()) + .width(40) + .height(40) + .on_press(on_press) }; row![ @@ -130,7 +123,7 @@ mod numeric_input { .padding(10), button("+", Event::IncrementPressed), ] - .align_items(Alignment::Center) + .align_y(Center) .spacing(10) .into() } |