Skip to main content

Module min_size

Module min_size 

Source
Expand description

MinSize — a layout modifier that ensures a child reaches a minimum width and/or height.

The child’s reported size is clamped upward so it never falls below the configured minimum on each constrained axis. The minimum is also forwarded as part of the clamped proposal so that wrap-aware children (e.g. a multi-line TextWidget) measure against the constraint they will actually be placed into. Axes with no minimum set are passed through unchanged.

MinSize propagates the child’s flex and shrink weights so that a Spacer or Expand inside MinSize still participates in stack slack-distribution; the child’s own compression floor is composed with the MinSize floor.

For the inverse operation (capping a maximum size) see MaxSize.

// Guarantee a 44×44 dp tap target around a 20 dp icon.
let _tap_target = MinSize::new(44.0, 44.0)
    .child(IconWidget::checkmark(20.0));

Structs§

MinSize
Layout modifier that enforces a minimum width and/or height on a single child widget.