DeleteAccount constructor

DeleteAccount({
  1. required Widget child,
  2. required void onAccountDeleted(),
})

Wrap child in a Gesture Detector that on tap will show a confirmation dialog to delete the user's account Note that any Pointer Events will be absorbed by this widget and custom gestures are not possible with child onAccountDeleted will be called if the user's account was deleted successfully

Implementation

factory DeleteAccount({
  required Widget child,
  required void Function() onAccountDeleted,
}) {
  final key = GlobalKey<DeleteAccountState>();
  return DeleteAccount._(
    key: key,
    onAccountDeleted: onAccountDeleted,
    child: Builder(
      builder: (context) {
        return GestureDetector(
          onTap: () {
            key.currentState?.showConfirmationDialog(context);
          },
          child: AbsorbPointer(child: child),
        );
      },
    ),
  );
}