fix(toggler): remove extra padding

This commit is contained in:
Vukašin Vojinović 2024-11-28 00:23:03 +01:00 committed by Michael Murphy
parent a6db807c1b
commit a6c08d68f9
2 changed files with 25 additions and 1 deletions

View file

@ -882,7 +882,30 @@ impl<App: Application> ApplicationExt for App {
header = header.end(element.map(Message::App));
}
header.apply(|w| id_container(w, iced_core::id::Id::new("COSMIC_header")))
if content_container {
header.apply(|w| id_container(w, iced_core::id::Id::new("COSMIC_header")))
} else {
// Needed to avoid header bar corner gaps for apps without a content container
header
.apply(container)
.style(move |theme| container::Style {
background: Some(iced::Background::Color(
theme.cosmic().background.base.into(),
)),
border: iced::Border {
radius: [
theme.cosmic().radius_s()[0] - 1.0,
theme.cosmic().radius_s()[1] - 1.0,
theme.cosmic().radius_0()[2],
theme.cosmic().radius_0()[3],
]
.into(),
..Default::default()
},
..Default::default()
})
.apply(|w| id_container(w, iced_core::id::Id::new("COSMIC_header")))
}
})
} else {
None

View file

@ -12,5 +12,6 @@ where
{
widget::Toggler::new(is_checked)
.size(24)
.spacing(0)
.width(Length::Shrink)
}