unBlock method

dynamic unBlock(
  1. Profile item,
  2. BuildContext context
)

Implementation

unBlock(Profile item, BuildContext context) {
  Helper.showAlert(message: "${AppConstants.unblock} ${getName(item)}?", actions: [
    TextButton(
        onPressed: () {
          // Get.back();
          Navigator.pop(context);
        },
        child: Text(AppConstants.no.toUpperCase(), style: TextStyle(color: MirrorflyUikit.getTheme?.primaryColor),)),
    TextButton(
        onPressed: () async {
          if (await AppUtils.isNetConnected()) {
            // Get.back();
            if(context.mounted)Navigator.pop(context);
            if(context.mounted)Helper.progressLoading(context: context);
            Mirrorfly.unblockUser(item.jid.checkNull()).then((value) {
              Helper.hideLoading(context: context);
              if (value != null && value) {
                toToast("${getName(item)} ${AppConstants.hasUnBlocked}");
                userUpdatedHisProfile(item.jid.checkNull());
              }
            }).catchError((error) {
              Helper.hideLoading(context: context);
              debugPrint(error);
            });
          } else {
            toToast(AppConstants.noInternetConnection);
          }
        },
        child: Text(AppConstants.yes.toUpperCase(), style: TextStyle(color: MirrorflyUikit.getTheme?.primaryColor))),
  ], context: context);
}