Skip to main content

Module subcompose

Module subcompose 

Source
Expand description

SubcomposeLayout and BoxWithConstraints.

These layouts compose their children during the reconcile pass using the current available size, so the inner content can adapt to the parent’s constraints.

Content closures are not hashed. Invalidated with a changing key (subcompose_with_key) or invalidate_subcompose_cache when captured signals change without a structural View change.

Functions§

BoxWithConstraints
A SubcomposeLayout specialized for the “show different content based on the available width/height” use case.
SubcomposeLayout
A layout whose content closure is invoked with the current available size (in dp) and returns one or more (slot_id, view) pairs.
box_with_constraints_with_key
Keyed variant of BoxWithConstraints. Re-invokes content whenever the hashed value of key changes.
subcompose_hash_key
Hash any Hash value into a u64 suitable for use as a Modifier::key.
subcompose_layout_with_slots
Multi-slot variant of SubcomposeLayout. The content closure receives the current scope and returns a list of (slot_id, view) pairs. Slot ids are stable across frames: removing or reordering slots preserves the underlying tree nodes.
subcompose_with_key
Build a SubcomposeLayout that re-invokes its content closure whenever the hashed value of key changes.
subcompose_with_key_slots
Multi-slot keyed variant of subcompose_layout_with_slots. The key’s hashed value is attached to the resulting SubcomposeLayout so the cache is invalidated whenever the key changes.