TrainHoppingAnimation class

This animation starts by proxying one animation, but when the value of that animation crosses the value of the second (either because the second is going in the opposite direction, or because the one overtakes the other), the animation hops over to proxying the second animation.

When the TrainHoppingAnimation starts proxying the second animation instead of the first, the onSwitchedTrain callback is called.

If the two animations start at the same value, then the TrainHoppingAnimation immediately hops to the second animation, and the onSwitchedTrain callback is not called. If only one animation is provided (i.e. if the second is null), then the TrainHoppingAnimation just proxies the first animation.

Since this object must track the two animations even when it has no listeners of its own, instead of shutting down when all its listeners are removed, it exposes a dispose() method. Call this method to shut this object down.

Inheritance
Mixed in types

Constructors

TrainHoppingAnimation(Animation<double> _currentTrain, Animation<double>? _nextTrain, {VoidCallback? onSwitchedTrain})
Creates a train-hopping animation.

Properties

currentTrain Animation<double>?
The animation that is currently driving this animation.
no setter
hashCode int
The hash code for this object.
no setterinherited
isCompleted bool
Whether this animation is stopped at the end.
no setterinherited
isDismissed bool
Whether this animation is stopped at the beginning.
no setterinherited
onSwitchedTrain VoidCallback?
Called when this animation switches to be driven by the second animation.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status AnimationStatus
The current status of this animation.
no setteroverride
value double
The current value of the animation.
no setteroverride

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
clearListeners() → void
Removes all listeners added with addListener.
inherited
clearStatusListeners() → void
Removes all listeners added with addStatusListener.
inherited
didRegisterListener() → void
This implementation ignores listener registrations.
inherited
didUnregisterListener() → void
This implementation ignores listener registrations.
inherited
dispose() → void
Frees all the resources used by this performance. After this is called, this object is no longer usable.
override
drive<U>(Animatable<U> child) Animation<U>
Chains a Tween (or CurveTween) to this Animation.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Calls all the listeners.
inherited
notifyStatusListeners(AnimationStatus status) → void
Calls all the status listeners.
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
toString() String
A string representation of this object.
override
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