Last active
May 30, 2021 08:01
-
-
Save zskamljic/73517b6d65693fad083ce64ecc58b175 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
val scrollState = rememberScrollState() | |
Layout( | |
modifier = Modifier.verticalScroll(scrollState), | |
content = { repeat(itemCount) { item(it) } } | |
) { measurables, constraints -> | |
val placeables = measurables.map { measurable -> | |
measurable.measure(constraints) | |
} | |
val itemSpacing = 16.dp.roundToPx() | |
layout(constraints.maxWidth, constraints.maxHeight) { | |
var yPosition = 0 | |
placeables.forEach { placeable -> | |
placeable.placeRelative(x = 0, y = yPosition) | |
yPosition += placeable.height + itemSpacing | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment