Created
August 22, 2022 02:40
-
-
Save markchristopherng/6e7f55a4833013dc2e282068da07bb82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WearAppTheme { | |
Scaffold( | |
timeText = { | |
if (displayTime(currentScreen, scalingLazyListState)) { | |
TimeText() | |
} | |
}, | |
vignette = { | |
Vignette(vignettePosition = VignettePosition.TopAndBottom) | |
}, | |
positionIndicator = { | |
if (scalingLazyListState.isScrollInProgress) { | |
PositionIndicator(scalingLazyListState = scalingLazyListState) | |
} | |
} | |
) { | |
WearNavHost(navController = navController, scalingLazyListState) | |
} | |
} | |
private fun displayTime(currentScreen: WearScreen, scalingLazyListState: ScalingLazyListState): Boolean { | |
return when (currentScreen) { | |
WearScreen.LIST -> { | |
return !scalingLazyListState.isScrollInProgress && | |
scalingLazyListState.layoutInfo.visibleItemsInfo.firstOrNull()?.index == 0 | |
} | |
else -> true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment