|
1 | 1 | package to.bitkit.ui.nav |
2 | 2 |
|
3 | 3 | import androidx.compose.animation.AnimatedContent |
4 | | -import androidx.compose.animation.core.FastOutSlowInEasing |
5 | | -import androidx.compose.animation.core.tween |
6 | | -import androidx.compose.animation.fadeIn |
7 | | -import androidx.compose.animation.fadeOut |
8 | | -import androidx.compose.animation.slideInHorizontally |
9 | | -import androidx.compose.animation.slideOutHorizontally |
10 | | -import androidx.compose.animation.togetherWith |
11 | 4 | import androidx.compose.runtime.Composable |
12 | 5 | import androidx.navigation3.runtime.NavEntry |
13 | 6 | import androidx.navigation3.scene.OverlayScene |
@@ -68,8 +61,6 @@ data class SheetProperties( |
68 | 61 | val size: SheetSize = SheetSize.LARGE, |
69 | 62 | ) |
70 | 63 |
|
71 | | -private const val MS_ANIM_DURATION = 300 |
72 | | - |
73 | 64 | private data class IndexedEntry<T : Any>( |
74 | 65 | val index: Int, |
75 | 66 | val entry: NavEntry<T>, |
@@ -102,32 +93,9 @@ internal class SheetScene<T : Any>( |
102 | 93 | transitionSpec = { |
103 | 94 | val isForward = targetState.index > initialState.index |
104 | 95 | if (isForward) { |
105 | | - // Forward navigation: slide in from right, slide out to left |
106 | | - slideInHorizontally( |
107 | | - initialOffsetX = { it }, |
108 | | - animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing) |
109 | | - ) + fadeIn( |
110 | | - animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing), |
111 | | - initialAlpha = 0.8f |
112 | | - ) togetherWith slideOutHorizontally( |
113 | | - targetOffsetX = { -it / 3 }, |
114 | | - animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing) |
115 | | - ) + fadeOut( |
116 | | - animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing), |
117 | | - targetAlpha = 0.8f |
118 | | - ) |
| 96 | + Transitions.screenDefault.invoke(this) |
119 | 97 | } else { |
120 | | - // Backward navigation: slide in from left, slide out to right |
121 | | - slideInHorizontally( |
122 | | - initialOffsetX = { -it / 3 }, |
123 | | - animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing) |
124 | | - ) + fadeIn( |
125 | | - animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing), |
126 | | - initialAlpha = 0.8f |
127 | | - ) togetherWith slideOutHorizontally( |
128 | | - targetOffsetX = { it }, |
129 | | - animationSpec = tween(MS_ANIM_DURATION, easing = FastOutSlowInEasing) |
130 | | - ) |
| 98 | + Transitions.screenDefaultPop.invoke(this) |
131 | 99 | } |
132 | 100 | }, |
133 | 101 | label = "SheetContentTransition", |
|
0 commit comments