Код: Выделить всё
@Composable
fun NavGraph (
navController: NavHostController
) {
NavHost(
navController = navController,
startDestination = "Products"
) {
composable(
route = "Products"
) {
ProductsScreen(
navController = navController
)
}
composable(
route = "Product Details",
arguments = listOf(
navArgument("product") {
type = NavType.SerializableType(Product::class.java)
}
)
) {
val product = navController.previousBackStackEntry?.arguments?.getSerializable("product") as Product
ProductDetailsScreen(
navController = navController,
product = product
)
}
}
}
< /code>
Внутри продукта letailsscreen я хочу, чтобы в продукте нажмите, чтобы навигаровать дальше, чтобы получить подробную информацию. Экран Пропустить объект продукта: < /p>
LazyColumn {
items(
items = products
) { product ->
ProductCard(
product = product,
onProductClick = {
navController.currentBackStackEntry?.arguments?.putSerializable("product", product)
navController.navigate("Product Details")
}
)
}
}
p> Java.lang.illegalargumentExcept График NavGraph (0x0) startDestination = {destination (0xb543811) route = products} < /p>
< /blockquote>
может кто -нибудь помочь? < /p>
p.s. Я также следил за этим ответом, но не повезло: (
Подробнее здесь: https://stackoverflow.com/questions/706 ... be-found-i
Мобильная версия