DirectionalRotation constructor

const DirectionalRotation({
  1. Key? key,
  2. required num angle,
  3. required Widget child,
  4. num scale = 360.0,
  5. Curve curve = Curves.linear,
  6. Duration duration = const Duration(seconds: 1),
  7. bool factorDuration = true,
  8. RotationDirection direction = RotationDirection.closest,
  9. VoidCallback? onComplete,
})

A widget that implicitly rotates its child to the provided angle.

angle is the rotation currently applied to the child, by default angle equates to degrees, but can be normalized to any scale. scale must not be null.

scale defines the scale the angle relates to, scale defaults to 360 and must not be null or 0.

curve sets the easing curve applied to each rotation animation.

duration defines the length of each animation. If factorDuration is true, the duration will be factored by the difference between the current angle and the new angle, when angle is updated, and will equate the one whole rotation. If false, the duration will be the length of each animation, regardless of the distance of the rotation.

direction constrains the direction the child may rotate in, by default the child will rotate in the direction that has the shorest span to the new angle from the current angle, when angle is updated.

onComplete is a callback that's called each time the animation completes.

Implementation

const DirectionalRotation({
  Key? key,
  required this.angle,
  required this.child,
  this.scale = 360.0,
  this.curve = Curves.linear,
  this.duration = const Duration(seconds: 1),
  this.factorDuration = true,
  this.direction = RotationDirection.closest,
  this.onComplete,
})  : assert(scale != 0),
      super(key: key);