DeleteAccount.textButton constructor

DeleteAccount.textButton({
  1. required void onAccountDeleted(),
})

A TextButton that on tap will show a confirmation dialog to delete the user's account onAccountDeleted will be called if the user's account was deleted successfully

Implementation

factory DeleteAccount.textButton({
  required void Function() onAccountDeleted,
}) {
  final key = GlobalKey<DeleteAccountState>();
  return DeleteAccount._(
    key: key,
    onAccountDeleted: onAccountDeleted,
    child: Builder(
      builder: (context) {
        return TextButton(
          onPressed: () => key.currentState?.showConfirmationDialog(context),
          child: Text(
            ApptiveGridUserManagementLocalization.of(context)!.deleteAccount,
            style: TextStyle(
              color: Theme.of(context).colorScheme.error,
            ),
          ),
        );
      },
    ),
  );
}