barrierDismissible and onWillPop

This commit is contained in:
rustdesk 2022-03-24 21:23:22 +08:00
parent 61722f5b8e
commit 9dadd76a8d
2 changed files with 60 additions and 64 deletions

View File

@ -59,7 +59,7 @@ class DialogManager {
static void reset([result]) { static void reset([result]) {
if (_dialogContext != null) { if (_dialogContext != null) {
Navigator.pop(_dialogContext!,result); Navigator.pop(_dialogContext!, result);
} }
_dialogContext = null; _dialogContext = null;
} }
@ -83,7 +83,7 @@ class DialogManager {
builder: (context) { builder: (context) {
DialogManager.register(context); DialogManager.register(context);
return StatefulBuilder( return StatefulBuilder(
builder: (_, setState) => builder(setState,DialogManager.reset)); builder: (_, setState) => builder(setState, DialogManager.reset));
}); });
DialogManager.drop(); DialogManager.drop();
return res; return res;

View File

@ -135,8 +135,12 @@ void showServer() {
}, },
child: Text(translate('OK')), child: Text(translate('OK')),
), ),
]); ],
}); onWillPop: () async {
return true;
},
);
}, barrierDismissible: true);
} }
String? validate(value) { String? validate(value) {
@ -169,18 +173,10 @@ void showAbout() {
)), )),
)), )),
]), ]),
actions: [ actions: [],
TextButton(
style: flatButtonStyle,
onPressed: () {
close();
},
child: Text(translate('OK')),
)
],
onWillPop: () async { onWillPop: () async {
return true; return true;
}, },
); );
}); }, barrierDismissible: true);
} }