@@ -90,22 +90,44 @@ inline fun <reified T : Any> NavGraphBuilder.composableWithDefaultTransitions(
9090/* *
9191 * Construct a nested [NavGraph] with the default screen transitions.
9292 */
93- @Suppress(" LongParameterList" )
93+ @Suppress(" LongParameterList" , " MagicNumber " )
9494inline fun <reified T : Any > NavGraphBuilder.navigationWithDefaultTransitions (
9595 startDestination : Any ,
9696 typeMap : Map <KType , @JvmSuppressWildcards NavType <* >> = emptyMap(),
9797 deepLinks : List <NavDeepLink > = emptyList(),
9898 noinline enterTransition : (AnimatedContentTransitionScope <NavBackStackEntry >.() -> EnterTransition ? )? = {
99- Transitions .slideInHorizontally
99+ // New screen slides in from the right
100+ slideInHorizontally(
101+ initialOffsetX = { fullWidth -> fullWidth },
102+ animationSpec = tween(300, easing = FastOutSlowInEasing )
103+ )
100104 },
101105 noinline exitTransition : (AnimatedContentTransitionScope <NavBackStackEntry >.() -> ExitTransition ? )? = {
102- Transitions .scaleOut
106+ // Current screen slides out to the left (partially visible behind new screen)
107+ slideOutHorizontally(
108+ targetOffsetX = { fullWidth -> -fullWidth / 3 },
109+ animationSpec = tween(300, easing = FastOutSlowInEasing )
110+ ) + fadeOut(
111+ animationSpec = tween(300, easing = FastOutSlowInEasing ),
112+ targetAlpha = 0.8f
113+ )
103114 },
104115 noinline popEnterTransition : (AnimatedContentTransitionScope <NavBackStackEntry >.() -> EnterTransition ? )? = {
105- Transitions .scaleIn
116+ // Previous screen slides in from the left (was partially visible)
117+ slideInHorizontally(
118+ initialOffsetX = { fullWidth -> -fullWidth / 3 },
119+ animationSpec = tween(300, easing = FastOutSlowInEasing )
120+ ) + fadeIn(
121+ animationSpec = tween(300, easing = FastOutSlowInEasing ),
122+ initialAlpha = 0.8f
123+ )
106124 },
107125 noinline popExitTransition : (AnimatedContentTransitionScope <NavBackStackEntry >.() -> ExitTransition ? )? = {
108- Transitions .slideOutHorizontally
126+ // Current screen slides out to the right
127+ slideOutHorizontally(
128+ targetOffsetX = { fullWidth -> fullWidth },
129+ animationSpec = tween(300, easing = FastOutSlowInEasing )
130+ )
109131 },
110132 noinline builder : NavGraphBuilder .() -> Unit ,
111133) {
0 commit comments