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() }
val listState = rememberLazyListState()
LaunchedEffect(currentPageIndex.intValue) {
listState.animateScrollToItem(currentPageIndex.intValue)
}
MyScaffold(
toAboutScreen = navigation.toAboutScreen,
pageListState = CommonPageListState(
@@ -96,7 +101,7 @@ fun DocumentScreen(
imageLoader,
onPageClick = { index -> currentPageIndex.intValue = index },
currentPageIndex = currentPageIndex.intValue,
listState = rememberLazyListState(),
listState = listState,
),
onBack = navigation.back,
bottomBar = {