DocumentScreen: make the list automatically scroll to the selected page

This commit is contained in:
Pierre-Yves Nicolas
2025-07-30 11:07:08 +02:00
parent 0ab677db85
commit 63eae2fdec

View File

@@ -89,6 +89,11 @@ fun DocumentScreen(
} }
BackHandler { navigation.back() } BackHandler { navigation.back() }
val listState = rememberLazyListState()
LaunchedEffect(currentPageIndex.intValue) {
listState.animateScrollToItem(currentPageIndex.intValue)
}
MyScaffold( MyScaffold(
toAboutScreen = navigation.toAboutScreen, toAboutScreen = navigation.toAboutScreen,
pageListState = CommonPageListState( pageListState = CommonPageListState(
@@ -96,7 +101,7 @@ fun DocumentScreen(
imageLoader, imageLoader,
onPageClick = { index -> currentPageIndex.intValue = index }, onPageClick = { index -> currentPageIndex.intValue = index },
currentPageIndex = currentPageIndex.intValue, currentPageIndex = currentPageIndex.intValue,
listState = rememberLazyListState(), listState = listState,
), ),
onBack = navigation.back, onBack = navigation.back,
bottomBar = { bottomBar = {