Skip to main content

Module wrap

Module wrap 

Source
Expand description

Wrap — a horizontal flow layout that wraps children to the next line when they exceed the available width.

Children are placed left-to-right (or right-to-left under RTL layout) and wrapped to the next line when the next item would exceed the container width. Each line’s height is the tallest child on that line. Use spacing for the horizontal gap between items and line_spacing for the vertical gap between lines.

Wrap is the right choice for chip rows, badge lists, and any collection whose items vary in width and should reflow as the container resizes. For a fixed grid use crate::primitives::Grid instead.

let _chips = Wrap::new()
    .spacing(8.0)
    .line_spacing(6.0)
    .child(TextWidget::new(lit!("Rust")))
    .child(TextWidget::new(lit!("GUI")))
    .child(TextWidget::new(lit!("Desktop")));

Structs§

Wrap
A horizontal flow layout that wraps children to the next line.