Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.11.0

* Adds support for animating the camera with a duration.

## 2.10.0

* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@ abstract class GoogleMapsFlutterPlatform extends PlatformInterface {
throw UnimplementedError('animateCamera() has not been implemented.');
}

/// Starts an animated change of the map camera position using the provided
/// [CameraUpdateAnimationConfiguration].
///
/// The returned [Future] completes after the change has been started on the
/// platform side.
Future<void> animateCameraWithConfiguration(
CameraUpdate cameraUpdate,
CameraUpdateAnimationConfiguration configuration, {
required int mapId,
}) {
return animateCamera(cameraUpdate, mapId: mapId);
}

/// Changes the map camera position.
///
/// The returned [Future] completes after the change has been made on the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,16 @@ abstract class GoogleMapsInspectorPlatform extends PlatformInterface {
{required int mapId, required ClusterManagerId clusterManagerId}) {
throw UnimplementedError('getClusters() has not been implemented.');
}

/// If the platform supports getting camera position.
bool supportsGettingGameraPosition() => false;

/// Returns current camera position.
///
/// The returned object will be synthesized from platform data, so will not
/// be the same Dart object as the original [CameraPosition] provided to the
/// platform interface with map initialization or with [CameraUpdate].
Future<CameraPosition> getCameraPosition({required int mapId}) {
throw UnimplementedError('getCameraPosition() has not been implemented.');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,15 @@ class CameraUpdateZoomTo extends CameraUpdate {
@override
Object toJson() => <Object>['zoomTo', zoom];
}

/// Defines an animation configuration for camera updates.
@immutable
class CameraUpdateAnimationConfiguration {
/// Creates a immutable animation configuration for camera updates.
const CameraUpdateAnimationConfiguration({this.duration});

/// The duration of the animation.
///
/// If null, the platform will decide the default value.
final Duration? duration;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_maps_f
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.10.0
version: 2.11.0

environment:
sdk: ^3.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,28 @@ void main() {
expect(await platform.getStyleError(mapId: 0), null);
},
);

test(
'default implementation of `animateCameraWithConfiguration` delegates to `animateCamera`',
() {
final GoogleMapsFlutterPlatform platform =
ExtendsGoogleMapsFlutterPlatform();
GoogleMapsFlutterPlatform.instance = platform;

const CameraUpdateAnimationConfiguration animationConfig =
CameraUpdateAnimationConfiguration(duration: Duration(seconds: 2));
final CameraUpdate cameraUpdate = CameraUpdate.newCameraPosition(
const CameraPosition(target: LatLng(10.0, 15.0)),
);

expect(
() => platform.animateCameraWithConfiguration(
cameraUpdate, animationConfig, mapId: 0),
throwsA(isA<UnimplementedError>().having(
(UnimplementedError e) => e.message,
'message',
contains('animateCamera() has not been implemented'))));
});
});
}

Expand Down