We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
过去的旧版本使用全局 Dialog 与全局 BottomSheetDialog 的方式,这导致了许多问题:
考虑到目前 Navigation 均使用了自己封装了一层的 animateCompose 方法,可以在该方法中使用 CompositionLocalProvider 提供 LocalDialog 与 LocalBottomSheetDialog,实现其每个页面的弹窗独立化,不再置于全局顶部
animateCompose
CompositionLocalProvider
LocalDialog
LocalBottomSheetDialog
考虑修改以下代码
https://github.com/BingyanStudio/BBHustAndroid/blob/648c7f8311d942389d867a8cc27df6c560cb4e05/app/src/main/java/com/bingyan/bbhust/AppNav.kt#L72-L96
为:
@OptIn(ExperimentalAnimationApi::class) fun NavGraphBuilder.animateCompose( route: String, arguments: List<NamedNavArgument> = emptyList(), deepLinks: List<NavDeepLink> = emptyList(), content: @Composable AnimatedVisibilityScope.(NavBackStackEntry) -> Unit ) = composable( route, enterTransition = { slideInHorizontally(initialOffsetX = { it }, animationSpec = animation) }, exitTransition = { slideOutHorizontally(targetOffsetX = { -it / 2 }, animationSpec = animation) }, popEnterTransition = { slideInHorizontally(initialOffsetX = { -it / 2 }, animationSpec = animation) }, popExitTransition = { slideOutHorizontally(targetOffsetX = { it }, animationSpec = animation) }, arguments = arguments, deepLinks = deepLinks, content = { + // Wrap it with Dialog & BottomSheetDialog content(it) + // Wrap it with Dialog & BottomSheetDialog } )
The text was updated successfully, but these errors were encountered:
foggyww
No branches or pull requests
问题
过去的旧版本使用全局 Dialog 与全局 BottomSheetDialog 的方式,这导致了许多问题:
解决方案
考虑到目前 Navigation 均使用了自己封装了一层的
animateCompose
方法,可以在该方法中使用CompositionLocalProvider
提供LocalDialog
与LocalBottomSheetDialog
,实现其每个页面的弹窗独立化,不再置于全局顶部考虑修改以下代码
https://github.com/BingyanStudio/BBHustAndroid/blob/648c7f8311d942389d867a8cc27df6c560cb4e05/app/src/main/java/com/bingyan/bbhust/AppNav.kt#L72-L96
为:
The text was updated successfully, but these errors were encountered: