Reintroduce Box for style_sheet in TextInput

This commit is contained in:
Héctor Ramón Jiménez 2021-10-31 17:45:57 +07:00
parent 0c76e0307f
commit 0d3c9ef7bd
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
4 changed files with 25 additions and 10 deletions

View file

@ -77,7 +77,7 @@ impl Sandbox for Styling {
)
.padding(10)
.size(20)
.style(self.theme.into());
.style(self.theme);
let button = Button::new(&mut self.button, Text::new("Submit"))
.padding(10)
@ -194,11 +194,11 @@ mod style {
}
}
impl From<Theme> for &'static dyn text_input::StyleSheet {
impl<'a> From<Theme> for Box<dyn text_input::StyleSheet + 'a> {
fn from(theme: Theme) -> Self {
match theme {
Theme::Light => Default::default(),
Theme::Dark => &dark::TextInput,
Theme::Dark => dark::TextInput.into(),
}
}
}