rotateAnimatedRaw method

void rotateAnimatedRaw(
  1. double newRotation, {
  2. required Offset offset,
  3. required Duration duration,
  4. required Curve curve,
  5. required bool hasGesture,
  6. required MapEventSource source,
})

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

Implementation

void rotateAnimatedRaw(
  double newRotation, {
  required Offset offset,
  required Duration duration,
  required Curve curve,
  required bool hasGesture,
  required MapEventSource source,
}) {
  // cancel all ongoing animation
  _animationController.stop();
  _resetAnimations();

  if (newRotation == camera.rotation) return;

  // create the new animation
  _rotationAnimation = Tween<double>(begin: camera.rotation, end: newRotation)
      .chain(CurveTween(curve: curve))
      .animate(_animationController);

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

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