summaryrefslogtreecommitdiffstats
path: root/examples/styling
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-07-12 21:40:46 +0200
committerLibravatar GitHub <noreply@github.com>2024-07-12 21:40:46 +0200
commit8cadd3b99485c344feb18b774c8e6fd6c1ea9dd7 (patch)
tree826fa9e0acdf3a4e003f882c94ff24a4ac9f50e4 /examples/styling
parentbe06060117da061ad8cad94ab0830c06def6b147 (diff)
parent3f480d3d18c41188bf40ead0a3dc4497316f11ae (diff)
downloadiced-8cadd3b99485c344feb18b774c8e6fd6c1ea9dd7.tar.gz
iced-8cadd3b99485c344feb18b774c8e6fd6c1ea9dd7.tar.bz2
iced-8cadd3b99485c344feb18b774c8e6fd6c1ea9dd7.zip
Merge pull request #2504 from iced-rs/view-ergonomics
Improved `view` ergonomics
Diffstat (limited to 'examples/styling')
-rw-r--r--examples/styling/src/main.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs
index 3124493b..527aaa29 100644
--- a/examples/styling/src/main.rs
+++ b/examples/styling/src/main.rs
@@ -3,7 +3,7 @@ use iced::widget::{
row, scrollable, slider, text, text_input, toggler, vertical_rule,
vertical_space,
};
-use iced::{Alignment, Element, Length, Theme};
+use iced::{Center, Element, Fill, Theme};
pub fn main() -> iced::Result {
iced::application("Styling - Iced", Styling::update, Styling::view)
@@ -48,7 +48,7 @@ impl Styling {
let choose_theme = column![
text("Theme:"),
pick_list(Theme::ALL, Some(&self.theme), Message::ThemeChanged)
- .width(Length::Fill),
+ .width(Fill),
]
.spacing(10);
@@ -71,7 +71,7 @@ impl Styling {
vertical_space().height(800),
"You did it!"
])
- .width(Length::Fill)
+ .width(Fill)
.height(100);
let checkbox = checkbox("Check me!", self.checkbox_value)
@@ -82,15 +82,12 @@ impl Styling {
self.toggler_value,
Message::TogglerToggled,
)
- .width(Length::Shrink)
.spacing(10);
let content = column![
choose_theme,
horizontal_rule(38),
- row![text_input, button]
- .spacing(10)
- .align_items(Alignment::Center),
+ row![text_input, button].spacing(10).align_y(Center),
slider,
progress_bar,
row![
@@ -100,7 +97,7 @@ impl Styling {
]
.spacing(10)
.height(100)
- .align_items(Alignment::Center),
+ .align_y(Center),
]
.spacing(20)
.padding(20)