Last active
July 4, 2024 08:23
-
-
Save pflammertsma/fa6aa13c44365ceea872307cc8e92526 to your computer and use it in GitHub Desktop.
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 SampleImmersiveList(movies: List<Movie>, modifier = Modifier) { | |
val selectedMovie = remember { mutableStateOf<Movie?>(movies.firstOrNull()) } | |
// Container | |
Box( | |
modifier = Modifier | |
.fillMaxWidth() | |
.height(400.dp) | |
) { | |
// Background | |
Box( | |
modifier = Modifier | |
.fillMaxWidth() | |
.aspectRatio(20f / 7) | |
.background(selectedMovie.value?.background) | |
) {} | |
// Rows | |
LazyRow( | |
… | |
) { | |
items(movies) { movie -> | |
MyMovieCard( | |
modifier = Modifier | |
.onFocusChanged { | |
if (it.hasFocus) { | |
selectedMovie.value = movie | |
} | |
}, | |
… | |
) {} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment