MediaViewerView: move TopBar to Scaffold topbar
This commit is contained in:
parent
2c226c8de0
commit
24b0585747
1 changed files with 46 additions and 46 deletions
|
|
@ -121,19 +121,8 @@ fun MediaViewerView(
|
||||||
Scaffold(
|
Scaffold(
|
||||||
modifier,
|
modifier,
|
||||||
containerColor = Color.Transparent,
|
containerColor = Color.Transparent,
|
||||||
snackbarHost = { SnackbarHost(snackbarHostState) },
|
topBar = {
|
||||||
) {
|
|
||||||
val pagerState = rememberPagerState(state.currentIndex, 0f) {
|
|
||||||
state.listData.size
|
|
||||||
}
|
|
||||||
LaunchedEffect(pagerState) {
|
|
||||||
snapshotFlow { pagerState.currentPage }.collect { page ->
|
|
||||||
state.eventSink(MediaViewerEvent.OnNavigateTo(page))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Top bar
|
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
modifier = Modifier.zIndex(1f),
|
|
||||||
visible = showOverlay,
|
visible = showOverlay,
|
||||||
enter = fadeIn(),
|
enter = fadeIn(),
|
||||||
exit = fadeOut(),
|
exit = fadeOut(),
|
||||||
|
|
@ -177,6 +166,17 @@ fun MediaViewerView(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
snackbarHost = { SnackbarHost(snackbarHostState) },
|
||||||
|
) {
|
||||||
|
val pagerState = rememberPagerState(state.currentIndex, 0f) {
|
||||||
|
state.listData.size
|
||||||
|
}
|
||||||
|
LaunchedEffect(pagerState) {
|
||||||
|
snapshotFlow { pagerState.currentPage }.collect { page ->
|
||||||
|
state.eventSink(MediaViewerEvent.OnNavigateTo(page))
|
||||||
|
}
|
||||||
|
}
|
||||||
HorizontalPager(
|
HorizontalPager(
|
||||||
state = pagerState,
|
state = pagerState,
|
||||||
modifier = Modifier,
|
modifier = Modifier,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue