Created
October 19, 2021 12:18
-
-
Save victorbrndls/1ce7b6aaf27c4a6c898f4fa562876550 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Layout( | |
modifier = modifier, | |
content = content | |
) { measurables, constraints -> | |
// Don't constrain child views further, measure them with given constraints | |
val placeables = measurables.map { measurable -> measurable.measure(constraints) } | |
// Set the size of the layout as big as it can | |
layout(constraints.maxWidth, constraints.maxHeight) { | |
var yPosition = 0 | |
placeables.forEach { placeable -> | |
placeable.placeRelative(x = 0, y = yPosition) | |
yPosition += placeable.height | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment