showBlockStatusAlert method

dynamic showBlockStatusAlert(
  1. Function? function,
  2. BuildContext context
)

Implementation

showBlockStatusAlert(Function? function, BuildContext context) {
  Helper.showAlert(
      message: AppConstants.unBlockMsg,
      actions: [
        TextButton(
            onPressed: () {
              // Get.back();
              Navigator.pop(context);
            },
            child: Text(AppConstants.cancel,
                style:
                    TextStyle(color: MirrorflyUikit.getTheme?.primaryColor))),
        TextButton(
          onPressed: () async {
            // Get.back();
            Navigator.pop(context);
            Mirrorfly.unblockUser(
                userJid: profile.jid!,
                flyCallBack: (FlyResponse response) {
                  if (response.isSuccess) {
                    // debugPrint(response.toString());
                    profile.isBlocked = false;
                    isBlocked(false);
                    Helper.hideLoading(context: context);
                    toToast(
                        '${getName(profile)} ${AppConstants.hasUnBlocked}');
                    if (function != null) {
                      function();
                    }
                  }
                });
          },
          child: Text(AppConstants.unblock,
              style: TextStyle(color: MirrorflyUikit.getTheme?.primaryColor)),
        ),
      ],
      context: context);
}