refactor: make Theme a generic parameter for the button

This makes the button possible to use with custom themes in cosmic-time
This commit is contained in:
Ashley Wulber 2024-02-02 20:28:05 -05:00 committed by Ashley Wulber
parent 11ac07010b
commit 82dfab633a
5 changed files with 84 additions and 71 deletions

View file

@ -122,7 +122,7 @@ impl ColorPickerModel {
&self,
f: T,
icon_portion: Option<u16>,
) -> crate::widget::Button<'a, Message, crate::Renderer> {
) -> crate::widget::Button<'a, Message, crate::Theme, crate::Renderer> {
color_button(
Some(f(ColorPickerUpdate::ToggleColorPicker)),
self.applied_color,
@ -755,7 +755,7 @@ pub fn color_button<'a, Message: 'static>(
on_press: Option<Message>,
color: Option<Color>,
icon_portion: Length,
) -> crate::widget::Button<'a, Message, crate::Renderer> {
) -> crate::widget::Button<'a, Message, crate::Theme, crate::Renderer> {
let spacing = THEME.with(|t| t.borrow().cosmic().spacing);
button(if color.is_some() {