diff options
author | 2020-02-06 00:23:44 +0100 | |
---|---|---|
committer | 2020-02-06 00:23:44 +0100 | |
commit | 9a7f7bfdf5afa329a60beab6556d739cf5d19b50 (patch) | |
tree | 158efe08dbffaddb7c2b479ef84c291f2e1192c6 /web | |
parent | c2dad2942916ba30435a8e26ccca17f64c092b44 (diff) | |
download | iced-9a7f7bfdf5afa329a60beab6556d739cf5d19b50.tar.gz iced-9a7f7bfdf5afa329a60beab6556d739cf5d19b50.tar.bz2 iced-9a7f7bfdf5afa329a60beab6556d739cf5d19b50.zip |
Expose styling types for `scrollable` in `iced_web`
Diffstat (limited to 'web')
-rw-r--r-- | web/src/widget/scrollable.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/web/src/widget/scrollable.rs b/web/src/widget/scrollable.rs index 19810531..07b38aad 100644 --- a/web/src/widget/scrollable.rs +++ b/web/src/widget/scrollable.rs @@ -1,6 +1,8 @@ //! Navigate an endless amount of content with a scrollbar. use crate::{bumpalo, css, Align, Bus, Column, Css, Element, Length, Widget}; +pub use iced_style::scrollable::{Scrollbar, Scroller, StyleSheet}; + /// A widget that can vertically display an infinite amount of content with a /// scrollbar. #[allow(missing_debug_implementations)] @@ -9,6 +11,7 @@ pub struct Scrollable<'a, Message> { height: Length, max_height: u32, content: Column<'a, Message>, + style: Box<dyn StyleSheet>, } impl<'a, Message> Scrollable<'a, Message> { @@ -24,6 +27,7 @@ impl<'a, Message> Scrollable<'a, Message> { height: Length::Shrink, max_height: u32::MAX, content: Column::new(), + style: Default::default(), } } @@ -85,6 +89,14 @@ impl<'a, Message> Scrollable<'a, Message> { self } + /// Sets the style of the [`Scrollable`] . + /// + /// [`Scrollable`]: struct.Scrollable.html + pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self { + self.style = style.into(); + self + } + /// Adds an element to the [`Scrollable`]. /// /// [`Scrollable`]: struct.Scrollable.html @@ -112,6 +124,8 @@ where let width = css::length(self.width); let height = css::length(self.height); + // TODO: Scrollbar styling + let node = div(bump) .attr( "style", @@ -126,8 +140,6 @@ where ) .children(vec![self.content.node(bump, bus, style_sheet)]); - // TODO: Complete styling - node.finish() } } |