What is an idiomatic way to write "slot-based" custom layouts?
For example I want to have 3 slots:
Layout(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.