Abdul Hafeez Sajid
11/10/2022, 11:56 AMLayout
with custom draggable and state handling. I am facing problem with Pager height. If I give specific height, then it works fine. But if I don’t give any height and use Modifier.wrapContentHeight()
then Pager does not show up. The items may have different heights that is why wrapContentHeight is must. I have tried to debug it and found out that, when no height is given then Constraints in Layout
have height set to zero hence placeables get zero height. Kindly help.
Code attached in the thread.ste
11/10/2022, 1:08 PMlayout
a height
somehow, e.g. the max measured height of placeables
Kirill Grouchnikov
11/10/2022, 1:40 PMste
11/10/2022, 1:48 PM{ measurables, constraints ->
val placeables = measurables.map { it.measure(contraints) }
val maxHeight = placeables.maxOf { it.height }
layout(contraints.maxWidth, maxHeight) { ... }
}
ste
11/10/2022, 1:50 PMminWidth
or minHeight
to zero according to the orientation):
when (orientation) {
Orientation.Vertical -> measure(it, constraints.copy(minWidth = 0))
Orientation.Horizontal -> measure(it, constraints.copy(minHeight = 0))
}
Abdul Hafeez Sajid
11/10/2022, 1:52 PMadit
01/10/2024, 12:29 PM