Skip to content

Commit f2d6024

Browse files
committed
Fix marker type in platform implementation
1 parent 628d6b6 commit f2d6024

File tree

7 files changed

+45
-6
lines changed

7 files changed

+45
-6
lines changed

packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ MapConfiguration _configurationFromMapWidget(GoogleMap map) {
632632
indoorViewEnabled: map.indoorViewEnabled,
633633
trafficEnabled: map.trafficEnabled,
634634
buildingsEnabled: map.buildingsEnabled,
635+
markerType: map.markerType,
635636
mapId: map.mapId,
636637
// A null style in the widget means no style, which is expressed as '' in
637638
// the configuration to distinguish from no change (null).

packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ public PlatformView create(@NonNull Context context, int id, @Nullable Object ar
5252
builder.setMapId(mapId);
5353
}
5454

55-
return builder.build(id, context, binaryMessenger, lifecycleProvider, params.getMarkerType());
55+
return builder.build(id, context, binaryMessenger, lifecycleProvider, mapConfig.getMarkerType());
5656
}
5757
}

packages/google_maps_flutter/google_maps_flutter_android/example/lib/example_google_map.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ MapConfiguration _configurationFromMapWidget(ExampleGoogleMap map) {
577577
indoorViewEnabled: map.indoorViewEnabled,
578578
trafficEnabled: map.trafficEnabled,
579579
buildingsEnabled: map.buildingsEnabled,
580+
markerType: map.markerType,
580581
mapId: map.mapId,
581582
style: map.style,
582583
);

packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
613613
Set<ClusterManager> clusterManagers = const <ClusterManager>{},
614614
Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers,
615615
Map<String, dynamic> mapOptions = const <String, dynamic>{},
616-
MarkerType markerType = MarkerType.marker,
617616
}) {
618617
return _buildView(
619618
creationId,
@@ -646,7 +645,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
646645
Set<ClusterManager> clusterManagers = const <ClusterManager>{},
647646
Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers,
648647
Map<String, dynamic> mapOptions = const <String, dynamic>{},
649-
MarkerType markerType = MarkerType.marker,
650648
}) {
651649
return buildViewWithTextDirection(
652650
creationId,
@@ -661,7 +659,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
661659
clusterManagers: clusterManagers,
662660
gestureRecognizers: gestureRecognizers,
663661
mapOptions: mapOptions,
664-
markerType: markerType,
665662
);
666663
}
667664

packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/example_google_map.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ MapConfiguration _configurationFromMapWidget(ExampleGoogleMap map) {
573573
indoorViewEnabled: map.indoorViewEnabled,
574574
trafficEnabled: map.trafficEnabled,
575575
buildingsEnabled: map.buildingsEnabled,
576+
markerType: map.markerType,
576577
mapId: map.mapId,
577578
style: map.style,
578579
);

packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ - (instancetype)initWithMapView:(GMSMapView *_Nonnull)mapView
180180
NSString *pigeonSuffix = [NSString stringWithFormat:@"%lld", viewId];
181181
_dartCallbackHandler = [[FGMMapsCallbackApi alloc] initWithBinaryMessenger:registrar.messenger
182182
messageChannelSuffix:pigeonSuffix];
183-
FGMPlatformMarkerType markerType = creationParameters.markerType;
183+
FGMPlatformMarkerTypeBox* markerType = creationParameters.mapConfiguration.markerType;
184184
_mapView.delegate = self;
185185
_mapView.paddingAdjustmentBehavior = kGMSMapViewPaddingAdjustmentBehaviorNever;
186186
_registrar = registrar;
@@ -191,7 +191,7 @@ - (instancetype)initWithMapView:(GMSMapView *_Nonnull)mapView
191191
callbackHandler:_dartCallbackHandler
192192
clusterManagersController:_clusterManagersController
193193
registrar:registrar
194-
markerType:markerType];
194+
markerType:markerType.value];
195195
_polygonsController = [[FLTPolygonsController alloc] initWithMapView:_mapView
196196
callbackHandler:_dartCallbackHandler
197197
registrar:registrar];

packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,45 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform {
820820
imagePixelRatio: bytes.imagePixelRatio,
821821
width: bytes.width,
822822
height: bytes.height));
823+
case final PinConfig pinConfig:
824+
final int? backgroundColor = pinConfig.backgroundColor?.value;
825+
final int? borderColor = pinConfig.borderColor?.value;
826+
switch (pinConfig.glyph) {
827+
case final CircleGlyph circleGlyph:
828+
return PlatformBitmap(
829+
bitmap: PlatformBitmapPinConfig(
830+
backgroundColor: backgroundColor,
831+
borderColor: borderColor,
832+
glyphColor: circleGlyph.color.value,
833+
),
834+
);
835+
case final TextGlyph textGlyph:
836+
return PlatformBitmap(
837+
bitmap: PlatformBitmapPinConfig(
838+
backgroundColor: backgroundColor,
839+
borderColor: borderColor,
840+
glyphText: textGlyph.text,
841+
glyphTextColor: textGlyph.textColor?.value,
842+
),
843+
);
844+
case final BitmapGlyph bitmapGlyph:
845+
return PlatformBitmap(
846+
bitmap: PlatformBitmapPinConfig(
847+
backgroundColor: backgroundColor,
848+
borderColor: borderColor,
849+
glyphBitmap: platformBitmapFromBitmapDescriptor(
850+
bitmapGlyph.bitmap,
851+
),
852+
),
853+
);
854+
default:
855+
return PlatformBitmap(
856+
bitmap: PlatformBitmapPinConfig(
857+
backgroundColor: backgroundColor,
858+
borderColor: borderColor,
859+
),
860+
);
861+
}
823862
default:
824863
throw ArgumentError(
825864
'Unrecognized type of bitmap ${bitmap.runtimeType}', 'bitmap');

0 commit comments

Comments
 (0)