summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-31 17:39:24 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-31 17:39:24 +0700
commiteed19dcf81334d0849744f1918ba880d5a7acc1c (patch)
tree56be76de94193b083692a5910d5a4d93e024e5b2 /examples
parent48490c3d878da1e2760c7701e80586c3653d5bd8 (diff)
downloadiced-eed19dcf81334d0849744f1918ba880d5a7acc1c.tar.gz
iced-eed19dcf81334d0849744f1918ba880d5a7acc1c.tar.bz2
iced-eed19dcf81334d0849744f1918ba880d5a7acc1c.zip
Reintroduce `Box` for `style_sheet` in `Scrollable`
Diffstat (limited to 'examples')
-rw-r--r--examples/scrollable/src/main.rs2
-rw-r--r--examples/scrollable/src/style.rs4
-rw-r--r--examples/styling/src/main.rs6
3 files changed, 6 insertions, 6 deletions
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs
index 272f0ce2..3416b83d 100644
--- a/examples/scrollable/src/main.rs
+++ b/examples/scrollable/src/main.rs
@@ -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(
diff --git a/examples/scrollable/src/style.rs b/examples/scrollable/src/style.rs
index 3c8e5234..ec1f13db 100644
--- a/examples/scrollable/src/style.rs
+++ b/examples/scrollable/src/style.rs
@@ -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(),
}
}
}
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs
index 73f965d9..a0ba2607 100644
--- a/examples/styling/src/main.rs
+++ b/examples/styling/src/main.rs
@@ -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(),
}
}
}