@@ -149,12 +149,13 @@ class PlatformMap extends StatefulWidget {
149
149
class _PlatformMapState extends State <PlatformMap > {
150
150
@override
151
151
Widget build (BuildContext context) {
152
+ print (widget.mapType);
152
153
if (Platform .isAndroid) {
153
154
return googleMaps.GoogleMap (
154
155
initialCameraPosition:
155
156
widget.initialCameraPosition.googleMapsCameraPosition,
156
157
compassEnabled: widget.compassEnabled,
157
- mapType: widget.mapType ?? MapType .normal ,
158
+ mapType: _getGoogleMapType () ,
158
159
markers: Marker .toGoogleMapsMarkerSet (widget.markers),
159
160
gestureRecognizers: widget.gestureRecognizers,
160
161
onCameraIdle: widget.onCameraIdle,
@@ -179,7 +180,7 @@ class _PlatformMapState extends State<PlatformMap> {
179
180
initialCameraPosition:
180
181
widget.initialCameraPosition.appleMapsCameraPosition,
181
182
compassEnabled: widget.compassEnabled,
182
- mapType: widget.mapType ?? MapType .normal ,
183
+ mapType: _getAppleMapType () ,
183
184
annotations: Marker .toAppleMapsAnnotationSet (widget.markers),
184
185
gestureRecognizers: widget.gestureRecognizers,
185
186
onCameraIdle: widget.onCameraIdle,
@@ -211,4 +212,26 @@ class _PlatformMapState extends State<PlatformMap> {
211
212
_onAppleMapCreated (appleMaps.AppleMapController controller) {
212
213
widget.onMapCreated (PlatformMapController (controller));
213
214
}
215
+
216
+ appleMaps.MapType _getAppleMapType () {
217
+ if (widget.mapType == MapType .normal) {
218
+ return appleMaps.MapType .standard;
219
+ } else if (widget.mapType == MapType .satellite) {
220
+ return appleMaps.MapType .satellite;
221
+ } else if (widget.mapType == MapType .hybrid) {
222
+ return appleMaps.MapType .hybrid;
223
+ }
224
+ return appleMaps.MapType .standard;
225
+ }
226
+
227
+ googleMaps.MapType _getGoogleMapType () {
228
+ if (widget.mapType == MapType .normal) {
229
+ return googleMaps.MapType .normal;
230
+ } else if (widget.mapType == MapType .satellite) {
231
+ return googleMaps.MapType .satellite;
232
+ } else if (widget.mapType == MapType .hybrid) {
233
+ return googleMaps.MapType .hybrid;
234
+ }
235
+ return googleMaps.MapType .normal;
236
+ }
214
237
}
0 commit comments