diff options
author | 2020-03-16 10:08:37 +0000 | |
---|---|---|
committer | 2020-03-16 10:08:37 +0000 | |
commit | ae123d8f14c14a2c393bcf00dc364844a32cc0c8 (patch) | |
tree | 3d39a3da39addd7d67a826ccef1a97ca6312947d /web | |
parent | e1438774af809c2951c4c7446638500446c81111 (diff) | |
download | iced-ae123d8f14c14a2c393bcf00dc364844a32cc0c8.tar.gz iced-ae123d8f14c14a2c393bcf00dc364844a32cc0c8.tar.bz2 iced-ae123d8f14c14a2c393bcf00dc364844a32cc0c8.zip |
Instantiate Column and Row with children
Diffstat (limited to 'web')
-rw-r--r-- | web/src/widget/column.rs | 16 | ||||
-rw-r--r-- | web/src/widget/row.rs | 16 |
2 files changed, 32 insertions, 0 deletions
diff --git a/web/src/widget/column.rs b/web/src/widget/column.rs index 6454ffba..f1d9f9a2 100644 --- a/web/src/widget/column.rs +++ b/web/src/widget/column.rs @@ -37,6 +37,22 @@ impl<'a, Message> Column<'a, Message> { } } + /// Creates a [`Column`] with children. + /// + /// [`Column`]: struct.Column.html + pub fn new_with_children(children: Vec<Element<'a, Message>>) -> Self { + Column { + spacing: 0, + padding: 0, + width: Length::Fill, + height: Length::Shrink, + max_width: u32::MAX, + max_height: u32::MAX, + align_items: Align::Start, + children, + } + } + /// Sets the vertical spacing _between_ elements. /// /// Custom margins per element do not exist in Iced. You should use this diff --git a/web/src/widget/row.rs b/web/src/widget/row.rs index 02035113..55077d52 100644 --- a/web/src/widget/row.rs +++ b/web/src/widget/row.rs @@ -37,6 +37,22 @@ impl<'a, Message> Row<'a, Message> { } } + /// Creates a [`Row`] with children. + /// + /// [`Row`]: struct.Row.html + pub fn new_with_children(children: Vec<Element<'a, Message>>) -> Self { + Row { + spacing: 0, + padding: 0, + width: Length::Fill, + height: Length::Shrink, + max_width: u32::MAX, + max_height: u32::MAX, + align_items: Align::Start, + children, + } + } + /// Sets the horizontal spacing _between_ elements. /// /// Custom margins per element do not exist in Iced. You should use this |