ToggleAnimation class
An animation controller that toggles between two states.
Rather than a bool, the value is a double ranging from 0.0 to 1.0.
This value is updated each frame throughout the duration, creating a
smooth transition between the "on" and "off" states.
See also:
- AnimationController, a multi-purpose controller that can
toggle,fling, or follow a Simulation. - CurvedAnimation, which can take a ToggleAnimation as its
parentand apply a Curve. - ValueAnimation, for controlling a curved animation of any type.
- Inheritance
-
- Object
- Listenable
- Animation<
double> - ToggleAnimation
Constructors
- ToggleAnimation({required TickerProvider vsync, required Duration duration, Duration? reverseDuration, bool maintainSpeed = true, AnimationBehavior animationBehavior = AnimationBehavior.normal})
- Creates a ToggleAnimation.
Properties
- animationBehavior → AnimationBehavior
-
The behavior of the controller when AccessibilityFeatures.disableAnimations
is true.
finalinherited
- duration ↔ Duration
-
The amount of time the animation should last.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAnimating → bool
-
Whether this animation is running in either direction.
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
- isForwardOrCompleted → bool
-
Whether the current aim of the animation is toward completion.
no setteroverride
- maintainSpeed → bool
-
If set to true, an animation that covers half the distance
(e.g.
animateTo(1.0, from: 0.5)) will finish in half the time.final - reverseDuration ↔ Duration?
-
The amount of time the animation should last if the value is decreasing.
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.
getter/setter pairoverride-getter
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
-
animateTo(
double target, {double? from}) → TickerFuture -
Runs an animation in which the value transitions to match the
target. -
clearListeners(
) → void -
Removes all listeners added with addListener.
inherited
-
clearStatusListeners(
) → void -
Removes all listeners added with addStatusListener.
inherited
-
didRegisterListener(
) → void -
Called immediately before a status listener is added via addStatusListener.
inherited
-
didUnregisterListener(
) → void -
Called immediately after a status listener is removed via removeStatusListener.
inherited
-
dispose(
) → void -
Release the resources used by this object. The object is no longer usable
after this method is called.
inherited
-
drive<
U> (Animatable< U> child) → Animation<U> -
Chains a Tween (or CurveTween) to this Animation.
inherited
-
forward(
{double? from}) → TickerFuture -
Toggles this animation toward the "on" state, i.e. a value of
1.0. -
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
-
reverse(
{double? from}) → TickerFuture -
Toggles this animation toward the "off" state, i.e. a value of
0.0. -
toggle(
{bool? forward}) → TickerFuture - Toggles the animation back and forth.
-
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