I'm trying to implement a custom layout that will ...
# compose
c
I'm trying to implement a custom layout that will display 2 buttons side by side filling the available width with spacing between them that will fallback to stacking the buttons to full width if there isn't enough space to display each button side by side. I've tried using flow row, but it doesn't seem to be possible to say 'try to use 50% of the space, but 100% if you can't' I've tried using a custom
Layout
but need to be able to measure multiple times - I've tried using
SubcomposeLayout
to be able to measure multiple times, but as the layout appears in a
LazyColumn
- the lack of an intrinsic height causes crashes when I scroll the content.
👀 1
visual representation of what I'm after
z
Im not sure this is how it works, but FlowRow does have its own version of Modifier.weight that might help
m
Have you tried this solution https://gist.github.com/alexvanyo/d246ce358cbe63488f167bcf3357a77f ? it just uses normal
Layout
. no need for multiple measurements or
SubcomposeLayout
👀 1
c
thanks all!
k
That snippet might need to use
maxIntrinsicWidth
instead of
minIntrinsicWidth