Pick the fix
A details panel should slide in and out when expanded changes. Which is the simplest correct API?
Hint 1 of 1
Is this about one value or about appearing and disappearing?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A AnimatedVisibility(expanded) { Details() }
Correct. It animates entering and leaving composition.
Why not the others?
- B
animateFloatAsStatefor alpha, and keep the panel always composed. It fades but still takes space and stays composed. - C A
LaunchedEffectthat changes height every 16 ms. Hand-rolled animation is janky and fights the frame clock. - D
Crossfade(expanded). Crossfade swaps two contents; it doesn't slide one in and out.