@@ -63,6 +63,11 @@ class DeleteAccountButton extends StatefulWidget {
6363 /// {@endtemplate}
6464 final bool showDeleteConfirmationDialog;
6565
66+ /// {@template ui.auth.widgets.delete_account_button.delete_confirmation}
67+ /// A callback to replace the default account deletion modal.
68+ /// {@endtemplate}
69+ final Future <bool > Function (BuildContext context)? deleteConfirmation;
70+
6671 /// {@macro ui.auth.widgets.delete_account_button}
6772 const DeleteAccountButton ({
6873 super .key,
@@ -71,6 +76,7 @@ class DeleteAccountButton extends StatefulWidget {
7176 this .onDeleteFailed,
7277 this .variant = ButtonVariant .filled,
7378 this .showDeleteConfirmationDialog = false ,
79+ this .deleteConfirmation,
7480 });
7581
7682 @override
@@ -91,19 +97,23 @@ class _DeleteAccountButtonState extends State<DeleteAccountButton> {
9197 if (! confirmed) {
9298 final l = FirebaseUILocalizations .labelsOf (context);
9399
94- confirmed = await showCupertinoDialog <bool ?>(
95- context: context,
96- builder: (context) {
97- return UniversalAlert (
98- onConfirm: pop (context, true ),
99- onCancel: pop (context, false ),
100- title: l.confirmDeleteAccountAlertTitle,
101- confirmButtonText: l.confirmDeleteAccountButtonLabel,
102- cancelButtonText: l.cancelButtonLabel,
103- message: l.confirmDeleteAccountAlertMessage,
104- );
105- },
106- );
100+ if (widget.deleteConfirmation != null ) {
101+ confirmed = await widget.deleteConfirmation !(context);
102+ } else {
103+ confirmed = await showCupertinoDialog <bool ?>(
104+ context: context,
105+ builder: (context) {
106+ return UniversalAlert (
107+ onConfirm: pop (context, true ),
108+ onCancel: pop (context, false ),
109+ title: l.confirmDeleteAccountAlertTitle,
110+ confirmButtonText: l.confirmDeleteAccountButtonLabel,
111+ cancelButtonText: l.cancelButtonLabel,
112+ message: l.confirmDeleteAccountAlertMessage,
113+ );
114+ },
115+ );
116+ }
107117 }
108118
109119 if (! (confirmed ?? false )) return ;
0 commit comments