Suppose I have a `Box(Modifier.fillMaxSize())` and...
# compose
a
Suppose I have a
Box(Modifier.fillMaxSize())
and I want to place some content into it such that the content is centered and either takes its intrinsic size (if it has one) or fills the entire box if it doesn’t (like in the case of lazy layouts). Is there a way to do that?
Modifier.size(IntrinsicSize.Min/Max)
throws about being unable to ask a
SubcomposeLayout
about its intrinsic size.
m
maybe
BoxWithConstraints
with a
hightIn, widthIn, sizeIn, ratio
choice combination?
a
If I understand correctly, BoxWithConstraints lets me access the incoming constraints, which doesn’t really help for sizing the child content according to its own preferences. No?
m
(edited) I imagined the child having a modifier like:
Modifier.height(height)
, where
height
is calculated considering whether it has a defined height or not, like
maxHeight
in place of a height. But maybe that's not enough for you 😅