Created
August 19, 2021 17:14
-
-
Save rubenquadros/10e199a258a2c429ab8666f00cabeb8b to your computer and use it in GitHub Desktop.
Displaying game data in infinite list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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