How to manage AnimatedVisibility visible state to Avoid Redundant Rendering hidden states

1 day ago 3
ARTICLE AD BOX

I try to make custom ModalBottomSheet() with this code:

Box(modifier = Modifier.fillMaxSize()) { Box( modifier = Modifier .fillMaxSize() .background(Color.Black.copy(alpha = 0.45f)) ) AnimatedVisibility( modifier = Modifier.align(Alignment.BottomCenter), visible = visible, enter = slideInVertically(), exit = slideOutVertically() ) {...

I would like the exit animation to run when the external visible state changes to false, while also unmounting the entire composable from the view. Similarly, when visible changes to true, I would like the composable to be mounted and the enter animation to run.

Read Entire Article