Reintroduce Box for style_sheet in Radio

This commit is contained in:
Héctor Ramón Jiménez 2021-10-31 17:14:10 +07:00
parent d758006ee9
commit bd7b086ec1
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
6 changed files with 29 additions and 14 deletions

View file

@ -76,7 +76,7 @@ impl Sandbox for ScrollableDemo {
Some(*theme),
Message::ThemeChanged,
)
.style(theme.clone().into()),
.style(*theme),
)
},
);

View file

@ -25,11 +25,11 @@ impl<'a> From<Theme> for Box<dyn container::StyleSheet + 'a> {
}
}
impl From<Theme> for &'static dyn radio::StyleSheet {
impl<'a> From<Theme> for Box<dyn radio::StyleSheet + 'a> {
fn from(theme: Theme) -> Self {
match theme {
Theme::Light => Default::default(),
Theme::Dark => &dark::Radio,
Theme::Dark => dark::Radio.into(),
}
}
}