Skip to content

Commit 6bfb38c

Browse files
committed
example: Use targetPage instead of currentPage
1 parent 23d4c14 commit 6bfb38c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

example/src/commonMain/kotlin/UITest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ private fun WideScreenPanel(
264264
windowSize: WindowSize,
265265
layoutDirection: LayoutDirection
266266
) {
267-
val currentPage = LocalPagerState.current.currentPage
267+
val page = LocalPagerState.current.targetPage
268268
val handlePageChange = LocalHandlePageChange.current
269269
Scaffold(
270270
modifier = Modifier
@@ -301,7 +301,7 @@ private fun WideScreenPanel(
301301
BasicComponent(
302302
title = title,
303303
onClick = { handlePageChange(index) },
304-
holdDownState = currentPage == index,
304+
holdDownState = page == index,
305305
)
306306
}
307307
}
@@ -331,7 +331,7 @@ private fun WideScreenContent(
331331
exit = fadeOut() + shrinkVertically()
332332
) {
333333
SmallTopAppBar(
334-
title = UIConstants.PAGE_TITLES[LocalPagerState.current.currentPage],
334+
title = UIConstants.PAGE_TITLES[LocalPagerState.current.targetPage],
335335
scrollBehavior = currentScrollBehavior,
336336
actions = {
337337
TopAppBarActions(
@@ -444,7 +444,7 @@ private fun NavigationBar(
444444
uiState: UIState,
445445
navigationItems: List<NavigationItem>,
446446
) {
447-
val currentPage = LocalPagerState.current.currentPage
447+
val page = LocalPagerState.current.targetPage
448448
val handlePageChange = LocalHandlePageChange.current
449449
AnimatedVisibility(
450450
visible = uiState.showNavigationBar,
@@ -458,7 +458,7 @@ private fun NavigationBar(
458458
) {
459459
NavigationBar(
460460
items = navigationItems,
461-
selected = currentPage,
461+
selected = page,
462462
onClick = handlePageChange
463463
)
464464
}
@@ -469,7 +469,7 @@ private fun NavigationBar(
469469
) {
470470
FloatingNavigationBar(
471471
items = navigationItems,
472-
selected = currentPage,
472+
selected = page,
473473
mode = FloatingNavigationBarDisplayMode.fromInt(uiState.floatingNavigationBarMode).toMode(),
474474
horizontalAlignment = FloatingNavigationBarAlignment.fromInt(uiState.floatingNavigationBarPosition)
475475
.toAlignment(),
@@ -596,7 +596,7 @@ private fun TopAppBarActions(
596596
showTopPopup: MutableState<Boolean>,
597597
) {
598598
val hapticFeedback = LocalHapticFeedback.current
599-
val currentPage = LocalPagerState.current.currentPage
599+
val page = LocalPagerState.current.targetPage
600600
val handlePageChange = LocalHandlePageChange.current
601601

602602
ListPopup(
@@ -613,7 +613,7 @@ private fun TopAppBarActions(
613613
DropdownImpl(
614614
text = navigationItem.label,
615615
optionSize = items.size,
616-
isSelected = index == currentPage,
616+
isSelected = index == page,
617617
onSelectedIndexChange = {
618618
handlePageChange(index)
619619
hapticFeedback.performHapticFeedback(HapticFeedbackType.Confirm)

0 commit comments

Comments
 (0)