diff --git a/.gitignore b/.gitignore index 1dbd46e..cb6b470 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/ diff --git a/packages/platform_maps_flutter/pubspec.yaml b/packages/platform_maps_flutter/pubspec.yaml index b842dd7..ecc0d9e 100644 --- a/packages/platform_maps_flutter/pubspec.yaml +++ b/packages/platform_maps_flutter/pubspec.yaml @@ -16,6 +16,8 @@ flutter: default_package: platform_maps_flutter_google_android ios: default_package: platform_maps_flutter_apple + web: + default_package: platform_maps_flutter_google_android dependencies: flutter: diff --git a/packages/platform_maps_flutter_apple/lib/src/apple_maps_widget.dart b/packages/platform_maps_flutter_apple/lib/src/apple_maps_widget.dart index 8eaa7f8..f8aa395 100644 --- a/packages/platform_maps_flutter_apple/lib/src/apple_maps_widget.dart +++ b/packages/platform_maps_flutter_apple/lib/src/apple_maps_widget.dart @@ -36,6 +36,9 @@ class _PlatformMap extends StatefulWidget { /// Type of map tiles to be rendered. MapType get mapType => params.mapType; + /// The colorscheme to be used for the map. + MapColorScheme get mapColorScheme => params.mapColorScheme; + /// Preferred bounds for the camera zoom level. /// /// Actual bounds depend on map data and device. @@ -142,6 +145,11 @@ class _PlatformMap extends StatefulWidget { /// Enables or disables the traffic layer of the map bool get trafficEnabled => params.trafficEnabled; + /// A Boolean value indicating whether the view's layout margins are updated + /// automatically to reflect the safe area. + bool get insetsLayoutMarginsFromSafeArea => + params.insetsLayoutMarginsFromSafeArea; + /// Which gestures should be consumed by the map. /// /// It is possible for other gesture recognizers to be competing with the map on pointer @@ -165,6 +173,7 @@ class _PlatformMapState extends State<_PlatformMap> { widget.initialCameraPosition.appleMapsCameraPosition, compassEnabled: widget.compassEnabled, mapType: _getMapType(), + colorScheme: _getAppleMapColorScheme(), padding: widget.padding, annotations: widget.markers.appleMapsAnnotationSet, polylines: widget.polylines.appleMapsPolylineSet, @@ -184,6 +193,7 @@ class _PlatformMapState extends State<_PlatformMap> { onTap: _onTap, onLongPress: _onLongPress, trafficEnabled: widget.trafficEnabled, + insetsLayoutMarginsFromSafeArea: widget.insetsLayoutMarginsFromSafeArea, minMaxZoomPreference: widget.minMaxZoomPreference.appleMapsZoomPreference, ); } @@ -214,4 +224,15 @@ class _PlatformMapState extends State<_PlatformMap> { return apple_maps.MapType.hybrid; } } + + apple_maps.MapColorScheme _getAppleMapColorScheme() { + if (widget.mapColorScheme == MapColorScheme.system) { + return apple_maps.MapColorScheme.system; + } else if (widget.mapColorScheme == MapColorScheme.light) { + return apple_maps.MapColorScheme.light; + } else if (widget.mapColorScheme == MapColorScheme.dark) { + return apple_maps.MapColorScheme.dark; + } + return apple_maps.MapColorScheme.system; + } } diff --git a/packages/platform_maps_flutter_apple/pubspec.yaml b/packages/platform_maps_flutter_apple/pubspec.yaml index 346da04..90b6bf0 100644 --- a/packages/platform_maps_flutter_apple/pubspec.yaml +++ b/packages/platform_maps_flutter_apple/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/albert-heijn-technology/platform_maps_flutter/tre issue_tracker: https://github.com/albert-heijn-technology/platform_maps_flutter/issues environment: - sdk: '>=3.2.4 <4.0.0' + sdk: ">=3.2.4 <4.0.0" flutter: ">=1.17.0" flutter: @@ -20,11 +20,13 @@ flutter: dependencies: flutter: sdk: flutter - apple_maps_flutter: ^1.3.0 + apple_maps_flutter: + git: + url: https://github.com/Iconica-Development/apple_maps_flutter + ref: master platform_maps_flutter_platform_interface: ^1.0.0-beta dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^2.0.0 - diff --git a/packages/platform_maps_flutter_google_android/lib/src/google_maps_widget.dart b/packages/platform_maps_flutter_google_android/lib/src/google_maps_widget.dart index 6e6aed2..851f663 100644 --- a/packages/platform_maps_flutter_google_android/lib/src/google_maps_widget.dart +++ b/packages/platform_maps_flutter_google_android/lib/src/google_maps_widget.dart @@ -145,6 +145,12 @@ class _PlatformMap extends StatefulWidget { /// Enables or disables the traffic layer of the map bool get trafficEnabled => params.trafficEnabled; + /// The optional style to be used for the map. See https://developers.google.com/maps/documentation/android-sdk/styling for more details. + String? get googleMapsStyle => params.googleMapsStyle; + + /// The optional mapId to be used for the map. See https://developers.google.com/maps/documentation/android-sdk/cloud-based-map-styling for more details. + String? get googleMapsCloudMapId => params.googleMapsCloudMapId; + /// Which gestures should be consumed by the map. /// /// It is possible for other gesture recognizers to be competing with the map on pointer @@ -188,6 +194,8 @@ class _PlatformMapState extends State<_PlatformMap> { onTap: _onTap, onLongPress: _onLongPress, trafficEnabled: widget.trafficEnabled, + cloudMapId: widget.googleMapsCloudMapId, + style: widget.googleMapsStyle, minMaxZoomPreference: widget.minMaxZoomPreference.googleMapsZoomPreference, ); diff --git a/packages/platform_maps_flutter_platform_interface/lib/src/platform_map.dart b/packages/platform_maps_flutter_platform_interface/lib/src/platform_map.dart index ba2aa54..676ec54 100644 --- a/packages/platform_maps_flutter_platform_interface/lib/src/platform_map.dart +++ b/packages/platform_maps_flutter_platform_interface/lib/src/platform_map.dart @@ -25,6 +25,8 @@ class PlatformMap extends StatelessWidget { this.polygons = const {}, this.polylines = const {}, this.circles = const {}, + this.googleMapsStyle, + this.googleMapsCloudMapId, this.onCameraMoveStarted, this.onCameraMove, this.onCameraIdle, @@ -189,6 +191,12 @@ class PlatformMap extends StatelessWidget { /// were not claimed by any other gesture recognizer. final Set> gestureRecognizers; + /// The style of the map. This is only supported for google maps. + final String? googleMapsStyle; + + /// The cloud map id of the map. This is only supported for google maps. + final String? googleMapsCloudMapId; + final PlatformMapsPlatformWidget _platform; @override diff --git a/packages/platform_maps_flutter_platform_interface/lib/src/types.dart b/packages/platform_maps_flutter_platform_interface/lib/src/types.dart index 66cd200..71d07e5 100644 --- a/packages/platform_maps_flutter_platform_interface/lib/src/types.dart +++ b/packages/platform_maps_flutter_platform_interface/lib/src/types.dart @@ -9,6 +9,7 @@ export 'types/info_window.dart'; export 'types/joint_type.dart'; export 'types/lat_lng.dart'; export 'types/map_type.dart'; +export 'types/map_colorscheme.dart'; export 'types/marker.dart'; export 'types/min_max_zoom_preference.dart'; export 'types/platform_maps_platform_widget_creation_params.dart'; diff --git a/packages/platform_maps_flutter_platform_interface/lib/src/types/map_colorscheme.dart b/packages/platform_maps_flutter_platform_interface/lib/src/types/map_colorscheme.dart new file mode 100644 index 0000000..3ff27da --- /dev/null +++ b/packages/platform_maps_flutter_platform_interface/lib/src/types/map_colorscheme.dart @@ -0,0 +1,11 @@ +/// Enum for the color scheme options for the map. +enum MapColorScheme { + /// Follow system settings for light/dark mode + system, + + /// Light color scheme + light, + + /// Dark color scheme + dark, +} diff --git a/packages/platform_maps_flutter_platform_interface/lib/src/types/map_type.dart b/packages/platform_maps_flutter_platform_interface/lib/src/types/map_type.dart index 72a3b8d..1aff48d 100644 --- a/packages/platform_maps_flutter_platform_interface/lib/src/types/map_type.dart +++ b/packages/platform_maps_flutter_platform_interface/lib/src/types/map_type.dart @@ -8,4 +8,4 @@ enum MapType { /// Hybrid tiles (satellite images with some labels/overlays) hybrid, -} +} \ No newline at end of file diff --git a/packages/platform_maps_flutter_platform_interface/lib/src/types/platform_maps_platform_widget_creation_params.dart b/packages/platform_maps_flutter_platform_interface/lib/src/types/platform_maps_platform_widget_creation_params.dart index 2d466fe..423e5af 100644 --- a/packages/platform_maps_flutter_platform_interface/lib/src/types/platform_maps_platform_widget_creation_params.dart +++ b/packages/platform_maps_flutter_platform_interface/lib/src/types/platform_maps_platform_widget_creation_params.dart @@ -16,6 +16,7 @@ class PlatformMapsPlatformWidgetCreationParams { this.gestureRecognizers = const >{}, this.compassEnabled = true, this.mapType = MapType.normal, + this.mapColorScheme = MapColorScheme.system, this.minMaxZoomPreference = MinMaxZoomPreference.unbounded, this.rotateGesturesEnabled = true, this.scrollGesturesEnabled = true, @@ -24,12 +25,15 @@ class PlatformMapsPlatformWidgetCreationParams { this.tiltGesturesEnabled = true, this.myLocationEnabled = false, this.myLocationButtonEnabled = false, + this.insetsLayoutMarginsFromSafeArea = false, this.padding = const EdgeInsets.all(0), this.trafficEnabled = false, this.markers = const {}, this.polygons = const {}, this.polylines = const {}, this.circles = const {}, + this.googleMapsStyle, + this.googleMapsCloudMapId, this.onCameraMoveStarted, this.onCameraMove, this.onCameraIdle, @@ -51,6 +55,9 @@ class PlatformMapsPlatformWidgetCreationParams { /// Type of map tiles to be rendered. final MapType mapType; + /// The colorscheme to be used when the map is on apple maps. There is no support for darkmode on google maps yet. + final MapColorScheme mapColorScheme; + /// Preferred bounds for the camera zoom level. /// /// Actual bounds depend on map data and device. @@ -157,6 +164,16 @@ class PlatformMapsPlatformWidgetCreationParams { /// Enables or disables the traffic layer of the map final bool trafficEnabled; + /// A Boolean value indicating whether the view's layout margins are updated + /// automatically to reflect the safe area. + final bool insetsLayoutMarginsFromSafeArea; + + /// The style of the map. This is only supported for google maps. + final String? googleMapsStyle; + + /// The cloud map id of the map. This is only supported for google maps. + final String? googleMapsCloudMapId; + /// Which gestures should be consumed by the map. /// /// It is possible for other gesture recognizers to be competing with the map on pointer