admin管理员组文章数量:1314514
So I'm trying to define BottomSheet as navigation routes using compose.material.navigation.bottomSheet
based on the example from official docs:
val bottomSheetNavigator = rememberBottomSheetNavigator()
val navController = rememberNavController(bottomSheetNavigator)
ModalBottomSheetLayout(bottomSheetNavigator) {
NavHost(navController, Destinations.Home) {
composable(Destinations.Home) {
HomeScreen(
showSheet = {
navController.navigate(Destinations.Sheet + "?arg=From Home Screen")
},
showFeed = { navController.navigate(Destinations.Feed) }
)
}
composable(Destinations.Feed) { Text("Feed!") }
bottomSheet(Destinations.Sheet + "?arg={arg}") { backstackEntry ->
val arg = backstackEntry.arguments?.getString("arg") ?: "Missing argument :("
BottomSheet(
showFeed = { navController.navigate(Destinations.Feed) },
showAnotherSheet = {
navController.navigate(Destinations.Sheet + "?arg=${UUID.randomUUID()}")
},
arg = arg
)
}
}
}
but it gives this warning
Using a material import while also using the material3 library
and I can't find out if such functionality available withing material3 libraries
So I'm trying to define BottomSheet as navigation routes using compose.material.navigation.bottomSheet
based on the example from official docs:
val bottomSheetNavigator = rememberBottomSheetNavigator()
val navController = rememberNavController(bottomSheetNavigator)
ModalBottomSheetLayout(bottomSheetNavigator) {
NavHost(navController, Destinations.Home) {
composable(Destinations.Home) {
HomeScreen(
showSheet = {
navController.navigate(Destinations.Sheet + "?arg=From Home Screen")
},
showFeed = { navController.navigate(Destinations.Feed) }
)
}
composable(Destinations.Feed) { Text("Feed!") }
bottomSheet(Destinations.Sheet + "?arg={arg}") { backstackEntry ->
val arg = backstackEntry.arguments?.getString("arg") ?: "Missing argument :("
BottomSheet(
showFeed = { navController.navigate(Destinations.Feed) },
showAnotherSheet = {
navController.navigate(Destinations.Sheet + "?arg=${UUID.randomUUID()}")
},
arg = arg
)
}
}
}
but it gives this warning
Using a material import while also using the material3 library
and I can't find out if such functionality available withing material3 libraries
Share Improve this question edited Jan 30 at 13:33 user924 asked Jan 30 at 13:13 user924user924 12.3k12 gold badges88 silver badges190 bronze badges2 Answers
Reset to default 1Please have a look at Ticket #328949006 at the Google Issue Tracker. It seems that this functionality is currently not supported with Material3
, but there are some alternatives:
- Library by Hrach on GitHub
- Library by EyGraber on GitHub
- Snippet by FlaringApp on GitHub (only supports navigating to one
BottomSheet
at a time)
You can star the issue in the Issue Tracker and leave a comment to draw more attention to it.
This just means you are mixing Material2 and Material3 components.
本文标签:
版权声明:本文标题:android - compose.material.navigation.bottomSheet - "Using a material import while also using the material3 library& 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741962835a2407381.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论