ClampedAnimation class
An animation that clamps the value of another animation within a specified range.
This animation proxies the parent animation but enforces a minimum and a maximum limit on its value. If the parent animation produces a value outside of this range, it is clamped to the nearest boundary defined by min and max.
The min value should be less than the max value.
Example usage:
final ClampedAnimation clampedAnimation = ClampedAnimation(
parent: parent,
min: 0.0,
max: 1.0,
);
Here clampedAnimation.value
will always be between 0.0 and 1.0, inclusive.
- Inheritance
-
- Object
- Listenable
- Animation<
double> - ClampedAnimation
- Mixed-in types
Constructors
-
ClampedAnimation({required Animation<
double> parent, required double min, required double max}) -
Creates a clamped animation with an invariant range.
const
Properties
- 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 setterinherited
- max → double
-
The maximum value of the clamped range.
final
- min → double
-
The minimum value of the clamped range.
final
-
parent
→ Animation<
double> -
The animation that this clamped animation is based on.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → AnimationStatus
-
The current status of this animation.
no setterinherited
- value → double
-
Gets the current value of the parent animation clamped to the range min to max.
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
-
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
-
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