diff options
author | 2020-03-17 01:04:46 +0100 | |
---|---|---|
committer | 2020-03-17 01:04:46 +0100 | |
commit | 9da6ce474c2cd178ca5365d46760ba0882ce7121 (patch) | |
tree | 16b1b48e2aa04efa8dacfcde88ee40f2e5a16ad7 | |
parent | e1438774af809c2951c4c7446638500446c81111 (diff) | |
parent | 99b5212550f225a21e1d1144c6fb9ebb8f4e6ed2 (diff) | |
download | iced-9da6ce474c2cd178ca5365d46760ba0882ce7121.tar.gz iced-9da6ce474c2cd178ca5365d46760ba0882ce7121.tar.bz2 iced-9da6ce474c2cd178ca5365d46760ba0882ce7121.zip |
Merge pull request #220 from rowungiles/master
Instantiate Column and Row with children
Diffstat (limited to '')
-rw-r--r-- | native/src/widget/column.rs | 11 | ||||
-rw-r--r-- | native/src/widget/row.rs | 11 | ||||
-rw-r--r-- | web/src/widget/column.rs | 9 | ||||
-rw-r--r-- | web/src/widget/row.rs | 9 |
4 files changed, 36 insertions, 4 deletions
diff --git a/native/src/widget/column.rs b/native/src/widget/column.rs index 104790d4..a7a6f242 100644 --- a/native/src/widget/column.rs +++ b/native/src/widget/column.rs @@ -30,6 +30,15 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> { /// /// [`Column`]: struct.Column.html pub fn new() -> Self { + Self::with_children(Vec::new()) + } + + /// Creates a [`Column`] with the given elements. + /// + /// [`Column`]: struct.Column.html + pub fn with_children( + children: Vec<Element<'a, Message, Renderer>>, + ) -> Self { Column { spacing: 0, padding: 0, @@ -38,7 +47,7 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> { max_width: u32::MAX, max_height: u32::MAX, align_items: Align::Start, - children: Vec::new(), + children, } } diff --git a/native/src/widget/row.rs b/native/src/widget/row.rs index 775b953e..c8812ea2 100644 --- a/native/src/widget/row.rs +++ b/native/src/widget/row.rs @@ -30,6 +30,15 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> { /// /// [`Row`]: struct.Row.html pub fn new() -> Self { + Self::with_children(Vec::new()) + } + + /// Creates a [`Row`] with the given elements. + /// + /// [`Row`]: struct.Row.html + pub fn with_children( + children: Vec<Element<'a, Message, Renderer>>, + ) -> Self { Row { spacing: 0, padding: 0, @@ -38,7 +47,7 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> { max_width: u32::MAX, max_height: u32::MAX, align_items: Align::Start, - children: Vec::new(), + children, } } diff --git a/web/src/widget/column.rs b/web/src/widget/column.rs index 6454ffba..25b88b0e 100644 --- a/web/src/widget/column.rs +++ b/web/src/widget/column.rs @@ -25,6 +25,13 @@ impl<'a, Message> Column<'a, Message> { /// /// [`Column`]: struct.Column.html pub fn new() -> Self { + Self::with_children(Vec::new()) + } + + /// Creates a [`Column`] with the given elements. + /// + /// [`Column`]: struct.Column.html + pub fn with_children(children: Vec<Element<'a, Message>>) -> Self { Column { spacing: 0, padding: 0, @@ -33,7 +40,7 @@ impl<'a, Message> Column<'a, Message> { max_width: u32::MAX, max_height: u32::MAX, align_items: Align::Start, - children: Vec::new(), + children, } } diff --git a/web/src/widget/row.rs b/web/src/widget/row.rs index 02035113..cfa10fdf 100644 --- a/web/src/widget/row.rs +++ b/web/src/widget/row.rs @@ -25,6 +25,13 @@ impl<'a, Message> Row<'a, Message> { /// /// [`Row`]: struct.Row.html pub fn new() -> Self { + Self::with_children(Vec::new()) + } + + /// Creates a [`Row`] with the given elements. + /// + /// [`Row`]: struct.Row.html + pub fn with_children(children: Vec<Element<'a, Message>>) -> Self { Row { spacing: 0, padding: 0, @@ -33,7 +40,7 @@ impl<'a, Message> Row<'a, Message> { max_width: u32::MAX, max_height: u32::MAX, align_items: Align::Start, - children: Vec::new(), + children, } } |