showBlockStatusAlert method

dynamic showBlockStatusAlert(
  1. Function? function
)

Implementation

showBlockStatusAlert(Function? function) {
  DialogUtils.showAlert(
      dialogStyle: AppStyleConfig.dialogStyle,
      message: getTranslated("unBlockToSendMsg"),
      actions: [
        TextButton(
            style: AppStyleConfig.dialogStyle.buttonStyle,
            onPressed: () {
              NavUtils.back();
            },
            child: Text(
              getTranslated("cancel").toUpperCase(),
            )),
        TextButton(
            style: AppStyleConfig.dialogStyle.buttonStyle,
            onPressed: () async {
              NavUtils.back();
              Mirrorfly.unblockUser(
                  userJid: profile.jid!,
                  flyCallBack: (FlyResponse response) {
                    if (response.isSuccess) {
                      debugPrint(response.toString());
                      profile.isBlocked = false;
                      isBlocked(false);
                      DialogUtils.hideLoading();
                      toToast(getTranslated("hasUnBlocked")
                          .replaceFirst("%d", getName(profile)));
                      if (function != null) {
                        function();
                      }
                    }
                  });
            },
            child: Text(
              getTranslated("unblock").toUpperCase(),
            )),
      ]);
}