confirmAndDeletePlace method
- Place place
Confirm and delete a place.
Implementation
Future<void> confirmAndDeletePlace(Place place) async {
if (!mounted) return;
final confirmed = await DialogHelper.showConfirmation(
context,
title: 'Delete Place',
content: 'Are you sure you want to delete "${place.displayTitle}"?',
confirmText: 'Delete',
);
if (!confirmed || !mounted) return;
try {
final success = await PlacesService.deletePlace(
place.id,
context,
widget,
);
if (!mounted) return;
if (success) {
SnackBarHelper.showSuccess(context, 'Place deleted successfully');
} else {
SnackBarHelper.showError(context, 'Failed to delete place');
}
} catch (e) {
if (!mounted) return;
SnackBarHelper.showError(context, 'Failed to delete place: $e');
}
}