mgrazianodecastro
01/19/2023, 5:52 PMN
-sized list to n
in a Lazy column? The only solution I could think for it, it is to place the items in a box container to fill 1/n
the parent height, so the user would scroll n
elements at the screen.Landry Norris
01/19/2023, 6:30 PMmgrazianodecastro
01/19/2023, 6:32 PMLandry Norris
01/19/2023, 6:35 PM@Composable
fun <T> LimitedLazyColumn(
n: Int, items: List<T>, content: @Composable LazyItemScope.(Int) -> Unit
) {
LazyColumn {
items(items.subList(0, n.coerceAtMost(items.size)), content)
}
}
Landry Norris
01/19/2023, 6:35 PMmgrazianodecastro
01/19/2023, 6:37 PMn
items? If so, that's not the goalLandry Norris
01/19/2023, 6:37 PMLandry Norris
01/19/2023, 6:39 PMmgrazianodecastro
01/19/2023, 6:40 PMmgrazianodecastro
01/19/2023, 6:40 PMSaiedmomen
01/19/2023, 6:42 PMmgrazianodecastro
01/19/2023, 6:45 PMSaiedmomen
01/19/2023, 6:46 PMmgrazianodecastro
01/19/2023, 6:47 PMmgrazianodecastro
01/19/2023, 6:49 PMLazyColumn(
verticalArrangement = Arrangement.SpaceAround,
...
){
items(...){
Box(
modifier = Modifier
.fillParentMaxHeight(1/nf)
...
){...}
}
}
mgrazianodecastro
01/19/2023, 6:52 PM