Created
July 10, 2023 09:58
-
-
Save zurche/97061e9314ef9d33741379a06ef5b0ff to your computer and use it in GitHub Desktop.
Movie List Screen
This file contains hidden or 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 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