summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-06 00:20:55 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-06 00:20:55 +0100
commitc2dad2942916ba30435a8e26ccca17f64c092b44 (patch)
treee33f359ad759f4b2001a0410b17b2a0048869a9c /web
parentad13b466d234f04784bf77be0b4cb82acdfa1ea2 (diff)
downloadiced-c2dad2942916ba30435a8e26ccca17f64c092b44.tar.gz
iced-c2dad2942916ba30435a8e26ccca17f64c092b44.tar.bz2
iced-c2dad2942916ba30435a8e26ccca17f64c092b44.zip
Expose styling types for `slider` in `iced_web`
Diffstat (limited to 'web')
-rw-r--r--web/src/widget/slider.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/web/src/widget/slider.rs b/web/src/widget/slider.rs
index 843003e6..5aa6439e 100644
--- a/web/src/widget/slider.rs
+++ b/web/src/widget/slider.rs
@@ -6,6 +6,8 @@
//! [`State`]: struct.State.html
use crate::{Bus, Css, Element, Length, Widget};
+pub use iced_style::slider::{Handle, HandleShape, Style, StyleSheet};
+
use dodrio::bumpalo;
use std::{ops::RangeInclusive, rc::Rc};
@@ -38,6 +40,7 @@ pub struct Slider<'a, Message> {
value: f32,
on_change: Rc<Box<dyn Fn(f32) -> Message>>,
width: Length,
+ style: Box<dyn StyleSheet>,
}
impl<'a, Message> Slider<'a, Message> {
@@ -68,6 +71,7 @@ impl<'a, Message> Slider<'a, Message> {
range,
on_change: Rc::new(Box::new(on_change)),
width: Length::Fill,
+ style: Default::default(),
}
}
@@ -78,6 +82,14 @@ impl<'a, Message> Slider<'a, Message> {
self.width = width;
self
}
+
+ /// Sets the style of the [`Slider`].
+ ///
+ /// [`Slider`]: struct.Slider.html
+ pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self {
+ self.style = style.into();
+ self
+ }
}
impl<'a, Message> Widget<Message> for Slider<'a, Message>
@@ -103,7 +115,7 @@ where
let event_bus = bus.clone();
// TODO: Make `step` configurable
- // TODO: Complete styling
+ // TODO: Styling
input(bump)
.attr("type", "range")
.attr("step", "0.01")