fix(applet): set the svg style to default if the icon is not symbolic

This commit is contained in:
Ashley Wulber 2024-05-06 18:49:32 -04:00 committed by Ashley Wulber
parent fec71fdda4
commit 23f6fc8358

View file

@ -151,15 +151,18 @@ impl Context {
&self,
icon: widget::icon::Handle,
) -> crate::widget::Button<'a, Message, crate::Theme, Renderer> {
let suggested = self.suggested_size(icon.symbolic);
let applet_padding = self.suggested_padding(icon.symbolic);
let symbolic = icon.symbolic;
let suggested = self.suggested_size(symbolic);
let applet_padding = self.suggested_padding(symbolic);
crate::widget::button(
widget::icon(icon)
.style(theme::Svg::Custom(Rc::new(|theme| {
crate::iced_style::svg::Appearance {
.style(if symbolic {
theme::Svg::Custom(Rc::new(|theme| crate::iced_style::svg::Appearance {
color: Some(theme.cosmic().background.on.into()),
}
})))
}))
} else {
theme::Svg::default()
})
.width(Length::Fixed(suggested.0 as f32))
.height(Length::Fixed(suggested.1 as f32)),
)