Skip to content

Commit

Permalink
fix(headerbar): center-align center region of header bar
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Oct 24, 2023
1 parent a2bda49 commit 390de9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/widget/header_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
.align_items(iced::Alignment::Center)
.apply(widget::container)
.align_x(iced::alignment::Horizontal::Left)
.width(Length::Fill)
}))
// If elements exist in the center region, use them here.
// This will otherwise use the title as a widget if a title was defined.
Expand All @@ -114,6 +115,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
.align_items(iced::Alignment::Center)
.apply(widget::container)
.align_x(iced::alignment::Horizontal::Center)
.width(Length::Fill)
.into()
} else if self.title.is_empty() {
widget::horizontal_space(Length::Fill).into()
Expand All @@ -124,7 +126,8 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
widget::row::with_children(end)
.align_items(iced::Alignment::Center)
.apply(widget::container)
.align_x(iced::alignment::Horizontal::Right),
.align_x(iced::alignment::Horizontal::Right)
.width(Length::Fill),
)
.height(Length::Fixed(50.0))
.padding(8)
Expand Down

0 comments on commit 390de9a

Please sign in to comment.