Sergio C.
01/23/2023, 10:48 PMAnimatedVisibility
? 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?eygraber
01/23/2023, 11:40 PMdewildte
01/24/2023, 12:44 AMSergio C.
01/24/2023, 11:15 AMSergio C.
01/24/2023, 11:16 AMdewildte
01/24/2023, 6:33 PMHow 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:
data class MyItemUiState(val isVisible: Boolean, ...)
@Composable
fun MyItem(state: MyItemUiState, ...) {
AnimatedVisisbility(state.isVisible) {
Row() {
....
}
}
}
Note you could also make a stateless version too.