summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-18 14:48:33 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-18 14:48:33 +0700
commit54a9a232f8110364972a8eef966b7b7477573f4f (patch)
treea6abebbcfefbd53d4c4d006d6911353801ea3284 /examples
parenta4f4d831615899046d36c96e6a580d5386aa25bf (diff)
downloadiced-54a9a232f8110364972a8eef966b7b7477573f4f.tar.gz
iced-54a9a232f8110364972a8eef966b7b7477573f4f.tar.bz2
iced-54a9a232f8110364972a8eef966b7b7477573f4f.zip
Draw scrollbar in `Widget::draw` for `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 3416b83d..272f0ce2 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)
+ .style(theme.clone().into())
.push(Text::new(variant.title))
.push(
Button::new(
diff --git a/examples/scrollable/src/style.rs b/examples/scrollable/src/style.rs
index ae449141..d955f52d 100644
--- a/examples/scrollable/src/style.rs
+++ b/examples/scrollable/src/style.rs
@@ -34,11 +34,11 @@ impl From<Theme> for Box<dyn radio::StyleSheet> {
}
}
-impl From<Theme> for Box<dyn scrollable::StyleSheet> {
+impl From<Theme> for &'static dyn scrollable::StyleSheet {
fn from(theme: Theme) -> Self {
match theme {
Theme::Light => Default::default(),
- Theme::Dark => dark::Scrollable.into(),
+ Theme::Dark => &dark::Scrollable,
}
}
}
diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs
index 81d33ad3..1746d7b4 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)
+ .style(self.theme.into())
.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 Box<dyn scrollable::StyleSheet> {
+ impl From<Theme> for &'static dyn scrollable::StyleSheet {
fn from(theme: Theme) -> Self {
match theme {
Theme::Light => Default::default(),
- Theme::Dark => dark::Scrollable.into(),
+ Theme::Dark => &dark::Scrollable,
}
}
}