Introduce Widget::size_hint and fix further layout inconsistencies

This commit is contained in:
Héctor Ramón Jiménez 2024-01-05 17:24:43 +01:00
parent 0322e820eb
commit 22226394f7
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
17 changed files with 210 additions and 123 deletions

View file

@ -178,35 +178,23 @@ impl Sandbox for App {
}
});
column(
items
.into_iter()
.map(|item| {
let button = button("Delete")
.on_press(Message::DeleteItem(item.clone()))
.style(theme::Button::Destructive);
column(items.into_iter().map(|item| {
let button = button("Delete")
.on_press(Message::DeleteItem(item.clone()))
.style(theme::Button::Destructive);
row![
text(&item.name)
.style(theme::Text::Color(item.color.into())),
horizontal_space(Length::Fill),
pick_list(
Color::ALL,
Some(item.color),
move |color| {
Message::ItemColorChanged(
item.clone(),
color,
)
}
),
button
]
.spacing(20)
.into()
})
.collect(),
)
row![
text(&item.name)
.style(theme::Text::Color(item.color.into())),
horizontal_space(Length::Fill),
pick_list(Color::ALL, Some(item.color), move |color| {
Message::ItemColorChanged(item.clone(), color)
}),
button
]
.spacing(20)
.into()
}))
.spacing(10)
});