sbb_maps_flutter 2.4.0 copy "sbb_maps_flutter: ^2.4.0" to clipboard
sbb_maps_flutter: ^2.4.0 copied to clipboard

Incorporate SBB styled maps into your flutter application based on Maplibre.

example/example.md

Simple Map #

class StandardMapRoute extends StatelessWidget {
  const StandardMapRoute({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: const SBBHeader(title: 'Standard'),
      body: SBBMap(
        isMyLocationEnabled: true,
        mapStyler: SBBRokasMapStyler.full(), // API key in ENV var 'JOURNEY_MAPS_TILES_API_KEY'
      ),
    );
  }
}

Focus map on device position after build #

Allows focusing the map directly on device position after the widget is built. To use a lower zoom level, add an initialCameraPosition.

const _bern = SBBCameraPosition(target: LatLng(46.947456, 7.451123), zoom: 13.0)

class StandardMapRoute extends StatelessWidget {
  const StandardMapRoute({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: const SBBHeader(title: 'Standard'),
      body: SBBMap(
        isMyLocationEnabled: true,
        mapStyler: SBBRokasMapStyler.full(), // API key in ENV var 'JOURNEY_MAPS_TILES_API_KEY'
        initialCameraPosition: _bern, // specifying this will have the map on a smaller zoom level from beginning
        onMapLocatorAvailable: (locator) => locator.trackDeviceLocation(),
      ),
    );
  }
}
5
likes
145
points
121
downloads

Publisher

verified publishersbb.ch

Weekly Downloads

Incorporate SBB styled maps into your flutter application based on Maplibre.

Repository (GitHub)
View/report issues
Contributing

Topics

#map #maps #maplibre

Documentation

API reference

License

MIT (license)

Dependencies

collection, flutter, geolocator, logger, maplibre_gl

More

Packages that depend on sbb_maps_flutter