Expand description
VStack — a vertical layout container that distributes children top-to-bottom.
Each child is offered the full container width and its intrinsic preferred
height. Positive slack (container height minus the sum of children heights
minus spacing) is distributed among children that declare a non-zero flex
weight (e.g. Expand). Over-constraint
deficits are absorbed by children with a non-zero shrink weight.
Cross-axis (horizontal) alignment defaults to Leading and can be
overridden per container with VStack::alignment or per child via
WidgetTree::set_alignment.
Use VStack when children should be stacked vertically with a configurable
gap; use HStack for the horizontal
counterpart.
let _col = VStack::new()
.spacing(8.0)
.child(TextWidget::new(lit!("Heading")))
.child(TextWidget::new(lit!("Body text")));Structs§
- VStack
- Vertical layout container that distributes children top-to-bottom
based on their intrinsic sizes. Cross-axis alignment is controlled
by
HAlignment(default:Leading).