是否可以防止ModalBottomSheet
遮挡外界触摸?像在showDialog()
中一样,我们可以使用 barrierDismissible
property to prevent dialog from closing on outside touch
答案 0 :(得分:1)
您需要使用showBottomSheet()
(它不包含障碍)来代替showModalBottomSheet()
。
更多信息here
答案 1 :(得分:0)
答案 2 :(得分:0)
在showModalBottomSheet内部尝试设置isDismissible为false
showModalBottomSheet(
isDismissible: false,
context: context,
builder: (BuildContext bc) {
return SheetWidget();
},
);
其中SheetWidget是您要称为BottomSheet的小部件
答案 3 :(得分:0)
您可以像这样使用isDismissible: false
和enableDrag: false
showModalBottomSheet(
isDismissible: false,
enableDrag: false,
builder: (context) {
return Container(
height: 100.0
)
}
);