Skip to content

Instantly share code, notes, and snippets.

@markchristopherng
Created August 22, 2022 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markchristopherng/6e7f55a4833013dc2e282068da07bb82 to your computer and use it in GitHub Desktop.
Save markchristopherng/6e7f55a4833013dc2e282068da07bb82 to your computer and use it in GitHub Desktop.
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