有时候我们要禁止 Flutter 返回键或者返回手势取消弹窗,解决办法就是使用 WillPopScope
showDialog( context: context, barrierDismissible: false, builder: (BuildContext context) { return WillPopScope( onWillPop: () async => false, child: AlertDialog( title: Text('Title'), content: Text('This is Demo'), actions: <Widget>[ FlatButton( onPressed: () => Navigator.pop(context), child: Text('Go Back'), ), ], ), ); }, );
`
目前尚无回复