diff --git a/CHANGELOG.md b/CHANGELOG.md index 031d4f8..1dc26f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.0.3 + +* Adds `trackingMode` to Apple Maps +* Adds `liteModeEnabled` to Google Maps +* Adds `mapToolbarEnabled` to Google Maps + ## 1.0.2 * Updates apple_maps_flutter to apply memory leak fix diff --git a/lib/src/platform_maps.dart b/lib/src/platform_maps.dart index 860ed81..60c995f 100644 --- a/lib/src/platform_maps.dart +++ b/lib/src/platform_maps.dart @@ -12,6 +12,9 @@ class PlatformMap extends StatefulWidget { this.gestureRecognizers = const >{}, this.compassEnabled = true, this.mapType = MapType.normal, + this.liteModeEnabled = false, + this.trackingMode = TrackingMode.none, + this.mapToolbarEnabled = true, this.minMaxZoomPreference = MinMaxZoomPreference.unbounded, this.rotateGesturesEnabled = true, this.scrollGesturesEnabled = true, @@ -47,6 +50,17 @@ class PlatformMap extends StatefulWidget { /// Type of map tiles to be rendered. final MapType mapType; + /// True if the map view should be in lite mode. Google Maps only. + /// + /// See https://developers.google.com/maps/documentation/android-sdk/lite#overview_of_lite_mode for more details. + final bool liteModeEnabled; + + /// The mode used to track the user location. Apple maps only. + final TrackingMode trackingMode; + + /// True if the toolbar for google maps should show. + final bool mapToolbarEnabled; + /// Preferred bounds for the camera zoom level. /// /// Actual bounds depend on map data and device. @@ -191,6 +205,7 @@ class _PlatformMapState extends State { zoomControlsEnabled: widget.zoomControlsEnabled, zoomGesturesEnabled: widget.zoomGesturesEnabled, scrollGesturesEnabled: widget.scrollGesturesEnabled, + liteModeEnabled: widget.liteModeEnabled, onMapCreated: _onMapCreated, onCameraMove: _onCameraMove, onTap: _onTap, @@ -198,6 +213,7 @@ class _PlatformMapState extends State { trafficEnabled: widget.trafficEnabled, minMaxZoomPreference: widget.minMaxZoomPreference.googleMapsZoomPreference, + mapToolbarEnabled: widget.mapToolbarEnabled, ); } else if (Platform.isIOS) { return appleMaps.AppleMap( @@ -214,6 +230,7 @@ class _PlatformMapState extends State { onCameraIdle: widget.onCameraIdle, myLocationButtonEnabled: widget.myLocationButtonEnabled, myLocationEnabled: widget.myLocationEnabled, + trackingMode: _getAppleMapTrackingMode(), onCameraMoveStarted: widget.onCameraMoveStarted, pitchGesturesEnabled: widget.tiltGesturesEnabled, rotateGesturesEnabled: widget.rotateGesturesEnabled, @@ -292,4 +309,15 @@ class _PlatformMapState extends State { } return googleMaps.MapType.normal; } + + appleMaps.TrackingMode _getAppleMapTrackingMode() { + if (widget.trackingMode == TrackingMode.none) { + return appleMaps.TrackingMode.none; + } else if (widget.trackingMode == TrackingMode.follow) { + return appleMaps.TrackingMode.follow; + } else if (widget.trackingMode == TrackingMode.followWithHeading) { + return appleMaps.TrackingMode.followWithHeading; + } + return appleMaps.TrackingMode.none; + } } diff --git a/lib/src/ui.dart b/lib/src/ui.dart index 815c228..bc5c7b5 100644 --- a/lib/src/ui.dart +++ b/lib/src/ui.dart @@ -16,6 +16,17 @@ enum MapType { hybrid, } +enum TrackingMode { + // the user's location is not followed + none, + + // the map follows the user's location + follow, + + // the map follows the user's location and heading + followWithHeading, +} + // Used with [PlatformMapOptions] to wrap min and max zoom. This allows // distinguishing between specifying unbounded zooming (null `minZoom` and // `maxZoom`) from not specifying anything (null `MinMaxZoomPreference`). diff --git a/pubspec.yaml b/pubspec.yaml index 123d161..2ac7c19 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: platform_maps_flutter description: A Flutter package that combines google_maps and apple_maps to provide a crossplatform native map implementation. -version: 1.0.2 +version: 1.0.3 homepage: https://github.com/LuisThein repository: https://github.com/LuisThein/platform_maps_flutter issue_tracker: https://github.com/LuisThein/platform_maps_flutter/issues