Make Shrink have priority over Fill in layout

This commit is contained in:
Héctor Ramón Jiménez 2023-03-16 20:23:25 +01:00 committed by Héctor Ramón Jiménez
parent 68c0484b5c
commit 0655a20ad1
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
46 changed files with 264 additions and 273 deletions

View file

@ -106,9 +106,7 @@ impl Application for App {
fn view<'a>(&'a self) -> Element<'a, Message> {
let subtitle = |title, content: Element<'a, Message>| {
column![text(title).size(14), content]
.width(Length::Fill)
.spacing(5)
column![text(title).size(14), content].spacing(5)
};
let mut add_toast = button("Add Toast");
@ -153,14 +151,11 @@ impl Application for App {
Message::Timeout
)
.step(1.0)
.width(Length::Fill)
]
.spacing(5)
.into()
),
column![add_toast]
.width(Length::Fill)
.align_items(Alignment::End)
column![add_toast].align_items(Alignment::End)
]
.spacing(10)
.max_width(200),
@ -513,14 +508,14 @@ mod toast {
position: Point,
_translation: Vector,
) -> layout::Node {
let limits = layout::Limits::new(Size::ZERO, bounds)
.width(Length::Fill)
.height(Length::Fill);
let limits = layout::Limits::new(Size::ZERO, bounds);
layout::flex::resolve(
layout::flex::Axis::Vertical,
renderer,
&limits,
Length::Fill,
Length::Fill,
10.into(),
10.0,
Alignment::End,