diff options
author | 2020-02-06 00:36:00 +0100 | |
---|---|---|
committer | 2020-02-06 00:36:00 +0100 | |
commit | 58a7be0a31793400e5686f8e2af558f2307bebcd (patch) | |
tree | ab8d32f5fc29f05578a8a3205a5eaa85f53d9497 /web | |
parent | b4a8471aa187de511301605a56cf531923dfb6bd (diff) | |
download | iced-58a7be0a31793400e5686f8e2af558f2307bebcd.tar.gz iced-58a7be0a31793400e5686f8e2af558f2307bebcd.tar.bz2 iced-58a7be0a31793400e5686f8e2af558f2307bebcd.zip |
Expose styling types for `container` in `iced_web`
Diffstat (limited to 'web')
-rw-r--r-- | web/src/widget/container.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/web/src/widget/container.rs b/web/src/widget/container.rs index 43d9abf7..767fed67 100644 --- a/web/src/widget/container.rs +++ b/web/src/widget/container.rs @@ -1,6 +1,8 @@ //! Decorate content and apply alignment. use crate::{bumpalo, css, Align, Bus, Css, Element, Length, Widget}; +pub use iced_style::container::{Style, StyleSheet}; + /// An element decorating some content. /// /// It is normally used for alignment purposes. @@ -12,6 +14,7 @@ pub struct Container<'a, Message> { max_height: u32, horizontal_alignment: Align, vertical_alignment: Align, + style: Box<dyn StyleSheet>, content: Element<'a, Message>, } @@ -32,6 +35,7 @@ impl<'a, Message> Container<'a, Message> { max_height: u32::MAX, horizontal_alignment: Align::Start, vertical_alignment: Align::Start, + style: Default::default(), content: content.into(), } } @@ -85,6 +89,14 @@ impl<'a, Message> Container<'a, Message> { self } + + /// Sets the style of the [`Container`]. + /// + /// [`Container`]: struct.Container.html + pub fn style(mut self, style: impl Into<Box<dyn StyleSheet>>) -> Self { + self.style = style.into(); + self + } } impl<'a, Message> Widget<Message> for Container<'a, Message> |