addAnimatable method

SequenceAnimationBuilder addAnimatable({
  1. required Animatable animatable,
  2. required Duration from,
  3. required Duration to,
  4. Curve curve = Curves.linear,
  5. required Object tag,
})

Adds an Animatable to the sequence, in the most cases this would be a Tween. The from and to Duration specify points in time where the animation takes place. You can also specify a Curve for the Animatable.

Animatables which animate on the same tag are not allowed to overlap and they also need to be add in the same order they are played. These restrictions only apply to Animatables operating on the same tag.

Sample code

    SequenceAnimation sequenceAnimation = new SequenceAnimationBuilder()
        .addAnimatable(
          animatable: new ColorTween(begin: Colors.red, end: Colors.yellow),
          from: const Duration(seconds: 0),
          to: const Duration(seconds: 2),
          tag: "color",
        )
        .animate(controller);

Implementation

SequenceAnimationBuilder addAnimatable({
  required Animatable animatable,
  required Duration from,
  required Duration to,
  Curve curve: Curves.linear,
  required Object tag,
}) {
  assert(to >= from);
  _animations.add(new _AnimationInformation(
      animatable: animatable, from: from, to: to, curve: curve, tag: tag));
  return this;
}