Skip to content

Commit b2d67c5

Browse files
committed
Fix marker type in platform implementation
1 parent fe2475f commit b2d67c5

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
@@ -689,6 +689,7 @@ MapConfiguration _configurationFromMapWidget(GoogleMap map) {
689689
indoorViewEnabled: map.indoorViewEnabled,
690690
trafficEnabled: map.trafficEnabled,
691691
buildingsEnabled: map.buildingsEnabled,
692+
markerType: map.markerType,
692693
mapId: map.mapId,
693694
// A null style in the widget means no style, which is expressed as '' in
694695
// 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
@@ -53,6 +53,6 @@ public PlatformView create(@NonNull Context context, int id, @Nullable Object ar
5353
builder.setMapId(mapId);
5454
}
5555

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

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
@@ -608,6 +608,7 @@ MapConfiguration _configurationFromMapWidget(ExampleGoogleMap map) {
608608
indoorViewEnabled: map.indoorViewEnabled,
609609
trafficEnabled: map.trafficEnabled,
610610
buildingsEnabled: map.buildingsEnabled,
611+
markerType: map.markerType,
611612
mapId: map.mapId,
612613
style: map.style,
613614
);

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
@@ -663,7 +663,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
663663
Set<ClusterManager> clusterManagers = const <ClusterManager>{},
664664
Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers,
665665
Map<String, dynamic> mapOptions = const <String, dynamic>{},
666-
MarkerType markerType = MarkerType.marker,
667666
}) {
668667
return _buildView(
669668
creationId,
@@ -696,7 +695,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
696695
Set<ClusterManager> clusterManagers = const <ClusterManager>{},
697696
Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers,
698697
Map<String, dynamic> mapOptions = const <String, dynamic>{},
699-
MarkerType markerType = MarkerType.marker,
700698
}) {
701699
return buildViewWithTextDirection(
702700
creationId,
@@ -711,7 +709,6 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
711709
clusterManagers: clusterManagers,
712710
gestureRecognizers: gestureRecognizers,
713711
mapOptions: mapOptions,
714-
markerType: markerType,
715712
);
716713
}
717714

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
@@ -604,6 +604,7 @@ MapConfiguration _configurationFromMapWidget(ExampleGoogleMap map) {
604604
indoorViewEnabled: map.indoorViewEnabled,
605605
trafficEnabled: map.trafficEnabled,
606606
buildingsEnabled: map.buildingsEnabled,
607+
markerType: map.markerType,
607608
mapId: map.mapId,
608609
style: map.style,
609610
);

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
@@ -162,7 +162,7 @@ - (instancetype)initWithMapView:(GMSMapView *_Nonnull)mapView
162162
NSString *pigeonSuffix = [NSString stringWithFormat:@"%lld", viewId];
163163
_dartCallbackHandler = [[FGMMapsCallbackApi alloc] initWithBinaryMessenger:registrar.messenger
164164
messageChannelSuffix:pigeonSuffix];
165-
FGMPlatformMarkerType markerType = creationParameters.markerType;
165+
FGMPlatformMarkerTypeBox* markerType = creationParameters.mapConfiguration.markerType;
166166
_mapView.delegate = self;
167167
_mapView.paddingAdjustmentBehavior = kGMSMapViewPaddingAdjustmentBehaviorNever;
168168
_registrar = registrar;
@@ -173,7 +173,7 @@ - (instancetype)initWithMapView:(GMSMapView *_Nonnull)mapView
173173
callbackHandler:_dartCallbackHandler
174174
clusterManagersController:_clusterManagersController
175175
registrar:registrar
176-
markerType:markerType];
176+
markerType:markerType.value];
177177
_polygonsController = [[FLTPolygonsController alloc] initWithMapView:_mapView
178178
callbackHandler:_dartCallbackHandler
179179
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
@@ -893,6 +893,45 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform {
893893
imagePixelRatio: bytes.imagePixelRatio,
894894
width: bytes.width,
895895
height: bytes.height));
896+
case final PinConfig pinConfig:
897+
final int? backgroundColor = pinConfig.backgroundColor?.value;
898+
final int? borderColor = pinConfig.borderColor?.value;
899+
switch (pinConfig.glyph) {
900+
case final CircleGlyph circleGlyph:
901+
return PlatformBitmap(
902+
bitmap: PlatformBitmapPinConfig(
903+
backgroundColor: backgroundColor,
904+
borderColor: borderColor,
905+
glyphColor: circleGlyph.color.value,
906+
),
907+
);
908+
case final TextGlyph textGlyph:
909+
return PlatformBitmap(
910+
bitmap: PlatformBitmapPinConfig(
911+
backgroundColor: backgroundColor,
912+
borderColor: borderColor,
913+
glyphText: textGlyph.text,
914+
glyphTextColor: textGlyph.textColor?.value,
915+
),
916+
);
917+
case final BitmapGlyph bitmapGlyph:
918+
return PlatformBitmap(
919+
bitmap: PlatformBitmapPinConfig(
920+
backgroundColor: backgroundColor,
921+
borderColor: borderColor,
922+
glyphBitmap: platformBitmapFromBitmapDescriptor(
923+
bitmapGlyph.bitmap,
924+
),
925+
),
926+
);
927+
default:
928+
return PlatformBitmap(
929+
bitmap: PlatformBitmapPinConfig(
930+
backgroundColor: backgroundColor,
931+
borderColor: borderColor,
932+
),
933+
);
934+
}
896935
default:
897936
throw ArgumentError(
898937
'Unrecognized type of bitmap ${bitmap.runtimeType}', 'bitmap');

0 commit comments

Comments
 (0)