kenkyee
09/29/2021, 1:48 PMkenkyee
09/29/2021, 1:49 PMLaunchedEffect(loadMore) {
snapshotFlow { loadMore.value }
.filter { it }
.collect {
onLoadMore()
}
}
kenkyee
09/29/2021, 1:50 PMkenkyee
09/29/2021, 1:50 PMNicholas Doglio
09/29/2021, 2:28 PMkenkyee
09/29/2021, 2:34 PMkenkyee
09/29/2021, 2:46 PMfun DisplayTasks(
tasks: List<ToDoTask>,
navigateToTaskScreen: (taskId: Int) -> Unit,
onLoadMore: () -> Unit
) {
LazyColumn {
itemsIndexed(tasks) { index, task ->
if ((tasks.size - 5) == index) {
onLoadMore()
}
TaskItem(
toDoTask = task,
navigateToTaskScreen = navigateToTaskScreen
)
}
5 is the load point from the bottom of the list.
Still surprised using the lazyliststate doesn't work properly....this is the latest version of Compose 1.0.2kenkyee
09/29/2021, 2:49 PMNicholas Doglio
09/29/2021, 2:51 PM