Reintroduce Box for style_sheet in Checkbox

This commit is contained in:
Héctor Ramón Jiménez 2021-10-31 16:58:02 +07:00
parent d36ce33a95
commit fcc282bd76
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
4 changed files with 26 additions and 11 deletions

View file

@ -108,7 +108,7 @@ impl Sandbox for Styling {
"Check me!",
Message::CheckboxToggled,
)
.style(self.theme.into());
.style(self.theme);
let toggler = Toggler::new(
self.toggler_value,
@ -239,11 +239,11 @@ mod style {
}
}
impl From<Theme> for &'static dyn checkbox::StyleSheet {
impl<'a> From<Theme> for Box<dyn checkbox::StyleSheet + 'a> {
fn from(theme: Theme) -> Self {
match theme {
Theme::Light => Default::default(),
Theme::Dark => &dark::Checkbox,
Theme::Dark => dark::Checkbox.into(),
}
}
}