From 0322e820eb40d36a7425246278b7bcb22b7010aa Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 27 Mar 2023 15:43:52 +0200 Subject: Create `layout` example --- examples/layout/Cargo.toml | 9 ++++ examples/layout/src/main.rs | 123 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 examples/layout/Cargo.toml create mode 100644 examples/layout/src/main.rs (limited to 'examples/layout') diff --git a/examples/layout/Cargo.toml b/examples/layout/Cargo.toml new file mode 100644 index 00000000..c2c3f49b --- /dev/null +++ b/examples/layout/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "layout" +version = "0.1.0" +authors = ["Héctor Ramón Jiménez "] +edition = "2021" +publish = false + +[dependencies] +iced = { path = "../.." } diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs new file mode 100644 index 00000000..1b0c0c94 --- /dev/null +++ b/examples/layout/src/main.rs @@ -0,0 +1,123 @@ +use iced::executor; +use iced::widget::{column, container, row, text, vertical_rule}; +use iced::{ + Application, Command, Element, Length, Settings, Subscription, Theme, +}; + +pub fn main() -> iced::Result { + Layout::run(Settings::default()) +} + +#[derive(Debug)] +struct Layout { + previous: Vec, + current: Example, + next: Vec, +} + +#[derive(Debug, Clone, Copy)] +enum Message { + Next, + Previous, +} + +impl Application for Layout { + type Message = Message; + type Theme = Theme; + type Executor = executor::Default; + type Flags = (); + + fn new(_flags: Self::Flags) -> (Self, Command) { + ( + Self { + previous: vec![], + current: Example::Centered, + next: vec![Example::NestedQuotes], + }, + Command::none(), + ) + } + + fn title(&self) -> String { + String::from("Counter - Iced") + } + + fn update(&mut self, message: Self::Message) -> Command { + match message { + Message::Next => { + if !self.next.is_empty() { + let previous = std::mem::replace( + &mut self.current, + self.next.remove(0), + ); + + self.previous.push(previous); + } + } + Message::Previous => { + if let Some(previous) = self.previous.pop() { + let next = std::mem::replace(&mut self.current, previous); + + self.next.insert(0, next); + } + } + } + + Command::none() + } + + fn subscription(&self) -> Subscription { + use iced::event::{self, Event}; + use iced::keyboard; + + event::listen_with(|event, status| match event { + Event::Keyboard(keyboard::Event::KeyReleased { + key_code, .. + }) if status == event::Status::Ignored => match key_code { + keyboard::KeyCode::Left => Some(Message::Previous), + keyboard::KeyCode::Right => Some(Message::Next), + _ => None, + }, + _ => None, + }) + } + + fn view(&self) -> Element { + self.current.view() + } +} + +#[derive(Debug)] +enum Example { + Centered, + NestedQuotes, +} + +impl Example { + fn view(&self) -> Element { + match self { + Self::Centered => container(text("I am centered!").size(50)) + .width(Length::Fill) + .height(Length::Fill) + .center_x() + .center_y() + .into(), + Self::NestedQuotes => container((1..5).fold( + column![text("Original text")].padding(10), + |quotes, i| { + column![ + row![vertical_rule(2), quotes], + text(format!("Reply {i}")) + ] + .spacing(10) + .padding(10) + }, + )) + .width(Length::Fill) + .height(Length::Fill) + .center_x() + .center_y() + .into(), + } + } +} -- cgit From 22226394f7b1a0e0205b9bb5b3ef9b85a3b406f5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 5 Jan 2024 17:24:43 +0100 Subject: Introduce `Widget::size_hint` and fix further layout inconsistencies --- examples/layout/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/layout') diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index 1b0c0c94..eeaa76b6 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -106,7 +106,7 @@ impl Example { column![text("Original text")].padding(10), |quotes, i| { column![ - row![vertical_rule(2), quotes], + row![vertical_rule(2), quotes].height(Length::Shrink), text(format!("Reply {i}")) ] .spacing(10) -- cgit From a79b2adf5c3e345667341451a4aaaa14fc9bfe80 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Jan 2024 02:16:29 +0100 Subject: Use first-class functions in `layout` example --- examples/layout/src/main.rs | 143 +++++++++++++++++++++++++------------------- 1 file changed, 83 insertions(+), 60 deletions(-) (limited to 'examples/layout') diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index eeaa76b6..d4d81617 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -1,4 +1,5 @@ use iced::executor; +use iced::keyboard; use iced::widget::{column, container, row, text, vertical_rule}; use iced::{ Application, Command, Element, Length, Settings, Subscription, Theme, @@ -10,9 +11,7 @@ pub fn main() -> iced::Result { #[derive(Debug)] struct Layout { - previous: Vec, - current: Example, - next: Vec, + example: Example, } #[derive(Debug, Clone, Copy)] @@ -30,36 +29,23 @@ impl Application for Layout { fn new(_flags: Self::Flags) -> (Self, Command) { ( Self { - previous: vec![], - current: Example::Centered, - next: vec![Example::NestedQuotes], + example: Example::default(), }, Command::none(), ) } fn title(&self) -> String { - String::from("Counter - Iced") + format!("{} - Layout - Iced", self.example.title) } fn update(&mut self, message: Self::Message) -> Command { match message { Message::Next => { - if !self.next.is_empty() { - let previous = std::mem::replace( - &mut self.current, - self.next.remove(0), - ); - - self.previous.push(previous); - } + self.example = self.example.next(); } Message::Previous => { - if let Some(previous) = self.previous.pop() { - let next = std::mem::replace(&mut self.current, previous); - - self.next.insert(0, next); - } + self.example = self.example.previous(); } } @@ -67,57 +53,94 @@ impl Application for Layout { } fn subscription(&self) -> Subscription { - use iced::event::{self, Event}; - use iced::keyboard; - - event::listen_with(|event, status| match event { - Event::Keyboard(keyboard::Event::KeyReleased { - key_code, .. - }) if status == event::Status::Ignored => match key_code { - keyboard::KeyCode::Left => Some(Message::Previous), - keyboard::KeyCode::Right => Some(Message::Next), - _ => None, - }, + keyboard::on_key_release(|key_code, _modifiers| match key_code { + keyboard::KeyCode::Left => Some(Message::Previous), + keyboard::KeyCode::Right => Some(Message::Next), _ => None, }) } fn view(&self) -> Element { - self.current.view() + self.example.view() } } -#[derive(Debug)] -enum Example { - Centered, - NestedQuotes, +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +struct Example { + title: &'static str, + view: fn() -> Element<'static, Message>, } impl Example { + const LIST: &'static [Self] = &[ + Self { + title: "Centered", + view: centered, + }, + Self { + title: "Nested Quotes", + view: nested_quotes, + }, + ]; + + fn previous(self) -> Self { + let Some(index) = + Self::LIST.iter().position(|&example| example == self) + else { + return self; + }; + + Self::LIST + .get(index.saturating_sub(1)) + .copied() + .unwrap_or(self) + } + + fn next(self) -> Self { + let Some(index) = + Self::LIST.iter().position(|&example| example == self) + else { + return self; + }; + + Self::LIST.get(index + 1).copied().unwrap_or(self) + } + fn view(&self) -> Element { - match self { - Self::Centered => container(text("I am centered!").size(50)) - .width(Length::Fill) - .height(Length::Fill) - .center_x() - .center_y() - .into(), - Self::NestedQuotes => container((1..5).fold( - column![text("Original text")].padding(10), - |quotes, i| { - column![ - row![vertical_rule(2), quotes].height(Length::Shrink), - text(format!("Reply {i}")) - ] - .spacing(10) - .padding(10) - }, - )) - .width(Length::Fill) - .height(Length::Fill) - .center_x() - .center_y() - .into(), - } + (self.view)() + } +} + +impl Default for Example { + fn default() -> Self { + Self::LIST[0] } } + +fn centered<'a>() -> Element<'a, Message> { + container(text("I am centered!").size(50)) + .width(Length::Fill) + .height(Length::Fill) + .center_x() + .center_y() + .into() +} + +fn nested_quotes<'a>() -> Element<'a, Message> { + container((1..5).fold( + column![text("Original text")].padding(10), + |quotes, i| { + column![ + row![vertical_rule(2), quotes].height(Length::Shrink), + text(format!("Reply {i}")) + ] + .spacing(10) + .padding(10) + }, + )) + .width(Length::Fill) + .height(Length::Fill) + .center_x() + .center_y() + .into() +} -- cgit From 81ecc4a67f7982c6300a4d5e8ec4e8aac8cbd881 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Jan 2024 02:58:40 +0100 Subject: Add basic controls to `layout` example --- examples/layout/src/main.rs | 67 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 14 deletions(-) (limited to 'examples/layout') diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index d4d81617..6d02434d 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -1,8 +1,11 @@ use iced::executor; use iced::keyboard; -use iced::widget::{column, container, row, text, vertical_rule}; +use iced::widget::{ + button, column, container, horizontal_space, row, text, vertical_rule, +}; use iced::{ - Application, Command, Element, Length, Settings, Subscription, Theme, + color, Application, Color, Command, Element, Length, Settings, + Subscription, Theme, }; pub fn main() -> iced::Result { @@ -61,7 +64,29 @@ impl Application for Layout { } fn view(&self) -> Element { - self.example.view() + let example = container(self.example.view()).style( + container::Appearance::default().with_border(Color::BLACK, 2.0), + ); + + let controls = row([ + (!self.example.is_first()).then_some( + button("← Previous") + .padding([5, 10]) + .on_press(Message::Previous) + .into(), + ), + Some(horizontal_space(Length::Fill).into()), + (!self.example.is_last()).then_some( + button("Next →") + .padding([5, 10]) + .on_press(Message::Next) + .into(), + ), + ] + .into_iter() + .filter_map(std::convert::identity)); + + column![example, controls].spacing(10).padding(20).into() } } @@ -83,6 +108,14 @@ impl Example { }, ]; + fn is_first(self) -> bool { + Self::LIST.first() == Some(&self) + } + + fn is_last(self) -> bool { + Self::LIST.last() == Some(&self) + } + fn previous(self) -> Self { let Some(index) = Self::LIST.iter().position(|&example| example == self) @@ -127,20 +160,26 @@ fn centered<'a>() -> Element<'a, Message> { } fn nested_quotes<'a>() -> Element<'a, Message> { - container((1..5).fold( - column![text("Original text")].padding(10), - |quotes, i| { + let quotes = + (1..5).fold(column![text("Original text")].padding(10), |quotes, i| { column![ - row![vertical_rule(2), quotes].height(Length::Shrink), + container( + row![vertical_rule(2), quotes].height(Length::Shrink) + ) + .style( + container::Appearance::default() + .with_background(color!(0x000000, 0.05)) + ), text(format!("Reply {i}")) ] .spacing(10) .padding(10) - }, - )) - .width(Length::Fill) - .height(Length::Fill) - .center_x() - .center_y() - .into() + }); + + container(quotes) + .width(Length::Fill) + .height(Length::Fill) + .center_x() + .center_y() + .into() } -- cgit From 5dbded61dea19f77eb370e08e72acfa20ffd1a86 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Jan 2024 03:07:10 +0100 Subject: Use `flatten` instead of `filter_map` in `layout` example --- examples/layout/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/layout') diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index 6d02434d..448d2995 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -84,7 +84,7 @@ impl Application for Layout { ), ] .into_iter() - .filter_map(std::convert::identity)); + .flatten()); column![example, controls].spacing(10).padding(20).into() } -- cgit From d76705df29f1960124bd06277683448e18f788b0 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Jan 2024 03:56:39 +0100 Subject: Add `explain` toggle to `layout` example --- examples/layout/src/main.rs | 64 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 11 deletions(-) (limited to 'examples/layout') diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index 448d2995..e23b2218 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -1,11 +1,12 @@ use iced::executor; use iced::keyboard; use iced::widget::{ - button, column, container, horizontal_space, row, text, vertical_rule, + button, checkbox, column, container, horizontal_space, row, text, + vertical_rule, }; use iced::{ - color, Application, Color, Command, Element, Length, Settings, - Subscription, Theme, + color, Alignment, Application, Color, Command, Element, Font, Length, + Settings, Subscription, Theme, }; pub fn main() -> iced::Result { @@ -15,12 +16,14 @@ pub fn main() -> iced::Result { #[derive(Debug)] struct Layout { example: Example, + explain: bool, } #[derive(Debug, Clone, Copy)] enum Message { Next, Previous, + ExplainToggled(bool), } impl Application for Layout { @@ -33,6 +36,7 @@ impl Application for Layout { ( Self { example: Example::default(), + explain: false, }, Command::none(), ) @@ -50,6 +54,9 @@ impl Application for Layout { Message::Previous => { self.example = self.example.previous(); } + Message::ExplainToggled(explain) => { + self.explain = explain; + } } Command::none() @@ -64,9 +71,24 @@ impl Application for Layout { } fn view(&self) -> Element { - let example = container(self.example.view()).style( - container::Appearance::default().with_border(Color::BLACK, 2.0), - ); + let header = row![ + text(self.example.title).size(20).font(Font::MONOSPACE), + horizontal_space(Length::Fill), + checkbox("Explain", self.explain, Message::ExplainToggled), + ] + .align_items(Alignment::Center); + + let example = container(if self.explain { + self.example.view().explain(color!(0x0000ff)) + } else { + self.example.view() + }) + .style(|theme: &Theme| { + let palette = theme.extended_palette(); + + container::Appearance::default() + .with_border(palette.background.strong.color, 4.0) + }); let controls = row([ (!self.example.is_first()).then_some( @@ -86,7 +108,14 @@ impl Application for Layout { .into_iter() .flatten()); - column![example, controls].spacing(10).padding(20).into() + column![header, example, controls] + .spacing(10) + .padding(20) + .into() + } + + fn theme(&self) -> Theme { + Theme::Dark } } @@ -166,10 +195,23 @@ fn nested_quotes<'a>() -> Element<'a, Message> { container( row![vertical_rule(2), quotes].height(Length::Shrink) ) - .style( - container::Appearance::default() - .with_background(color!(0x000000, 0.05)) - ), + .style(|theme: &Theme| { + let palette = theme.extended_palette(); + + container::Appearance::default().with_background( + if palette.is_dark { + Color { + a: 0.01, + ..Color::WHITE + } + } else { + Color { + a: 0.08, + ..Color::BLACK + } + }, + ) + }), text(format!("Reply {i}")) ] .spacing(10) -- cgit From 3850a46db6e13f2948f5731f4ceec42764391f5d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Jan 2024 08:15:05 +0100 Subject: Add `Theme` selector to `layout` example --- examples/layout/src/main.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'examples/layout') diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index e23b2218..c1ff3951 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -1,8 +1,8 @@ use iced::executor; use iced::keyboard; use iced::widget::{ - button, checkbox, column, container, horizontal_space, row, text, - vertical_rule, + button, checkbox, column, container, horizontal_space, pick_list, row, + text, vertical_rule, }; use iced::{ color, Alignment, Application, Color, Command, Element, Font, Length, @@ -17,13 +17,15 @@ pub fn main() -> iced::Result { struct Layout { example: Example, explain: bool, + theme: Theme, } -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone)] enum Message { Next, Previous, ExplainToggled(bool), + ThemeSelected(Theme), } impl Application for Layout { @@ -37,6 +39,7 @@ impl Application for Layout { Self { example: Example::default(), explain: false, + theme: Theme::Light, }, Command::none(), ) @@ -57,6 +60,9 @@ impl Application for Layout { Message::ExplainToggled(explain) => { self.explain = explain; } + Message::ThemeSelected(theme) => { + self.theme = theme; + } } Command::none() @@ -75,7 +81,13 @@ impl Application for Layout { text(self.example.title).size(20).font(Font::MONOSPACE), horizontal_space(Length::Fill), checkbox("Explain", self.explain, Message::ExplainToggled), + pick_list( + Theme::ALL, + Some(self.theme.clone()), + Message::ThemeSelected + ), ] + .spacing(20) .align_items(Alignment::Center); let example = container(if self.explain { @@ -115,7 +127,7 @@ impl Application for Layout { } fn theme(&self) -> Theme { - Theme::Dark + self.theme.clone() } } -- cgit From a6cbc365037d740ee9bb8d21fffe361cd198477e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Jan 2024 09:01:01 +0100 Subject: Showcase more layouts in `layout` example --- examples/layout/Cargo.toml | 2 +- examples/layout/src/main.rs | 144 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 132 insertions(+), 14 deletions(-) (limited to 'examples/layout') diff --git a/examples/layout/Cargo.toml b/examples/layout/Cargo.toml index c2c3f49b..855f98d0 100644 --- a/examples/layout/Cargo.toml +++ b/examples/layout/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" publish = false [dependencies] -iced = { path = "../.." } +iced = { path = "../..", features = ["canvas"] } diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index c1ff3951..3e69e1a8 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -1,12 +1,14 @@ use iced::executor; use iced::keyboard; +use iced::mouse; +use iced::theme; use iced::widget::{ - button, checkbox, column, container, horizontal_space, pick_list, row, - text, vertical_rule, + button, canvas, checkbox, column, container, horizontal_space, pick_list, + row, scrollable, text, vertical_rule, vertical_space, }; use iced::{ color, Alignment, Application, Color, Command, Element, Font, Length, - Settings, Subscription, Theme, + Point, Rectangle, Renderer, Settings, Subscription, Theme, }; pub fn main() -> iced::Result { @@ -100,7 +102,12 @@ impl Application for Layout { container::Appearance::default() .with_border(palette.background.strong.color, 4.0) - }); + }) + .padding(4) + .width(Length::Fill) + .height(Length::Fill) + .center_x() + .center_y(); let controls = row([ (!self.example.is_first()).then_some( @@ -143,6 +150,22 @@ impl Example { title: "Centered", view: centered, }, + Self { + title: "Column", + view: column_, + }, + Self { + title: "Row", + view: row_, + }, + Self { + title: "Space", + view: space, + }, + Self { + title: "Application", + view: application, + }, Self { title: "Nested Quotes", view: nested_quotes, @@ -200,9 +223,79 @@ fn centered<'a>() -> Element<'a, Message> { .into() } +fn column_<'a>() -> Element<'a, Message> { + column![ + "A column can be used to", + "lay out widgets vertically.", + square(50), + square(50), + square(50), + "The amount of space between", + "elements can be configured!", + ] + .spacing(40) + .into() +} + +fn row_<'a>() -> Element<'a, Message> { + row![ + "A row works like a column...", + square(50), + square(50), + square(50), + "but lays out widgets horizontally!", + ] + .spacing(40) + .into() +} + +fn space<'a>() -> Element<'a, Message> { + row!["Left!", horizontal_space(Length::Fill), "Right!"].into() +} + +fn application<'a>() -> Element<'a, Message> { + let header = container( + row![ + square(40), + horizontal_space(Length::Fill), + "Header!", + horizontal_space(Length::Fill), + square(40), + ] + .padding(10) + .align_items(Alignment::Center), + ) + .style(|theme: &Theme| { + let palette = theme.extended_palette(); + + container::Appearance::default() + .with_border(palette.background.strong.color, 1) + }); + + let sidebar = container( + column!["Sidebar!", square(50), square(50)] + .spacing(40) + .padding(10) + .width(200) + .align_items(Alignment::Center), + ) + .style(theme::Container::Box) + .height(Length::Fill) + .center_y(); + + let content = container( + scrollable(column!["Content!", vertical_space(2000), "The end"]) + .width(Length::Fill) + .height(Length::Fill), + ) + .padding(10); + + column![header, row![sidebar, content]].into() +} + fn nested_quotes<'a>() -> Element<'a, Message> { - let quotes = - (1..5).fold(column![text("Original text")].padding(10), |quotes, i| { + (1..5) + .fold(column![text("Original text")].padding(10), |quotes, i| { column![ container( row![vertical_rule(2), quotes].height(Length::Shrink) @@ -228,12 +321,37 @@ fn nested_quotes<'a>() -> Element<'a, Message> { ] .spacing(10) .padding(10) - }); - - container(quotes) - .width(Length::Fill) - .height(Length::Fill) - .center_x() - .center_y() + }) .into() } + +fn square<'a>(size: impl Into + Copy) -> Element<'a, Message> { + struct Square; + + impl canvas::Program for Square { + type State = (); + + fn draw( + &self, + _state: &Self::State, + renderer: &Renderer, + theme: &Theme, + bounds: Rectangle, + _cursor: mouse::Cursor, + ) -> Vec { + let mut frame = canvas::Frame::new(renderer, bounds.size()); + + let palette = theme.extended_palette(); + + frame.fill_rectangle( + Point::ORIGIN, + bounds.size(), + palette.background.strong.color, + ); + + vec![frame.into_geometry()] + } + } + + canvas(Square).width(size).height(size).into() +} -- cgit From 226271148e77a4f8966ce84b0c948c268176d92b Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 10 Jan 2024 10:08:11 +0100 Subject: Use multiple squares instead of `vertical_space` in `layout` example --- examples/layout/src/main.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'examples/layout') diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs index 3e69e1a8..60dabe54 100644 --- a/examples/layout/src/main.rs +++ b/examples/layout/src/main.rs @@ -4,7 +4,7 @@ use iced::mouse; use iced::theme; use iced::widget::{ button, canvas, checkbox, column, container, horizontal_space, pick_list, - row, scrollable, text, vertical_rule, vertical_space, + row, scrollable, text, vertical_rule, }; use iced::{ color, Alignment, Application, Color, Command, Element, Font, Length, @@ -284,9 +284,19 @@ fn application<'a>() -> Element<'a, Message> { .center_y(); let content = container( - scrollable(column!["Content!", vertical_space(2000), "The end"]) - .width(Length::Fill) - .height(Length::Fill), + scrollable( + column![ + "Content!", + square(400), + square(200), + square(400), + "The end" + ] + .spacing(40) + .align_items(Alignment::Center) + .width(Length::Fill), + ) + .height(Length::Fill), ) .padding(10); -- cgit