pub fn flex_layout(
direction: Direction,
area: Rect,
items: &[(Option<u16>, Option<f64>)],
justify: Justify,
) -> Vec<Rect>Expand description
Flexbox-style layout along the main axis.
Each item is (natural_height, explicit_weight):
natural_height = Some(h)→ the component has a content-driven base ofh.natural_height = None→ “no opinion”: treated as a legacy fill participant (base 0, implicit weight1.0), reproducing the oldweighted_splitbehavior so unconverted/Nonecomponents are laid out exactly as before.
An explicit weight overrides the implicit one and acts as flex-grow: leftover
space (after every measured child gets its natural height) is distributed
proportionally to weighted items. Unweighted measured items keep their natural
height. When there are no weights and justify is Justify::Stretch, every item
grows equally to fill the axis.
Returns positioned, main-axis-sized Rects. The caller still applies cross-axis
alignment via apply_align. When justify is Justify::Stretch, the main
axis is fully consumed here — do not also call apply_justify with Stretch.
Arithmetic uses i64 internally so that overflow (content taller than the area)
and sub-pixel rounding never underflow u16.