diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index 926a5867494a..56fbf0ee4a6e 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.21+6 + +* Override a default method to work around flutter/flutter#40126. + ## 0.5.21+5 * Update and migrate iOS example project. diff --git a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java index f2ea28e32412..1c70909b0500 100644 --- a/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java +++ b/packages/google_maps_flutter/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapController.java @@ -468,6 +468,20 @@ public void dispose() { registrar.activity().getApplication().unregisterActivityLifecycleCallbacks(this); } + // @Override + // The minimum supported version of Flutter doesn't have this method on the PlatformView interface, but the maximum + // does. This will override it when available even with the annotation commented out. + public void onInputConnectionLocked() { + // TODO(mklim): Remove this empty override once https://github.com/flutter/flutter/issues/40126 is fixed in stable. + }; + + // @Override + // The minimum supported version of Flutter doesn't have this method on the PlatformView interface, but the maximum + // does. This will override it when available even with the annotation commented out. + public void onInputConnectionUnlocked() { + // TODO(mklim): Remove this empty override once https://github.com/flutter/flutter/issues/40126 is fixed in stable. + }; + @Override public void onActivityCreated(Activity activity, Bundle savedInstanceState) { if (disposed || activity.hashCode() != registrarActivityHashCode) { diff --git a/packages/google_maps_flutter/example/android/build.gradle b/packages/google_maps_flutter/example/android/build.gradle index 6e12e86d782e..e0d7ae2c11af 100644 --- a/packages/google_maps_flutter/example/android/build.gradle +++ b/packages/google_maps_flutter/example/android/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.3.2' + classpath 'com.android.tools.build:gradle:3.5.0' } } diff --git a/packages/google_maps_flutter/example/android/gradle.properties b/packages/google_maps_flutter/example/android/gradle.properties index 8bd86f680510..7be3d8b46841 100644 --- a/packages/google_maps_flutter/example/android/gradle.properties +++ b/packages/google_maps_flutter/example/android/gradle.properties @@ -1 +1,2 @@ org.gradle.jvmargs=-Xmx1536M +android.enableR8=true diff --git a/packages/google_maps_flutter/example/android/gradle/wrapper/gradle-wrapper.properties b/packages/google_maps_flutter/example/android/gradle/wrapper/gradle-wrapper.properties index 2819f022f1fd..9ec7236c631e 100644 --- a/packages/google_maps_flutter/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/google_maps_flutter/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip diff --git a/packages/google_maps_flutter/example/test_driver/google_maps.dart b/packages/google_maps_flutter/example/test_driver/google_maps.dart index 8bcf2e3f2f5d..90d065fbeb5b 100644 --- a/packages/google_maps_flutter/example/test_driver/google_maps.dart +++ b/packages/google_maps_flutter/example/test_driver/google_maps.dart @@ -5,6 +5,7 @@ import 'dart:async'; import 'dart:io'; +import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_driver/driver_extension.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -638,4 +639,40 @@ void main() { expect(topLeft, const ScreenCoordinate(x: 0, y: 0)); }); + + test('testResizeWidget', () async { + final Completer controllerCompleter = + Completer(); + final GoogleMap map = GoogleMap( + initialCameraPosition: _kInitialCameraPosition, + onMapCreated: (GoogleMapController controller) async { + controllerCompleter.complete(controller); + }, + ); + await pumpWidget(Directionality( + textDirection: TextDirection.ltr, + child: MaterialApp( + home: Scaffold( + body: SizedBox(height: 100, width: 100, child: map))))); + final GoogleMapController controller = await controllerCompleter.future; + + await pumpWidget(Directionality( + textDirection: TextDirection.ltr, + child: MaterialApp( + home: Scaffold( + body: SizedBox(height: 400, width: 400, child: map))))); + + // We suspected a bug in the iOS Google Maps SDK caused the camera is not properly positioned at + // initialization. https://github.com/flutter/flutter/issues/24806 + // This temporary workaround fix is provided while the actual fix in the Google Maps SDK is + // still being investigated. + // TODO(cyanglaz): Remove this temporary fix once the Maps SDK issue is resolved. + // https://github.com/flutter/flutter/issues/27550 + await Future.delayed(const Duration(seconds: 3)); + + // Simple call to make sure that the app hasn't crashed. + final LatLngBounds bounds1 = await controller.getVisibleRegion(); + final LatLngBounds bounds2 = await controller.getVisibleRegion(); + expect(bounds1, bounds2); + }); } diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index d4ef98ccedd4..71d870f619a2 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter -version: 0.5.21+5 +version: 0.5.21+6 dependencies: flutter: