busyDeleteConfirmation method

void busyDeleteConfirmation(
  1. StatusData item,
  2. BuildContext context
)

Implementation

void busyDeleteConfirmation(StatusData item, BuildContext context) {
  Helper.showAlert(
      message: AppConstants.youWantDeleteStatus,
      actions: [
        TextButton(
            onPressed: () {
              // Get.back();
              Navigator.pop(context);
            },
            child: Text(AppConstants.no,
                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.deletingBusyStatus,
                      buildContext: context);
                }
                Mirrorfly.deleteBusyStatus(
                        id: item.id!,
                        status: item.status!,
                        isCurrentStatus: item.isCurrentStatus!)
                    .then((value) {
                  busyStatusList.remove(item);
                  Helper.hideLoading(context: context);
                }).catchError((error) {
                  Helper.hideLoading(context: context);
                  toToast(AppConstants.unableDeleteBusyStatus);
                });
              } else {
                toToast(AppConstants.noInternetConnection);
              }
            },
            child: Text(AppConstants.yes,
                style:
                    TextStyle(color: MirrorflyUikit.getTheme?.primaryColor))),
      ],
      context: context);
}