TrainHoppingAnimation class Null safety

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.
read-only
hashCode int
The hash code for this object.
read-onlyinherited
isCompleted bool
Whether this animation is stopped at the end.
read-onlyinherited
isDismissed bool
Whether this animation is stopped at the beginning.
read-onlyinherited
onSwitchedTrain VoidCallback?
Called when this animation switches to be driven by the second animation.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
status AnimationStatus
The current status of this animation.
read-onlyoverride
value double
The current value of the animation.
read-onlyoverride

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.
protected">@protectedinherited
clearStatusListeners() → void
Removes all listeners added with addStatusListener.
protected">@protectedinherited
didRegisterListener() → void
This implementation ignores listener registrations.
protected">@protectedinherited
didUnregisterListener() → void
This implementation ignores listener registrations.
protected">@protectedinherited
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.
optionalTypeArgs">@optionalTypeArgsinherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
notifyListeners() → void
Calls all the listeners.
protected">@protectedinherited
notifyStatusListeners(AnimationStatus status) → void
Calls all the status listeners.
protected">@protectedinherited
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