Skip to main content

Module fixed_size

Module fixed_size 

Source
Expand description

FixedSize — a layout modifier that pins a child to its natural size, optionally overriding one or both dimensions with a reactive value.

Without bindings, FixedSize ignores the parent’s size proposal and always reports the child’s intrinsic size. This is useful for widgets that must not be stretched or compressed by their containing stack — icons, chips, or thumbnails that must stay at their designed size regardless of the surrounding layout.

With width or height, the corresponding dimension is locked to a reactive Signal<f32> value; the signal change triggers a relayout automatically. Unbound dimensions still fall back to the child’s natural size.

let sidebar_width = Signal::new(240.0_f32);
// Pin the sidebar width to a reactive signal
let _sidebar = FixedSize::new()
    .width(sidebar_width)
    .child(RectWidget::new());

Structs§

FixedSize
Layout modifier that prevents a widget from expanding beyond its natural size, or constrains it to specific reactive dimensions.