improv(flex-row): add spacing method to set row and column spacing
This commit is contained in:
parent
4d8c906c56
commit
1bc3012165
1 changed files with 9 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ pub struct FlexRow<'a, Message> {
|
||||||
#[setters(skip)]
|
#[setters(skip)]
|
||||||
children: Vec<Element<'a, Message>>,
|
children: Vec<Element<'a, Message>>,
|
||||||
/// Sets the padding around the widget.
|
/// Sets the padding around the widget.
|
||||||
|
#[setters(into)]
|
||||||
padding: Padding,
|
padding: Padding,
|
||||||
/// Sets the space between each column of items.
|
/// Sets the space between each column of items.
|
||||||
column_spacing: u16,
|
column_spacing: u16,
|
||||||
|
|
@ -29,7 +30,7 @@ pub struct FlexRow<'a, Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Message> FlexRow<'a, Message> {
|
impl<'a, Message> FlexRow<'a, Message> {
|
||||||
pub const fn new(children: Vec<Element<'a, Message>>) -> Self {
|
pub(crate) const fn new(children: Vec<Element<'a, Message>>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
children,
|
children,
|
||||||
padding: Padding::ZERO,
|
padding: Padding::ZERO,
|
||||||
|
|
@ -39,6 +40,13 @@ impl<'a, Message> FlexRow<'a, Message> {
|
||||||
max_width: f32::INFINITY,
|
max_width: f32::INFINITY,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the space between each column and row.
|
||||||
|
pub const fn spacing(mut self, spacing: u16) -> Self {
|
||||||
|
self.column_spacing = spacing;
|
||||||
|
self.row_spacing = spacing;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Message: 'static + Clone> Widget<Message, crate::Theme, Renderer>
|
impl<'a, Message: 'static + Clone> Widget<Message, crate::Theme, Renderer>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue