fix(context_drawer): adjust fill portion when max_width < 392
This commit is contained in:
parent
95ebabf149
commit
7712ec0021
1 changed files with 23 additions and 15 deletions
|
|
@ -55,27 +55,35 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> {
|
||||||
..
|
..
|
||||||
} = crate::theme::spacing();
|
} = crate::theme::spacing();
|
||||||
|
|
||||||
let horizontal_padding = if max_width < 392.0 { space_s } else { space_l };
|
let (horizontal_padding, title_portion, side_portion) = if max_width < 392.0 {
|
||||||
|
(space_s, 1, 1)
|
||||||
let title =
|
|
||||||
title.map(|title| text::heading(title).width(Length::FillPortion(3)).center());
|
|
||||||
|
|
||||||
let close_width = if title.is_some() {
|
|
||||||
Length::FillPortion(1)
|
|
||||||
} else {
|
} else {
|
||||||
Length::Shrink
|
(space_l, 2, 1)
|
||||||
|
};
|
||||||
|
|
||||||
|
let title = title.map(|title| {
|
||||||
|
text::heading(title)
|
||||||
|
.width(Length::FillPortion(title_portion))
|
||||||
|
.center()
|
||||||
|
});
|
||||||
|
|
||||||
|
let (actions_width, close_width) = if title.is_some() {
|
||||||
|
(
|
||||||
|
Length::FillPortion(side_portion),
|
||||||
|
Length::FillPortion(side_portion),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
(Length::Fill, Length::Shrink)
|
||||||
};
|
};
|
||||||
|
|
||||||
let header_row = row::with_capacity(3)
|
let header_row = row::with_capacity(3)
|
||||||
.width(Length::Fixed(480.0))
|
.width(Length::Fixed(480.0))
|
||||||
.align_y(Alignment::Center)
|
.align_y(Alignment::Center)
|
||||||
.push(row::with_children(header_actions).spacing(space_xxs).width(
|
.push(
|
||||||
if title.is_some() {
|
row::with_children(header_actions)
|
||||||
Length::FillPortion(1)
|
.spacing(space_xxs)
|
||||||
} else {
|
.width(actions_width),
|
||||||
Length::Fill
|
)
|
||||||
},
|
|
||||||
))
|
|
||||||
.push_maybe(title)
|
.push_maybe(title)
|
||||||
.push(
|
.push(
|
||||||
button::text("Close")
|
button::text("Close")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue