Skip to content

Instantly share code, notes, and snippets.

@rubenquadros
Created August 19, 2021 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenquadros/10e199a258a2c429ab8666f00cabeb8b to your computer and use it in GitHub Desktop.
Save rubenquadros/10e199a258a2c429ab8666f00cabeb8b to your computer and use it in GitHub Desktop.
Displaying game data in infinite list
@Composable
fun GameListing(
games: Flow<PagingData<GameResultsEntity>>
) {
val lazyGameItems = games.collectAsLazyPagingItems()
LazyVerticalGrid(
cells = GridCells.Fixed(2),
content = {
items(lazyGameItems.itemCount) { index ->
lazyGameItems[index]?.let {
Text(
modifier = Modifier.fillMaxWidth(),
text = it.name,
color = Color.Black
)
}
}
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment