dimsuz
04/21/2022, 12:31 PMRow
and if a sum width of all of its children is less than screenWidth
I want to use .weight(1)
for them.
Otherwise I want to use .horizontalScroll()
on the Row
.
Is there a nice way to achieve this?
I thought about SubcomposeLayout
instead of Row
but I'm not sure, because I need to also manipulate Modifier
in this case (for scrolling)Filip Wiesner
04/21/2022, 12:34 PMdimsuz
04/21/2022, 12:37 PMweight(1)
will have no effect.Filip Wiesner
04/21/2022, 12:39 PMweight
working in scrollable Column
so I thought this would workdimsuz
04/21/2022, 2:15 PMZach Klippenstein (he/him) [MOD]
04/21/2022, 5:21 PMZach Klippenstein (he/him) [MOD]
04/21/2022, 5:25 PMvar viewportSize by remember { mutableStateOf(Size.Unspecified) }
Layout(
content = content,
modifier = modifier
.onSizeChanged { viewportSize = it }
.verticalScroll(…)
) { m, c ->
// Use intrinsics to determine if items will fit inside viewportSize.
// If they do, measure with equal fixed constraints.
// If not, measure with unbounded constraints.
…
}
Zach Klippenstein (he/him) [MOD]
04/21/2022, 5:27 PMFilip Wiesner
04/21/2022, 5:59 PMFilip Wiesner
04/21/2022, 7:57 PMdimsuz
04/22/2022, 10:27 AMZach Klippenstein (he/him) [MOD]
04/22/2022, 4:11 PM