Skip to content

nearby stations in search#8

Open
frephs wants to merge 1 commit into
c0c4i:developmentfrom
frephs:frephs/feature/nearby-stations
Open

nearby stations in search#8
frephs wants to merge 1 commit into
c0c4i:developmentfrom
frephs:frephs/feature/nearby-stations

Conversation

@frephs
Copy link
Copy Markdown

@frephs frephs commented May 8, 2026

This pull request introduces a "Nearby Stations" feature, allowing users to see train stations closest to their current location. It includes new location permissions, a on-device station database with server sync and caching, UI integration in the station picker dialog, and all supporting utilities.

Nearby stations feature and infrastructure:

  • Added NearbyStationsService for fetching, caching, and syncing station data with the server, including fallback to bundled JSON and on-device distance calculation using the Haversine formula (lib/utils/nearby_stations_service.dart, lib/utils/endpoint.dart, lib/utils/shared_preference.dart) [1] [2] [3] [4].
  • Implemented LocationService for requesting and checking location permissions and retrieving the user's position (lib/utils/location_service.dart).
  • Added location permissions to AndroidManifest.xml and updated dependencies to include geolocator (android/app/src/main/AndroidManifest.xml, pubspec.yaml) [1] [2].

State management and UI integration:

  • Introduced NearbyStationsCubit and related states for managing nearby stations loading and error handling (lib/cubit/nearby_stations.dart).
  • Integrated the nearby stations list into the station picker dialog UI, including a new NearbyStationsList widget and logic to display it when the search field is empty (lib/view/components/dialog/station_picker.dart, lib/view/components/stations/nearby_stations_list.dart) [1] [2] [3] [4].

Other changes and improvements:

  • Improved the saved stations list UI with an icon for clarity (lib/view/components/stations/saved_stations_list.dart).
  • Removed a debug print statement from the Strike model (lib/model/Strike.dart).
  • Ensured proper initialization of the new service at app startup (lib/main.dart) [1] [2].

These changes together provide users with a seamless way to quickly select nearby stations, with robust handling for offline use and location permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant