Is there an easy way to animate the Checkbox check...
# compose
f
Is there an easy way to animate the Checkbox checked-state in Compose so it doesn't look so abrupt?
t
Im seeing checkboxes state animated by default in material theme. Is your theme extending material theme?
f
@Tin Tran Yes it does. I have a ripple effect but it looks very different to the old XML checkbox
Here is a comparison
left XML, right Compose
I'm not sure if I'm seeing any animation in Compose at all
@Tin Tran is the right one the same animation you have?
t
Yeah I have the right one on my app
It’s enough for me tho 😄
z
I thought I remembered seeing a CL specifically about animating the compose checkbox like 6 months ago - weird. It does look a little sudden to me too though.
f
Thank you very much! Good to know!
d
The durations for animating various properties of CheckBox are pretty short:
Copy code
private const val BoxInDuration = 50
private const val BoxOutDuration = 100
private const val CheckAnimationDuration = 100
defined at the end of the
Checkbox.kt
. It's likely a deliberate decision. @Louis Pullen-Freilich [G] would probably be able to share more insights.
l
Yes, these should be the correct up-to-date values from the Material spec
f
good to know, thank you!
👍 1
243 Views