showDeletePlacesConfirmation function

Future<bool> showDeletePlacesConfirmation(
  1. BuildContext context
)

Show confirmation dialog for deleting the main places.json file.

Implementation

Future<bool> showDeletePlacesConfirmation(BuildContext context) async {
  return await showDialog<bool>(
        context: context,
        builder: (context) => AlertDialog(
          title: const Text('Delete All Places?'),
          content: const Text(
            'This will delete all your saved places data, including the main '
            'places.json file and all individual place files.\n\n'
            'This action cannot be undone.',
          ),
          actions: [
            TextButton(
              onPressed: () => Navigator.of(context).pop(false),
              child: const Text('Cancel'),
            ),
            TextButton(
              onPressed: () => Navigator.of(context).pop(true),
              style: TextButton.styleFrom(foregroundColor: Colors.red),
              child: const Text('Delete All'),
            ),
          ],
        ),
      ) ??
      false;
}