fix(grid): enable configurable column and row alignment
This commit is contained in:
parent
6448b75e76
commit
c937332322
1 changed files with 8 additions and 7 deletions
|
|
@ -34,8 +34,8 @@ pub fn resolve<Message>(
|
||||||
|
|
||||||
// Attach widgets as child nodes.
|
// Attach widgets as child nodes.
|
||||||
for (child, assignment) in items.iter().zip(assignments.iter()) {
|
for (child, assignment) in items.iter().zip(assignments.iter()) {
|
||||||
// Calculate the dimensdrawions of the item.
|
// Calculate the dimensions of the item.
|
||||||
let child_node = child.as_widget().layout(renderer, &limits);
|
let child_node = child.as_widget().layout(renderer, limits);
|
||||||
let size = child_node.size();
|
let size = child_node.size();
|
||||||
|
|
||||||
nodes.push(child_node);
|
nodes.push(child_node);
|
||||||
|
|
@ -54,6 +54,7 @@ pub fn resolve<Message>(
|
||||||
width: length(size.width),
|
width: length(size.width),
|
||||||
height: length(size.height),
|
height: length(size.height),
|
||||||
},
|
},
|
||||||
|
|
||||||
..Style::default()
|
..Style::default()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -84,12 +85,12 @@ pub fn resolve<Message>(
|
||||||
height: length(column_spacing),
|
height: length(column_spacing),
|
||||||
},
|
},
|
||||||
|
|
||||||
justify_content: Some(match height {
|
justify_items: Some(match height {
|
||||||
Length::Fill | Length::FillPortion(_) => AlignContent::Stretch,
|
Length::Fill | Length::FillPortion(_) => AlignItems::Stretch,
|
||||||
_ => match column_alignment {
|
_ => match column_alignment {
|
||||||
Alignment::Start => AlignContent::Start,
|
Alignment::Start => AlignItems::Start,
|
||||||
Alignment::Center => AlignContent::Center,
|
Alignment::Center => AlignItems::Center,
|
||||||
Alignment::End => AlignContent::End,
|
Alignment::End => AlignItems::End,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue