Merge pull request #220 from rowungiles/master
Instantiate Column and Row with children
This commit is contained in:
commit
9da6ce474c
@ -30,6 +30,15 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
|
|||||||
///
|
///
|
||||||
/// [`Column`]: struct.Column.html
|
/// [`Column`]: struct.Column.html
|
||||||
pub fn new() -> Self {
|
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 {
|
Column {
|
||||||
spacing: 0,
|
spacing: 0,
|
||||||
padding: 0,
|
padding: 0,
|
||||||
@ -38,7 +47,7 @@ impl<'a, Message, Renderer> Column<'a, Message, Renderer> {
|
|||||||
max_width: u32::MAX,
|
max_width: u32::MAX,
|
||||||
max_height: u32::MAX,
|
max_height: u32::MAX,
|
||||||
align_items: Align::Start,
|
align_items: Align::Start,
|
||||||
children: Vec::new(),
|
children,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,15 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
|
|||||||
///
|
///
|
||||||
/// [`Row`]: struct.Row.html
|
/// [`Row`]: struct.Row.html
|
||||||
pub fn new() -> Self {
|
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 {
|
Row {
|
||||||
spacing: 0,
|
spacing: 0,
|
||||||
padding: 0,
|
padding: 0,
|
||||||
@ -38,7 +47,7 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
|
|||||||
max_width: u32::MAX,
|
max_width: u32::MAX,
|
||||||
max_height: u32::MAX,
|
max_height: u32::MAX,
|
||||||
align_items: Align::Start,
|
align_items: Align::Start,
|
||||||
children: Vec::new(),
|
children,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,13 @@ impl<'a, Message> Column<'a, Message> {
|
|||||||
///
|
///
|
||||||
/// [`Column`]: struct.Column.html
|
/// [`Column`]: struct.Column.html
|
||||||
pub fn new() -> Self {
|
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 {
|
Column {
|
||||||
spacing: 0,
|
spacing: 0,
|
||||||
padding: 0,
|
padding: 0,
|
||||||
@ -33,7 +40,7 @@ impl<'a, Message> Column<'a, Message> {
|
|||||||
max_width: u32::MAX,
|
max_width: u32::MAX,
|
||||||
max_height: u32::MAX,
|
max_height: u32::MAX,
|
||||||
align_items: Align::Start,
|
align_items: Align::Start,
|
||||||
children: Vec::new(),
|
children,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,13 @@ impl<'a, Message> Row<'a, Message> {
|
|||||||
///
|
///
|
||||||
/// [`Row`]: struct.Row.html
|
/// [`Row`]: struct.Row.html
|
||||||
pub fn new() -> Self {
|
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 {
|
Row {
|
||||||
spacing: 0,
|
spacing: 0,
|
||||||
padding: 0,
|
padding: 0,
|
||||||
@ -33,7 +40,7 @@ impl<'a, Message> Row<'a, Message> {
|
|||||||
max_width: u32::MAX,
|
max_width: u32::MAX,
|
||||||
max_height: u32::MAX,
|
max_height: u32::MAX,
|
||||||
align_items: Align::Start,
|
align_items: Align::Start,
|
||||||
children: Vec::new(),
|
children,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user