Reintroduce Box for style_sheet in Scrollable
This commit is contained in:
parent
48490c3d87
commit
eed19dcf81
6 changed files with 29 additions and 17 deletions
|
|
@ -95,7 +95,7 @@ impl Sandbox for ScrollableDemo {
|
|||
.on_scroll(move |offset| {
|
||||
Message::Scrolled(i, offset)
|
||||
})
|
||||
.style(theme.clone().into())
|
||||
.style(*theme)
|
||||
.push(Text::new(variant.title))
|
||||
.push(
|
||||
Button::new(
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ impl<'a> From<Theme> for Box<dyn radio::StyleSheet + 'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Theme> for &'static dyn scrollable::StyleSheet {
|
||||
impl<'a> From<Theme> for Box<dyn scrollable::StyleSheet + 'a> {
|
||||
fn from(theme: Theme) -> Self {
|
||||
match theme {
|
||||
Theme::Light => Default::default(),
|
||||
Theme::Dark => &dark::Scrollable,
|
||||
Theme::Dark => dark::Scrollable.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ impl Sandbox for Styling {
|
|||
let scrollable = Scrollable::new(&mut self.scroll)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Units(100))
|
||||
.style(self.theme.into())
|
||||
.style(self.theme)
|
||||
.push(Text::new("Scroll me!"))
|
||||
.push(Space::with_height(Length::Units(800)))
|
||||
.push(Text::new("You did it!"));
|
||||
|
|
@ -212,11 +212,11 @@ mod style {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<Theme> for &'static dyn scrollable::StyleSheet {
|
||||
impl<'a> From<Theme> for Box<dyn scrollable::StyleSheet + 'a> {
|
||||
fn from(theme: Theme) -> Self {
|
||||
match theme {
|
||||
Theme::Light => Default::default(),
|
||||
Theme::Dark => &dark::Scrollable,
|
||||
Theme::Dark => dark::Scrollable.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue