deleteComponent method

Widget deleteComponent(
  1. BuildContext context
)

Implementation

Widget deleteComponent(BuildContext context) {
  return Align(
    alignment: Alignment.center,
    child: TextButton(
      onPressed: () {
        showConfirmDialogCustom(
          context,
          negativeText: language.cancel,
          positiveText: language.delete,
          onAccept: (_) async {
            appStore.setLoading(true);

            await deleteAccountCompletely({UserKeys.userId: appStore.userId}).then((value) async {
              // await userService.removeDocument(appStore.uid);
              // await userService.deleteUser();
              await clearPreferences();
              appStore.setLoading(false);

              toast(value.message);

              push(SignInScreen(), isNewTask: true, pageRouteAnimation: PageRouteAnimation.Fade);
            }).catchError((e) {
              appStore.setLoading(false);
              toast(e.toString());
            });
          },
          dialogType: DialogType.DELETE,
          title: language.yourAccountWillBe,
        );
      },
      child: Text(
        language.deleteAccount,
        style: boldTextStyle(size: 16, color: redColor),
      ),
    ),
  );
}