Skip to main content

Module hstack

Module hstack 

Source
Expand description

HStack — a horizontal layout container that distributes children left-to-right.

Children are given their intrinsic width and the stack’s cross-axis height. Positive slack (leftover space) is distributed among children that carry a non-zero flex weight (e.g. Spacer, Expand); negative slack (over-constraint) is absorbed by children with a non-zero shrink weight (e.g. a single-line TextWidget). Vertical alignment defaults to VAlignment::Center and can be overridden per-container or per-child.

For a vertical counterpart see VStack.

let _row = HStack::new()
    .spacing(8.0)
    .child(TextWidget::new(lit!("Label")))
    .child(Spacer::new())
    .child(TextWidget::new(lit!("Value")));

Structs§

HStack
Horizontal layout container that distributes children left-to-right.