Hello, I have a question about animating dialogs. ...
# compose
c
Hello, I have a question about animating dialogs. in basic library, there's a dialog function. But it doesn't seem I can apply some animation when it opens. So, I created this function called
animatedDialog
. Is this normal way or does this have any problem or is there any better solution to solve this issue?
Copy code
fun NavGraphBuilder.animatedDialog(
    route: String,
    arguments: List<NamedNavArgument> = emptyList(),
    deepLinks: List<NavDeepLink> = emptyList(),
    enter: EnterTransition = fadeIn() + expandIn(),
    exit: ExitTransition = shrinkOut() + fadeOut(),
    dialogProperties: DialogProperties = DialogProperties(),
    content: @Composable (NavBackStackEntry) -> Unit
) {
    addDestination(
        Destination(
            provider[AnimatedDialogNavigator::class],
            enter = enter,
            exit = exit,
            dialogProperties,
            content
        ).apply {
            this.route = route
            arguments.forEach { (argumentName, argument) ->
                addArgument(argumentName, argument)
            }
            deepLinks.forEach { deepLink ->
                addDeepLink(deepLink)
            }
        }
    )
}