android: update animation time on switch tap

This commit is contained in:
Kavish Devar
2025-10-10 20:44:42 +05:30
parent 4a135fa463
commit 942ff82382

View File

@@ -120,9 +120,10 @@ fun StyledSwitch(
val targetFrac = if (checked) 1f else 0f val targetFrac = if (checked) 1f else 0f
animatedFraction.animateTo(targetFrac, progressAnimationSpec) animatedFraction.animateTo(targetFrac, progressAnimationSpec)
} }
if (progressAnimation.value > 0f) return@coroutineScope
launch { launch {
progressAnimation.animateTo(1f, tween(100, easing = FastOutSlowInEasing)) progressAnimation.animateTo(1f, tween(175, easing = FastOutSlowInEasing))
progressAnimation.animateTo(0f, tween(100, easing = FastOutSlowInEasing)) progressAnimation.animateTo(0f, tween(175, easing = FastOutSlowInEasing))
} }
} }
} }