Simple NavigationBar and placeholder map view

This commit is contained in:
2025-01-28 15:23:16 +01:00
parent 36dec2d0de
commit 9c9992919d
5 changed files with 95 additions and 47 deletions

View File

@@ -10,8 +10,6 @@ import 'flood_station_page.dart';
class LandingPage extends StatefulWidget {
const LandingPage({super.key});
static const routeName = '/';
@override
State<LandingPage> createState() => _LandingPageState();
}
@@ -24,52 +22,48 @@ class _LandingPageState extends State<LandingPage> {
@override
Widget build(BuildContext context) {
floodStationProvider = context.watch<FloodStationProvider>();
return Scaffold(
body: Column(
children: [
StationFilter(
onChanged: (filterText) {
if (filterText.isEmpty) {
floodStationProvider.filtered = false;
setState(() {});
return;
}
showLoadingNotifier(context: context, message: 'Loading');
floodStationProvider.loadFilteredStations(filterText);
floodStationProvider.filteredStationsFuture
?.then((_) => removeLoadingNotifier());
floodStationProvider.filtered = true;
},
),
_shouldShowList()
? Expanded(
child: FloodStationListView(
stations: floodStationProvider.filtered
? floodStationProvider.filteredStations
: floodStationProvider.allStations,
onItemTapped: (station) {
floodStationProvider.selectedStation = station;
Navigator.of(context)
.pushNamed(FloodStationPage.routeName);
return Column(
children: [
StationFilter(
onChanged: (filterText) {
if (filterText.isEmpty) {
floodStationProvider.filtered = false;
setState(() {});
return;
}
showLoadingNotifier(context: context, message: 'Loading');
floodStationProvider.loadFilteredStations(filterText);
floodStationProvider.filteredStationsFuture
?.then((_) => removeLoadingNotifier());
floodStationProvider.filtered = true;
},
),
_shouldShowList()
? Expanded(
child: FloodStationListView(
stations: floodStationProvider.filtered
? floodStationProvider.filteredStations
: floodStationProvider.allStations,
onItemTapped: (station) {
floodStationProvider.selectedStation = station;
Navigator.of(context).pushNamed(FloodStationPage.routeName);
},
),
)
: Expanded(
child: Center(
child: ElevatedButton(
onPressed: () {
showLoadingNotifier(context: context, message: 'Loading');
floodStationProvider
.loadAllStations()
.whenComplete(() => removeLoadingNotifier());
},
),
)
: Expanded(
child: Center(
child: ElevatedButton(
onPressed: () {
showLoadingNotifier(
context: context, message: 'Loading');
floodStationProvider
.loadAllStations()
.whenComplete(() => removeLoadingNotifier());
},
child: Text('Load all Stations'),
),
child: Text('Load all Stations'),
),
),
],
),
),
],
);
}