fun Main()

in MotionCompose/app/src/main/java/com/example/android/compose/motion/ui/Main.kt [31:51]


fun Main() {
    ProvideWindowInsets {
        MotionComposeTheme {
            var currentDemo: Demo? by rememberSaveable {
                mutableStateOf(null)
            }
            Crossfade(targetState = currentDemo) { targetDemo ->
                if (targetDemo == null) {
                    Home(
                        onDemoSelected = { demo ->
                            currentDemo = demo
                        }
                    )
                } else {
                    targetDemo.content()
                    BackHandler { currentDemo = null }
                }
            }
        }
    }
}