Is there a way for lazy loading with FlowRow?

Viewed 563

I use FlowRow in the accompanist project to auto wrap my text items to next line. It works as intended. However, when I have a large dataset (which I already load with paging), I don't find an api like LazyColumn to load and build the items as needed, if I loop through the pager flow, it tries to load to build everything at once. Any adice please?

lazyPagingItems = pager.flow.collectAsLazyPagingItems()

FlowRow(
 ) {
    val items = lazyPagingItems
    for (index in 1..items.itemCount-1) {
        Text(
            text = word,
            maxLines = 1
        )
    }
}
1 Answers

Little late to the party. But it seems you could use LazyVerticalGrid or LazyHorizontalGrid in adaptive mode like below.

LazyVerticalGrid(
    columns = GridCells.Adaptive(/* item min size */)
) {
    // Items
}
Related