0

我想用我的菜单图标和底部工作表显示底部栏,从底部栏的末尾开始。

我也在使用伴奏导航库

@Composable
fun AppRouter() {
    val navController = rememberNavController()
    val bottomSheetNavigator = rememberFullScreenBottomSheetNavigator()
    navController.navigatorProvider += bottomSheetNavigator

    TriumfTaxiTheme {
        ModalBottomSheetLayout(
            bottomSheetNavigator = bottomSheetNavigator
        ) {
            Scaffold(
                content = {
                    Box(modifier = Modifier.padding(it)) {
                        NavHost(
                            navController = navController,
                            startDestination = BottomNavScreenDestinations.BottomNavMap.route
                        ) {
                            composable(route = BottomNavScreenDestinations.BottomNavMap.route) {
                                Home()
                            }
                            
                        }
                    }
                },
                bottomBar = {
                    BuildBottomBar(navController)
                }
            )
        }
    }
}

如果我添加 bottomsheet(route="something") 它显示底部表但在我的底部栏图标上方

这是我的底部工作表导航器


@ExperimentalMaterialNavigationApi
@ExperimentalMaterialApi
@Composable
fun rememberFullScreenBottomSheetNavigator(
    animationSpec: AnimationSpec<Float> = SwipeableDefaults.AnimationSpec,
    skipHalfExpanded: Boolean = true,
): BottomSheetNavigator {
    val sheetState = rememberModalBottomSheetState(
        ModalBottomSheetValue.Hidden,
        animationSpec
    )
    if (skipHalfExpanded) {
        LaunchedEffect(sheetState) {
            snapshotFlow { sheetState.isAnimationRunning }
                .collect {
                    with(sheetState) {
                        val isOpening =
                            currentValue == ModalBottomSheetValue.Hidden && targetValue == ModalBottomSheetValue.HalfExpanded
                        val isClosing =
                            currentValue == ModalBottomSheetValue.Expanded && targetValue == ModalBottomSheetValue.HalfExpanded
                        when {
                            isOpening -> animateTo(ModalBottomSheetValue.Expanded)
                            isClosing -> animateTo(ModalBottomSheetValue.Hidden)
                        }
                    }
                }
        }
    }
    return remember(sheetState) {
        BottomSheetNavigator(sheetState = sheetState)
    }
}

我想知道如何将底部表放在底部栏上方并自定义其 peekheight()

4

0 回答 0