handleRefreshPressed method
Handle refresh button tap - reload places and show success message.
Implementation
Future<void> handleRefreshPressed() async {
if (isLoadingPlaces) return;
try {
await loadAllPlaces();
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Refreshed successfully! ${allPlaces.length} places loaded',
),
duration: const Duration(seconds: 2),
backgroundColor: Colors.green,
),
);
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Refresh failed: $e'),
duration: const Duration(seconds: 3),
),
);
}
}
}