Add extend method to Column and Row
This commit is contained in:
parent
121d220532
commit
9f0bbf6020
2 changed files with 18 additions and 2 deletions
|
|
@ -46,7 +46,7 @@ where
|
|||
pub fn with_children(
|
||||
children: impl IntoIterator<Item = Element<'a, Message, Theme, Renderer>>,
|
||||
) -> Self {
|
||||
children.into_iter().fold(Self::new(), Self::push)
|
||||
Self::new().extend(children)
|
||||
}
|
||||
|
||||
/// Sets the vertical spacing _between_ elements.
|
||||
|
|
@ -127,6 +127,14 @@ where
|
|||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// Extends the [`Column`] with the given children.
|
||||
pub fn extend(
|
||||
self,
|
||||
children: impl IntoIterator<Item = Element<'a, Message, Theme, Renderer>>,
|
||||
) -> Self {
|
||||
children.into_iter().fold(self, Self::push)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Message, Renderer> Default for Column<'a, Message, Renderer>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ where
|
|||
pub fn with_children(
|
||||
children: impl IntoIterator<Item = Element<'a, Message, Theme, Renderer>>,
|
||||
) -> Self {
|
||||
children.into_iter().fold(Self::new(), Self::push)
|
||||
Self::new().extend(children)
|
||||
}
|
||||
|
||||
/// Sets the horizontal spacing _between_ elements.
|
||||
|
|
@ -118,6 +118,14 @@ where
|
|||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// Extends the [`Row`] with the given children.
|
||||
pub fn extend(
|
||||
self,
|
||||
children: impl IntoIterator<Item = Element<'a, Message, Theme, Renderer>>,
|
||||
) -> Self {
|
||||
children.into_iter().fold(self, Self::push)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, Message, Renderer> Default for Row<'a, Message, Renderer>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue