Respect allowCancel in dialog mode

This commit is contained in:
Dain Nilsson 2024-02-02 13:38:21 +01:00
parent 0e91d1c2f8
commit 688211ddf6
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8

View File

@ -76,6 +76,7 @@ class _ResponsiveDialogState extends State<ResponsiveDialog> {
? l10n.s_close
: l10n.s_cancel;
return PopScope(
canPop: widget.allowCancel,
child: AlertDialog(
title: widget.title,
titlePadding: const EdgeInsets.only(top: 24, left: 18, right: 18),
@ -87,10 +88,12 @@ class _ResponsiveDialogState extends State<ResponsiveDialog> {
),
actions: [
TextButton(
child: Text(cancelText),
onPressed: () {
onPressed: widget.allowCancel
? () {
Navigator.of(context).pop();
},
}
: null,
child: Text(cancelText),
),
...widget.actions
],