showReauthenticateDialog function

Future<bool> showReauthenticateDialog({
  1. required BuildContext context,
  2. required List<AuthProvider<AuthListener, AuthCredential>> providers,
  3. FirebaseAuth? auth,
  4. VoidCallback? onSignedIn,
  5. VoidCallback? onPhoneVerfifed,
  6. String? actionButtonLabelOverride,
})

Implementation

Future<bool> showReauthenticateDialog({
  required BuildContext context,

  /// A list of all supported auth providers
  required List<AuthProvider> providers,

  /// {@macro ui.auth.auth_controller.auth}
  fba.FirebaseAuth? auth,

  /// A callback that is being called after user has successfully signed in.
  VoidCallback? onSignedIn,

  /// {@macro ui.auth.views.reauthenticate_view.on_phone_verified}
  VoidCallback? onPhoneVerfifed,

  /// A label that would be used for the "Sign in" button.
  String? actionButtonLabelOverride,
}) async {
  final l = FirebaseUILocalizations.labelsOf(context);

  final reauthenticated = await showGeneralDialog<bool>(
    context: context,
    barrierDismissible: true,
    barrierLabel: l.cancelButtonLabel,
    pageBuilder: (_, __, ___) => FirebaseUIActions.inherit(
      from: context,
      child: ReauthenticateDialog(
        providers: providers,
        auth: auth,
        onSignedIn: onSignedIn ?? () => Navigator.of(context).pop(true),
        actionButtonLabelOverride: actionButtonLabelOverride,
        onPhoneVerfifed: onPhoneVerfifed,
      ),
    ),
  );

  if (reauthenticated == null) return false;
  return reauthenticated;
}