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§
- BoxWith
Constraints - A
SubcomposeLayoutspecialized for the “show different content based on the available width/height” use case. - Subcompose
Layout - A layout whose
contentclosure 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-invokescontentwhenever the hashed value ofkeychanges. - subcompose_
hash_ key - Hash any
Hashvalue into au64suitable for use as aModifier::key. - subcompose_
layout_ with_ slots - Multi-slot variant of
SubcomposeLayout. Thecontentclosure 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
SubcomposeLayoutthat re-invokes itscontentclosure whenever the hashed value ofkeychanges. - subcompose_
with_ key_ slots - Multi-slot keyed variant of
subcompose_layout_with_slots. Thekey’s hashed value is attached to the resultingSubcomposeLayoutso the cache is invalidated whenever the key changes.