https://kotlinlang.org logo
#compose-android
Title
# compose-android
j

juliocbcotta

03/08/2024, 1:20 PM
is there any Container layout in Compose that allows me to compute the size of it's children and let's say change the width of each children to be the largest child ? My use case is that I have a FlowRow with chips, but each chip has different sizes (due to different text being used) and the flow becomes not great visually. My Idea is to have an "auto column" effect using the largest chip as column width...
s

Stylianos Gakis

03/08/2024, 1:30 PM
You can write a custom layout for this, iterate over all children and ask for their min intrinsic width, and take the maximum result of that and force all children to be measured at that width by passing fixed constraints for their width. Then the annoying thing is that you’d need to do the placement yourself 🤔 Now without doing a completely custom layout, maybe you can play with what is being said here https://developer.android.com/jetpack/compose/layouts/intrinsic-measurements? I don’t know if that’d work inside a FlowRow as-is since I have not used that one myself really.
2 Views