fix(context_drawer): center header elements
This commit is contained in:
parent
2704a77aa3
commit
707f2115eb
4 changed files with 9 additions and 10 deletions
|
|
@ -809,7 +809,7 @@ impl<App: Application> ApplicationExt for App {
|
|||
};
|
||||
|
||||
let content_row = crate::widget::row::with_children({
|
||||
let mut widgets = Vec::with_capacity(4);
|
||||
let mut widgets = Vec::with_capacity(3);
|
||||
|
||||
// Insert nav bar onto the left side of the window.
|
||||
let has_nav = if let Some(nav) = self
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> {
|
|||
} = crate::theme::active().cosmic().spacing;
|
||||
|
||||
let header = row::with_capacity(3)
|
||||
.width(Length::Fixed(480.0))
|
||||
.align_y(Alignment::Center)
|
||||
.padding([space_m, space_l])
|
||||
.push(Space::new(Length::FillPortion(1), Length::Fixed(0.0)))
|
||||
.push(text::heading(header).width(Length::FillPortion(1)).center())
|
||||
|
|
@ -49,9 +51,7 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> {
|
|||
.apply(container)
|
||||
.width(Length::FillPortion(1))
|
||||
.align_x(Alignment::End),
|
||||
)
|
||||
// XXX must be done after pushing elements or it may be overwritten by size hints from contents
|
||||
.width(Length::Fixed(480.0));
|
||||
);
|
||||
|
||||
let pane = column::with_capacity(2).push(header).push(
|
||||
scrollable(container(drawer.into()).padding([0, space_l, space_l, space_l]))
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
|||
};
|
||||
|
||||
// Creates the headerbar widget.
|
||||
let mut widget = widget::row::with_capacity(4)
|
||||
let mut widget = widget::row::with_capacity(3)
|
||||
// If elements exist in the start region, append them here.
|
||||
.push(
|
||||
widget::row::with_children(start)
|
||||
|
|
@ -351,8 +351,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
|||
|
||||
widget::text::heading(title)
|
||||
.apply(widget::container)
|
||||
.center_x(Length::Fill)
|
||||
.center_y(Length::Fill)
|
||||
.center(Length::Fill)
|
||||
.into()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ impl<'a, Message: 'static> ListColumn<'a, Message> {
|
|||
}
|
||||
|
||||
// Ensure a minimum height of 32.
|
||||
let container = iced::widget::row![
|
||||
crate::widget::container(item).align_y(iced::Alignment::Center),
|
||||
let list_item = iced::widget::row![
|
||||
item.into(),
|
||||
crate::widget::vertical_space().height(iced::Length::Fixed(32.))
|
||||
]
|
||||
.align_y(iced::Alignment::Center);
|
||||
|
||||
self.children.push(container.into());
|
||||
self.children.push(list_item.into());
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue