1

I am trying to animate this dialog coming into the screen but animated visibility does not seem to work here. I've tried many things but none seem to work. Any ideas why this would not work and/or a possible work around?

val openDialog = remember { mutableStateOf(false) }

AnimatedVisibility(

            visible = openDialog.value,
            enter =  fadeIn(animationSpec = tween(durationMillis = 1250)),
            exit = scaleOut(),

        ) {

            Dialog(onDismissRequest = { /*TODO*/ }) {
                 Text("Test")
            }


 }
barryalan2633
  • 610
  • 7
  • 21
  • 2
    Dialog is not a plain Compose view - a great flag of this is that it doesn't have `Modifier` parameter. You can show it without animation and animate only the content. In case you're not happy with the dim background, under the hood it creates an android Dialog - you can copy source code to create your own dialog to provide your own theme as shown [here](https://stackoverflow.com/a/29482234/3585796) – Phil Dukhov Jun 07 '22 at 12:35
  • I see your point, the reason I am using dialog instead of a box is because I have a bottom nav xml view that is displayed on top of my composable screen and which I can't remove or replace with Compose. The dialog is drawn on top of everything so it fixes that issue but I still need to animate it, is there a way to do so even if it's not a composable animation? – barryalan2633 Jun 07 '22 at 13:14
  • 1
    Judging by this comment, it looks like you didn't read (or understand?) anything but the first sentence of my comment=) Move `AnimatedVisibility` inside `Dialog`, you probably have to do some trick like wait it to appear with animated visibility `visible = false` and then with `LaunchedEffect` update it to true. – Phil Dukhov Jun 07 '22 at 13:19

0 Answers0