showDeleteConfirmationDialog function
- BuildContext context,
- MarkerData marker
Shows a confirmation dialog for deleting a place.
Implementation
Future<bool> showDeleteConfirmationDialog(
BuildContext context,
MarkerData marker,
) async {
final confirmed = await showDialog<bool>(
context: context,
builder: (ctx) => AlertDialog(
title: const Text('Delete Place'),
content: SingleChildScrollView(
child: Text(
'Are you sure you want to delete "${marker.title}"?\n\n'
'This action cannot be undone.',
),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx, false),
child: const Text('Cancel'),
),
ElevatedButton(
onPressed: () => Navigator.pop(ctx, true),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
foregroundColor: Colors.white,
),
child: const Text('Delete'),
),
],
),
);
return confirmed == true;
}