make onWillPop can be changed
This commit is contained in:
parent
e516dd3267
commit
a7c4396c71
@ -45,7 +45,8 @@ Future<Null> showAlertDialog(
|
|||||||
BuildContext context,
|
BuildContext context,
|
||||||
Tuple3<Widget, Widget, List<Widget>> Function(
|
Tuple3<Widget, Widget, List<Widget>> Function(
|
||||||
void Function(void Function()))
|
void Function(void Function()))
|
||||||
build) async {
|
build,
|
||||||
|
{WillPopCallback onWillPop}) async {
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
if (_hasDialog) {
|
if (_hasDialog) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@ -53,8 +54,9 @@ Future<Null> showAlertDialog(
|
|||||||
_hasDialog = true;
|
_hasDialog = true;
|
||||||
var dialog = StatefulBuilder(builder: (context, setState) {
|
var dialog = StatefulBuilder(builder: (context, setState) {
|
||||||
var widgets = build(setState);
|
var widgets = build(setState);
|
||||||
|
if (onWillPop == null) onWillPop = () async => false;
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async => false,
|
onWillPop: onWillPop,
|
||||||
child: AlertDialog(
|
child: AlertDialog(
|
||||||
title: widgets.item1,
|
title: widgets.item1,
|
||||||
contentPadding: const EdgeInsets.all(20.0),
|
contentPadding: const EdgeInsets.all(20.0),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user