Skip to content

Instantly share code, notes, and snippets.

@zurche
Created July 10, 2023 09:58
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 zurche/97061e9314ef9d33741379a06ef5b0ff to your computer and use it in GitHub Desktop.
Save zurche/97061e9314ef9d33741379a06ef5b0ff to your computer and use it in GitHub Desktop.
Movie List Screen
@Composable
fun MoviesListScreen(
onMovieDetails: (Int) -> Unit = {},
movies: State<List<MovieUI>>
) {
MoviesListUI(movies.value, onMovieDetails)
}
val mockMovieList = listOf(MovieUI(1, "Batman", ""))
@Composable
@Preview
private fun MoviesListUI(
movies: List<MovieUI> = mockMovieList,
onMovieDetails: (Int) -> Unit = {}
) {
LazyVerticalGrid(columns = GridCells.Fixed(2), content = {
items(count = movies.size, itemContent = { index ->
MovieUiListItem(movieUi = movies[index], onMovieDetails)
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment