alxdthn
11/10/2023, 2:06 PMRow with weight inside LazyRow works unexpected. The Text lacks available horizontal space.
@Preview
@Composable
private fun Test() {
LazyRow(modifier = Modifier.fillMaxWidth()) {
item {
Column {
Row(modifier = Modifier.fillMaxWidth()) {
Text(
text = "Text",
modifier = Modifier.weight(1f),
)
// some content...
}
// some content...
}
}
}
}czuckie
11/10/2023, 2:31 PMalxdthn
11/10/2023, 2:33 PMczuckie
11/10/2023, 2:35 PMalxdthn
11/10/2023, 2:36 PMczuckie
11/10/2023, 2:38 PMczuckie
11/10/2023, 2:38 PMalxdthn
11/10/2023, 2:44 PMfillMaxWidth LazyRow and all child, i do the same. Thanks!czuckie
11/10/2023, 2:46 PMBoxWithConstraints and use the scope inside the content lambda to obtain the maxWidth property which will reflect the size of the BoxWithConstraints composable (which could be different from the screen width).
I'm not sure what your UI is going to eventually look like but you may not need a LazyRow (or the screen width stuff) if you're just creating the layout as it is above.
Either way, keep going and good luck!Zach Klippenstein (he/him) [MOD]
11/10/2023, 3:32 PMalxdthn
11/10/2023, 3:39 PMDoes fillMaxParentWidth work for you?Yes, this is exact what i need!
Zach Klippenstein (he/him) [MOD]
11/10/2023, 3:49 PMczuckie
11/10/2023, 4:15 PMThat will be MUCH better than BoxWithConstraintsOooo, noted, thanks Zach!
brandonmcansh
11/10/2023, 4:43 PM