AnimationControllerX class

An powerful implementation of Flutter's AnimationController that will work with an AnimationTask queue to execute complex custom animations easily.

You can use addTask, addTasks or reset to configure it with tasks. Common used tasks are FromToTask, LoopTask, SetValueTask or ConditionalTask. You can create your own tasks by extending the abstract class AnimationTask.

// AnimationController (original implementation)
controller.forward();

// AnimationControllerX (this implementation)
controller.addTask(FromToTask(to: 1.0));

You can add multiple tasks to it's internal queue. It will process / animate each one by one. The tasks getter lets you read the task list.

Tween handling is the same like doing it with an AnimationController:

width = Tween(begin: 100.0, end: 200.0).animate(controller);

Use reset or stop to cancel the current animation.

You can call forceCompleteCurrentTask to just complete the currently executed task. It will continue with the next one (if defined).

It's possible to track the task processing by attaching an onStatusChange listener. But keep in mind that AnimationTask also has listener to track start and complete status.

Inheritance
Mixed in types
Annotations
  • @Deprecated('See migration guide: https://pub.dev/packages/sa_v1_migration')

Constructors

AnimationControllerX({TickerProvider vsync, StatusChangeCallback onStatusChange})

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
isCompleted bool
Whether this animation is stopped at the end.
read-only, inherited
isDismissed bool
Whether this animation is stopped at the beginning.
read-only, inherited
onStatusChange StatusChangeCallback
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
status AnimationStatus
The current status of this animation represented by Flutter's own AnimationStatus enum.
read-only, override
tasks List<AnimationTask>
Returns a copy of the internal task queue.
read-only
value double
The current value of the animation. It gets computed by the used AnimationTasks.
read-only, override

Methods

addListener(VoidCallback listener) → void
Calls the listener every time the value of the animation changes. [...]
inherited
addStatusListener(AnimationStatusListener listener) → void
Calls listener every time the status of the animation changes. [...]
inherited
addTask(AnimationTask task) → void
Appends a new task to the execution queue.
addTasks(List<AnimationTask> tasks) → void
Appends multiple tasks to the execution queue.
clearListeners() → void
Removes all listeners added with addListener. [...]
@protected, inherited
clearStatusListeners() → void
Removes all listeners added with addStatusListener. [...]
@protected, inherited
configureVsync(TickerProvider vsync) → void
Configures controller to a TickerProvider.
didRegisterListener() → void
This implementation ignores listener registrations.
@protected, inherited
didUnregisterListener() → void
This implementation ignores listener registrations.
@protected, inherited
dispose() → void
Release the resources used by this object. The object is no longer usable after this method is called.
override
drive<U>(Animatable<U> child) Animation<U>
Chains a Tween (or CurveTween) to this Animation. [...]
@optionalTypeArgs, inherited
forceCompleteCurrentTask() → void
Completes the currently executing task. If the queue has remaining tasks it will continue to process the next task.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notifyListeners() → void
Calls all the listeners. [...]
@protected, inherited
notifyStatusListeners(AnimationStatus status) → void
Calls all the status listeners. [...]
@protected, inherited
removeListener(VoidCallback listener) → void
Stop calling the listener every time the value of the animation changes. [...]
inherited
removeStatusListener(AnimationStatusListener listener) → void
Stops calling the listener every time the status of the animation changes. [...]
inherited
reset([List<AnimationTask> tasksToExecuteAfterReset]) → void
Clears the current task queue and (optionally) continues to process tasks provided by the tasksToExecuteAfterReset parameter.
stop() → void
Stops and clears the task queue.
toString() String
A string representation of this object. [...]
inherited
toStringDetails() String
Provides a string describing the status of this object, but not including information about the object itself. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited