Instantiate Column and Row with children

This commit is contained in:
Rowun Giles 2020-03-16 10:08:37 +00:00
parent e1438774af
commit ae123d8f14
4 changed files with 64 additions and 0 deletions

View File

@ -42,6 +42,22 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
} }
} }
/// Creates a [`Column`] with children.
///
/// [`Column`]: struct.Column.html
pub fn new_with_children(children: Vec<Element<'a, Message, Renderer>>) -> Self {
Column {
spacing: 0,
padding: 0,
width: Length::Shrink,
height: Length::Shrink,
max_width: u32::MAX,
max_height: u32::MAX,
align_items: Align::Start,
children,
}
}
/// Sets the vertical spacing _between_ elements. /// Sets the vertical spacing _between_ elements.
/// ///
/// Custom margins per element do not exist in Iced. You should use this /// Custom margins per element do not exist in Iced. You should use this

View File

@ -42,6 +42,22 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
} }
} }
/// Creates a [`Row`] with children.
///
/// [`Row`]: struct.Row.html
pub fn new_with_children(children: Vec<Element<'a, Message, Renderer>>) -> Self {
Row {
spacing: 0,
padding: 0,
width: Length::Shrink,
height: Length::Shrink,
max_width: u32::MAX,
max_height: u32::MAX,
align_items: Align::Start,
children,
}
}
/// Sets the horizontal spacing _between_ elements. /// Sets the horizontal spacing _between_ elements.
/// ///
/// Custom margins per element do not exist in Iced. You should use this /// Custom margins per element do not exist in Iced. You should use this

View File

@ -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. /// Sets the vertical spacing _between_ elements.
/// ///
/// Custom margins per element do not exist in Iced. You should use this /// Custom margins per element do not exist in Iced. You should use this

View File

@ -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. /// Sets the horizontal spacing _between_ elements.
/// ///
/// Custom margins per element do not exist in Iced. You should use this /// Custom margins per element do not exist in Iced. You should use this