我的 showModalBottomSheet 内的小部件是一个文本字段,用户必须填写正确的值才能继续下一个功能,我知道有一个名为 的现成参数isDismissible
,但是它只能禁用粘贴背景,它不能禁用 android 返回。
return showModalBottomSheet(
context: context,
builder: (BuildContext context) {
...
}
}
Run Code Online (Sandbox Code Playgroud)
小智 5
你可以用以下方式包装你的小部件WillPopScope
例如:
WillPopScope(
onWillPop: () async => false,
)
Run Code Online (Sandbox Code Playgroud)