unBlockUser method

dynamic unBlockUser(
  1. BuildContext context
)

Implementation

unBlockUser(BuildContext context) {
  Future.delayed(const Duration(milliseconds: 100), () {
    Helper.showAlert(
        message: "${AppConstants.unblock} ${profile.getName()}?",
        actions: [
          TextButton(
              onPressed: () {
                // Get.back();
                Navigator.pop(context);
              },
              child: Text(
                AppConstants.cancel.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.showLoading(
                        message: AppConstants.unblockingUser,
                        buildContext: context);
                    Mirrorfly.unblockUser(
                        userJid: profile.jid!,
                        flyCallBack: (FlyResponse response) {
                          debugPrint(response.toString());
                          profile.isBlocked = false;
                          isBlocked(false);
                          getUnsentMessageOfAJid();
                          Helper.hideLoading(context: context);
                          toToast(
                              '${profile.getName()} ${AppConstants.hasUnBlocked}');
                        });
                  }
                } else {
                  toToast(AppConstants.noInternetConnection);
                }
              },
              child: Text(
                AppConstants.unblock.toUpperCase(),
                style:
                    TextStyle(color: MirrorflyUikit.getTheme?.primaryColor),
              )),
        ],
        context: context);
  });
}