, before placing it?
I would like to have it's height, limited by some height substraction, affected by scroll.
In the following example, I would like to have expanded height to be
expanded.width - scrollOffset
Copy code
@Composable
private fun X(scrollOffset: Int) {
Layout(
content = {
collapsedContent()
expandedContent()
}
) { measurables, constraints ->
val collapsed = measurables[0].measure(constraints)
val expanded = measurables[1].measure(constraints)
val width = maxOf(collapsed.width, expanded.width)
val height = maxOf(collapsed.height, expanded.height)
layout(width, height) {
collapsed.place(0, 0)
expanded.place(0, 0)
}
}
}
Peter
12/19/2023, 10:54 AM
Following doesn't seem to work
Copy code
val collapsed = measurables[0].measure(constraints)
val expanded = measurables[1].measure(constraints)
val expandedHeight = (expanded.height - scrollOffset).coerceAtLeast(0)
val width = maxOf(collapsed.width, expanded.width)
val height = maxOf(collapsed.height, expandedHeight)
layout(width, height) {
collapsed.place(0, 0)
expanded.place(0, 0)
}
a
Andrey Kulikov
12/19/2023, 7:59 PM
you can call placeWithLayer and specify the shape to clip in the lambda block