Skip to content

Commit bbd2720

Browse files
committed
feat: scanner transition slide-in-out vertically
1 parent c1dd9fa commit bbd2720

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

app/src/main/java/to/bitkit/ui/ContentView.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ import to.bitkit.ui.sheets.PinSheet
139139
import to.bitkit.ui.sheets.SendSheet
140140
import to.bitkit.ui.theme.TRANSITION_SHEET_MS
141141
import to.bitkit.ui.utils.AutoReadClipboardHandler
142+
import to.bitkit.ui.utils.Transitions
142143
import to.bitkit.ui.utils.composableWithDefaultTransitions
143144
import to.bitkit.utils.Logger
144145
import to.bitkit.viewmodels.ActivityListViewModel
@@ -954,7 +955,9 @@ private fun NavGraphBuilder.qrScanner(
954955
appViewModel: AppViewModel,
955956
navController: NavHostController,
956957
) {
957-
composable<Routes.QrScanner>(
958+
composableWithDefaultTransitions<Routes.QrScanner>(
959+
enterTransition = { Transitions.slideInVertically },
960+
popExitTransition = { Transitions.slideOutVertically },
958961
) {
959962
QrScanningScreen(navController = navController) { qrCode ->
960963
appViewModel.onScanResult(

app/src/main/java/to/bitkit/ui/utils/Nav.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ import androidx.compose.animation.fadeOut
1010
import androidx.compose.animation.scaleIn
1111
import androidx.compose.animation.scaleOut
1212
import androidx.compose.animation.slideInHorizontally
13+
import androidx.compose.animation.slideInVertically
1314
import androidx.compose.animation.slideOutHorizontally
15+
import androidx.compose.animation.slideOutVertically
1416
import androidx.compose.runtime.Composable
1517
import androidx.navigation.NavBackStackEntry
1618
import androidx.navigation.NavDeepLink
@@ -27,6 +29,8 @@ object Transitions {
2729
val slideOutHorizontally = slideOutHorizontally(animationSpec = tween(), targetOffsetX = { it })
2830
val scaleIn = scaleIn(animationSpec = tween(), initialScale = 0.95f) + fadeIn()
2931
val scaleOut = scaleOut(animationSpec = tween(), targetScale = 0.95f) + fadeOut()
32+
val slideInVertically = slideInVertically(animationSpec = tween(), initialOffsetY = { it })
33+
val slideOutVertically = slideOutVertically(animationSpec = tween(), targetOffsetY = { it })
3034
}
3135

3236
/**

0 commit comments

Comments
 (0)