statusDeleteConfirmation method
void
statusDeleteConfirmation(
- StatusData item,
- BuildContext context
)
Implementation
void statusDeleteConfirmation(StatusData item, BuildContext context) {
Helper.showAlert(
message: AppConstants.deleteStatus,
actions: [
TextButton(
onPressed: () {
// Get.back();
Navigator.pop(context);
},
child: Text(AppConstants.no)),
TextButton(
onPressed: () async {
if (await AppUtils.isNetConnected()) {
// Get.back();
if (context.mounted) Navigator.pop(context);
if (context.mounted) {
Helper.showLoading(
message: AppConstants.deletingStatus,
buildContext: context);
} else {
mirrorFlyLog("Status Controller", "Context is not mounted");
}
Mirrorfly.deleteProfileStatus(
id: item.id!,
status: item.status!,
isCurrentStatus: item.isCurrentStatus!)
.then((value) {
statusList.remove(item);
// Helper.hideLoading();
Navigator.pop(context);
}).catchError((error) {
// Helper.hideLoading();
Navigator.pop(context);
toToast(AppConstants.unableToDeleteProfileStatus);
});
} else {
toToast(AppConstants.noInternetConnection);
}
},
child: Text(AppConstants.yes)),
],
context: context);
}