Jetpack Compose 底部工作表暗淡阴影不可见

Deh*_*ara 7 android kotlin bottom-sheet android-jetpack-compose

我在 jetpack compose 中创建了一个底部工作表。但是,当底部工作表展开时,背景之外的底部工作表不会像通常的底部工作表那样变暗。请帮忙。

MyApplicationTestTheme {
    ProvideWindowInsets {
        BottomSheetScaffold(
            scaffoldState = bottomSheetScaffoldState,
            sheetShape = RoundedCornerShape(topStart = 30.dp,topEnd = 30.dp),
            sheetElevation= 5.dp,
            modifier=Modifier.fillMaxHeight(0.95f).fillMaxWidth(),
            sheetBackgroundColor=Color.Green,
            sheetContent = {
                //Bottom sheet content
            }, sheetPeekHeight = 0.dp
        ) {
         // Page Content
        }
   }
}
Run Code Online (Sandbox Code Playgroud)

Thr*_*ian 4

底部工作表没有默认的暗淡功能。

您可以使用ModalBottomSheetLayout, 或BottomDrawer来达到这种效果。但这些布局都没有窥视高度,只有展开状态。

    ModalBottomSheetLayout(
        sheetState = modalBottomSheetState,
        sheetElevation = 8.dp,
        sheetContent = {
            SheetContent()
        }
    ) {
        MainContent(modalBottomSheetState)
    }
Run Code Online (Sandbox Code Playgroud)

或者

    val drawerState = rememberBottomDrawerState(BottomDrawerValue.Closed)

    BottomDrawer(
        gesturesEnabled = gesturesEnabled,
        drawerState = drawerState,
        drawerContent = {

        },
        content = {
   
        }
    )
Run Code Online (Sandbox Code Playgroud)