diff --git a/lib/pages/landing_page.dart b/lib/pages/landing_page.dart index 8ae45af..43d3d28 100644 --- a/lib/pages/landing_page.dart +++ b/lib/pages/landing_page.dart @@ -15,6 +15,7 @@ class LandingPage extends StatefulWidget { State createState() => _LandingPageState(); } +// uses mixin OverlayService to show loading overlay class _LandingPageState extends State with OverlayService { late FloodStationProvider floodStationProvider; @@ -37,8 +38,10 @@ class _LandingPageState extends State with OverlayService { ); } + // if the list of all Stations is empty the method returns a button to load them + // else returns a list of FloodStations Widget _buildStationList() { - if (!_shouldShowList()) { + if (!_shouldShowList) { return Expanded( child: Center( child: ElevatedButton( @@ -99,7 +102,9 @@ class _LandingPageState extends State with OverlayService { Navigator.of(context).pushNamed(FloodStationPage.routeName); } - bool _shouldShowList() { + // returns boolean to decide whether the list of stations should be shown + // if the list of stations is empty and is not filtered either, the function returns false + bool get _shouldShowList { if (!floodStationProvider.filtered && floodStationProvider.allStations.isNotEmpty) { return true;