I have implemented LazyColumn
with Paging, but I'm now trying to add sticky headers as well.
The stickyHeader()
function is not available inside the items()
scope, so I don't see how this should work.
@Composable
fun MovieList(movies: Flow<PagingData<Movie>>) {
val lazyMovieItems: LazyPagingItems<Movie> = movies.collectAsLazyPagingItems()
LazyColumn {
// TODO: Add sticky headers
items(lazyMovieItems) { movie ->
MovieItem(movie = movie!!)
}
}
}
How can I add the stickyHeader
s?
getAsState
is deprecated in alpha14, now you can directly use the index as lazyMovieItems[index]. – Rena