Wire up styling to Slider in iced_native

This commit is contained in:
Héctor Ramón Jiménez 2021-10-20 15:50:42 +07:00
parent e00a2e9b2d
commit 11bcb13427
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
9 changed files with 31 additions and 97 deletions

View file

@ -41,7 +41,7 @@ pub struct Slider<'a, T, Message> {
#[allow(dead_code)]
width: Length,
#[allow(dead_code)]
style: Box<dyn StyleSheet>,
style_sheet: &'a dyn StyleSheet,
}
impl<'a, T, Message> Slider<'a, T, Message>
@ -85,7 +85,7 @@ where
step: T::from(1),
on_change: Rc::new(Box::new(on_change)),
width: Length::Fill,
style: Default::default(),
style_sheet: Default::default(),
}
}
@ -96,8 +96,8 @@ where
}
/// Sets the style of the [`Slider`].
pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self {
self.style = style.into();
pub fn style(mut self, style_sheet: &'a dyn StyleSheet) -> Self {
self.style_sheet = style_sheet.into();
self
}