layout

fun layout(width: Int, height: Int, placement: PlacementScope.() -> Unit)

Declare this container's size and how its children are positioned.

Positioning happens inside the block and nowhere else: place exists only on PlacementScope, so placing a child while still measuring is a compile error rather than a child placed against a size that has not settled.

Parameters

width

the width this container asks for; the parent may override it

height

the height this container asks for; the parent may override it

placement

runs later, once the final size is known, which may differ from width by height. Capture whatever it needs — Placeables, sizes, anything computed while measuring — and it will see those values. It only places: measuring a child there does not compile.

Throws

if called twice, since one of the two sizes would be discarded