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

@ -46,11 +46,22 @@ where
where
T: Into<Element<'a, Message, Renderer>>,
{
let content = content.into();
let size = content.as_widget().size_hint();
Container {
id: None,
padding: Padding::ZERO,
width: Length::Shrink,
height: Length::Shrink,
width: if size.width.is_fill() {
Length::Fill
} else {
Length::Shrink
},
height: if size.height.is_fill() {
Length::Fill
} else {
Length::Shrink
},
max_width: f32::INFINITY,
max_height: f32::INFINITY,
horizontal_alignment: alignment::Horizontal::Left,