Ariana
03/13/2023, 7:26 PM@Composable
fun MusicPopUp(
modifier: Modifier = Modifier,
slidePopup: Boolean = false, <-- this is a flow state (collectAsState)
fadePopup: Boolean = false <-- this is a flow state (collectAsState)
) {
val exitAnimation = if (fadePopup) {
fadeOut(targetAlpha = 0f, animationSpec = tween(500))
} else {
slideOutVertically(animationSpec = tween(500)) { -it }
}
AnimatedVisibility(
visible = fadePopup || slidePopup,
enter =
if (fadePopup) {
fadeIn(initialAlpha = 0f, animationSpec = tween(500))
} else {
slideInVertically(animationSpec = tween(500)) { it }
},
exit = exitAnimation
) { ...
It always seems to default to the slide out animation instead of the fade out. How can I get fade out working?