File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
app/src/main/java/to/bitkit/ui/components Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import androidx.compose.animation.SizeTransform
55import androidx.compose.animation.core.Animatable
66import androidx.compose.animation.core.Spring
77import androidx.compose.animation.core.spring
8+ import androidx.compose.animation.core.tween
89import androidx.compose.animation.fadeIn
910import androidx.compose.animation.fadeOut
1011import androidx.compose.animation.slideInVertically
@@ -126,7 +127,14 @@ fun ToastView(
126127 val isHorizontalSwipe = horizontalSwipeDistance > verticalSwipeDistance
127128
128129 if (isHorizontalSwipe && horizontalSwipeDistance > dismissThreshold.toPx()) {
129- // Horizontal swipe dismiss
130+ // Horizontal swipe dismiss - animate off-screen horizontally
131+ val swipeDirection = if (dragOffsetX.value > 0 ) 1f else - 1f
132+ val targetOffsetX = swipeDirection * 1200 .dp.toPx()
133+
134+ dragOffsetX.animateTo(
135+ targetValue = targetOffsetX,
136+ animationSpec = tween(durationMillis = 200 )
137+ )
130138 onDismiss()
131139 } else if (! isHorizontalSwipe && dragOffsetY.value < - dismissThreshold.toPx()) {
132140 // Vertical swipe up dismiss
You can’t perform that action at this time.
0 commit comments