dimsuz
07/29/2021, 9:48 AMLayout(content = { leftSlot(); centerSlot(); rightSlot(); }) { measurables, constraints -> ... }
And layout logic is based on the assumption that I'll have 3 measureables: for example I want to always expand centerSlot
. But I've found that if a centerSlot()
composable will not emit any UI (return Unit), I'll have measurables.size == 2
, and also I won't know which one of them is missing.
For now I solved this by wrapping each slot in a box (e.g. Box { leftSlot() }
), but I'm not sure if this is the best way.Rob Meeuwisse
07/29/2021, 10:29 AMandroidx.compose.material.TextField
code. If you go down the rabbit hole enough levels you end up in private fun IconsWithTextFieldLayout
, which does a call to layout()
. Please notice that it passes a variable set of composables in the content argument. But they have a Modifier.layoutId(SomeId)
so that they can be found again inside the measurePolicy block.dimsuz
07/29/2021, 10:31 AMlayoutId
is the thing I've unsuccessfully tried to remember yesterday 🙂 Thank you, will look into this example you've suggested.Adam Powell
07/29/2021, 1:38 PM