Fix downloads FAB animation

This commit is contained in:
FooIbar committed 2023-11-24 16:50:29 +08:00
1 parent 08b5eac6bd
commit 216dfded4b
1 file changed
+2 -1
@@ -45,6 +45,7 @@ fun animateFloatMergePredictiveBackAsState(
): State<Float> {
val targetValue = if (enable) 0f else 1f
val animatable = remember { Animatable(targetValue, Float.VectorConverter) }
val animSpec by rememberUpdatedState(animationSpec)
val listener by rememberUpdatedState(finishedListener)
val channel = remember { Channel<Float>(Channel.CONFLATED) }
@@ -56,7 +57,7 @@ fun animateFloatMergePredictiveBackAsState(
val newTarget = channel.tryReceive().getOrNull() ?: target
launch {
if (newTarget != animatable.targetValue) {
animatable.animateTo(newTarget, animationSpec)
animatable.animateTo(newTarget, animSpec)
listener?.invoke(animatable.value)
}
}