Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
style: add nav transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Apr 13, 2024
1 parent 7111b8c commit 1adc35e
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions app/src/main/java/com/bnyro/recorder/ui/NavHost.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.bnyro.recorder.ui

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
Expand All @@ -21,17 +24,46 @@ fun AppNavHost(
startDestination = Destination.Home.route,
modifier = modifier
) {
composable(route = Destination.Home.route) {
composable(route = Destination.Home.route,
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Down,
initialOffset = { it / 4 }
) + fadeIn()
},
exitTransition = {
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Up,
targetOffset = { it / 4 }) + fadeOut()
}) {
HomeScreen(initialRecorder, onNavigate = { destination ->
navController.navigateTo(destination.route)
})
}

composable(route = Destination.Settings.route) {
composable(route = Destination.Settings.route,
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Up,
initialOffset = { it / 4 }) + fadeIn()
},
exitTransition = {
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Down,
targetOffset = { it / 4 }) + fadeOut()
}
) {
SettingsScreen()
}

composable(route = Destination.RecordingPlayer.route) {
composable(route = Destination.RecordingPlayer.route,
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Up,
initialOffset = { it / 4 }) + fadeIn()
},
exitTransition = {
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Down,
targetOffset = { it / 4 }) + fadeOut()
}) {
PlayerScreen(showVideoModeInitially = false)
}
}
Expand Down

0 comments on commit 1adc35e

Please sign in to comment.