Skip to content

Instantly share code, notes, and snippets.

@aqua30
Created May 27, 2022 18:22
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 aqua30/8b4cf0292453f29da11e4557fea26d5c to your computer and use it in GitHub Desktop.
Save aqua30/8b4cf0292453f29da11e4557fea26d5c to your computer and use it in GitHub Desktop.
Animation section for selection screen.
AnimatedContent(
targetState = timerContent,
transitionSpec = {
if(targetState == TimerContent.SELECTION) {
slideInVertically { height -> height } + fadeIn() with
slideOutVertically { height -> -height } + fadeOut()
} else {
slideInVertically { height -> -height } + fadeIn() with
slideOutVertically { height -> height } + fadeOut()
}
}
) {
target ->
if (target == TimerContent.SELECTION) {
TimerSelectionScreen(
modifier = Modifier.fillMaxWidth(),
timeState = timeState,
onKeyClick = { key ->
timerViewModel.onEvent(
UiEvent.OnKeyPressed(key)
)
}
)
} else {
TimerRunnerScreen(
modifier = Modifier.fillMaxWidth(),
onTimerStop = { key ->
timerViewModel.onEvent(
UiEvent.OnKeyPressed(key)
)
}
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment