? I'm using this to create an expand and contract animation in a column with a list of items that have a small image and text.
I'm getting a very laggy unresponsive layout in the expansion animation when the layout has images. If I remove the images the animations run smoothly.
I've tried
remember
to save the bitmap,
derivedStateOf
, Coil
AsynImage,
loading from the ViewModel, and other tricks but still a column inside
nimatedVisibility
with a list of images is super SLOW.
What can be done to make the animation smoother?
e
eygraber
01/23/2023, 11:40 PM
Have you tried with a release build?
d
dewildte
01/24/2023, 12:44 AM
Generally I do not animate an entire list.
I have only made the items in the list individually animated.
s
Sergio C.
01/24/2023, 11:15 AM
Yes I've tried release build. but till when clicking to expand there is a delay blocking the entire UI, no animation and then all the list with the images appear in place.
Sergio C.
01/24/2023, 11:16 AM
How do you do that Eric? expand and collapse each item?
d
dewildte
01/24/2023, 6:33 PM
How do you do that Eric? expand and collapse each item?
Yes I have each item be wrapped in the
AnimatedVisibility
Composable
and then drive it via boolean on a State class I pass in.
For example:
Copy code
data class MyItemUiState(val isVisible: Boolean, ...)
@Composable
fun MyItem(state: MyItemUiState, ...) {
AnimatedVisisbility(state.isVisible) {
Row() {
....
}
}
}