diff options
author | 2024-05-08 19:16:20 +0900 | |
---|---|---|
committer | 2024-05-08 19:16:20 +0900 | |
commit | ff26fb7df43bd241253af85e0621e2cc030e9cec (patch) | |
tree | 2b3272bb178f8757169511966589fe6a106733f4 /examples/layout | |
parent | 0ebe0629cef37aee5c48b9409fc36618a3a3e60d (diff) | |
parent | 477887b3870aa5fbdab96c3a06f3b930462d7842 (diff) | |
download | iced-ff26fb7df43bd241253af85e0621e2cc030e9cec.tar.gz iced-ff26fb7df43bd241253af85e0621e2cc030e9cec.tar.bz2 iced-ff26fb7df43bd241253af85e0621e2cc030e9cec.zip |
Merge branch 'iced-rs-master' into viewer_content_fit
Diffstat (limited to 'examples/layout')
-rw-r--r-- | examples/layout/src/main.rs | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index 66d79091..5f14c03b 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -1,8 +1,8 @@ use iced::keyboard; use iced::mouse; use iced::widget::{ - button, canvas, checkbox, column, container, horizontal_space, pick_list, - row, scrollable, text, + button, canvas, center, checkbox, column, container, horizontal_space, + pick_list, row, scrollable, text, }; use iced::{ color, Alignment, Element, Font, Length, Point, Rectangle, Renderer, @@ -76,7 +76,7 @@ impl Layout { .spacing(20) .align_items(Alignment::Center); - let example = container(if self.explain { + let example = center(if self.explain { self.example.view().explain(color!(0x0000ff)) } else { self.example.view() @@ -87,11 +87,7 @@ impl Layout { container::Style::default() .with_border(palette.background.strong.color, 4.0) }) - .padding(4) - .width(Length::Fill) - .height(Length::Fill) - .center_x() - .center_y(); + .padding(4); let controls = row([ (!self.example.is_first()).then_some( @@ -195,12 +191,7 @@ impl Default for Example { } fn centered<'a>() -> Element<'a, Message> { - container(text("I am centered!").size(50)) - .width(Length::Fill) - .height(Length::Fill) - .center_x() - .center_y() - .into() + center(text("I am centered!").size(50)).into() } fn column_<'a>() -> Element<'a, Message> { @@ -260,7 +251,6 @@ fn application<'a>() -> Element<'a, Message> { .align_items(Alignment::Center), ) .style(container::rounded_box) - .height(Length::Fill) .center_y(); let content = container( |