fix: use spacing of 2 when header density is compact

This commit is contained in:
Michael Aaron Murphy 2024-05-30 22:00:48 +02:00
parent 1ef1400d8b
commit af58d81c6f
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -269,7 +269,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
end.push(widget::horizontal_space(Length::Fixed(12.0)).into()); end.push(widget::horizontal_space(Length::Fixed(12.0)).into());
end.push(self.window_controls()); end.push(self.window_controls());
let (height, padding) = match self.density.unwrap_or_else(|| crate::config::header_size()) { let (height, padding) = match self.density.unwrap_or_else(crate::config::header_size) {
crate::config::Density::Compact => (36.0, 2.0), crate::config::Density::Compact => (36.0, 2.0),
crate::config::Density::Standard => (48.0, 8.0), crate::config::Density::Standard => (48.0, 8.0),
}; };
@ -358,6 +358,13 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
.on_press(on_press) .on_press(on_press)
}; };
let density = self.density.unwrap_or_else(crate::config::header_size);
let spacing = if matches!(density, Density::Compact) {
2
} else {
8
};
widget::row::with_capacity(3) widget::row::with_capacity(3)
.push_maybe(self.on_minimize.take().map(|m| { .push_maybe(self.on_minimize.take().map(|m| {
icon( icon(
@ -380,7 +387,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
m, m,
) )
})) }))
.spacing(8) .spacing(spacing)
.apply(widget::container) .apply(widget::container)
.height(Length::Fill) .height(Length::Fill)
.center_y() .center_y()