moveAnimatedRaw method

void moveAnimatedRaw(
  1. LatLng newCenter,
  2. double newZoom, {
  3. Offset offset = Offset.zero,
  4. required Duration duration,
  5. required Curve curve,
  6. required bool hasGesture,
  7. required MapEventSource source,
})

Animated movement of the map. The raw method allows to set all parameters.

Implementation

void moveAnimatedRaw(
  LatLng newCenter,
  double newZoom, {
  Offset offset = Offset.zero,
  required Duration duration,
  required Curve curve,
  required bool hasGesture,
  required MapEventSource source,
}) {
  // cancel all ongoing animation
  _animationController.stop();
  _resetAnimations();

  if (newCenter == camera.center && newZoom == camera.zoom) return;

  // create the new animation
  _moveAnimation = LatLngTween(begin: camera.center, end: newCenter)
      .chain(CurveTween(curve: curve))
      .animate(_animationController);
  _zoomAnimation = Tween<double>(begin: camera.zoom, end: newZoom)
      .chain(CurveTween(curve: curve))
      .animate(_animationController);

  _animationController.duration = duration;
  _animationHasGesture = hasGesture;
  _animationOffset = offset;

  // start the animation from its start
  _animationController.forward(from: 0);
}