Introduce Widget::size_hint and fix further layout inconsistencies
This commit is contained in:
parent
0322e820eb
commit
22226394f7
17 changed files with 210 additions and 123 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue