如何在flutter中设置showModalBottomSheet宽度

anw*_*war 4 menu widget button flutter flutter-layout

我有设计(如图所示)并且正在使用 showModalBottomSheet 但是当我设置宽度时,它不会改变并保持屏幕宽度,所以我有几个问题:

1-如何设置 showModalBottomSheet 的宽度
2-对于这种底部菜单,是否有 showModalBottomSheet 的替代方案
3-如何模糊照片中显示的背景

showModalBottomSheet<void>(
          context: context,
          builder: (BuildContext context) {
            return Container(
              height: SizeConfig.screenHeight * 0.6,
              width: 30,
              color: Colors.red,
              child: Center(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    const Text('Modal BottomSheet'),
                    ElevatedButton(
                      child: const Text('Close BottomSheet'),
                      onPressed: () => Navigator.pop(context),
                    )
                  ],
                ),
              ),
            );
          },
        );
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

小智 7

使用 showModalBottomSheet 中的约束属性。

 showModalBottomSheet(
    context: context,
    constraints: BoxConstraints(
      maxWidth:  600,              
    ),
    builder: ...
  ),
Run Code Online (Sandbox Code Playgroud)