diff --git a/flutter_hbb/lib/common.dart b/flutter_hbb/lib/common.dart index 55c65825b..2fe64bad8 100644 --- a/flutter_hbb/lib/common.dart +++ b/flutter_hbb/lib/common.dart @@ -45,7 +45,8 @@ Future showAlertDialog( BuildContext context, Tuple3> Function( void Function(void Function())) - build) async { + build, + {WillPopCallback onWillPop}) async { dismissLoading(); if (_hasDialog) { Navigator.pop(context); @@ -53,8 +54,9 @@ Future showAlertDialog( _hasDialog = true; var dialog = StatefulBuilder(builder: (context, setState) { var widgets = build(setState); + if (onWillPop == null) onWillPop = () async => false; return WillPopScope( - onWillPop: () async => false, + onWillPop: onWillPop, child: AlertDialog( title: widgets.item1, contentPadding: const EdgeInsets.all(20.0),