AnimationSpec class Animation
Specification for animating state changes.
You select the type of animation you want through the constructor you use to create the AnimationSpec.
const AnimationSpec()
uses uses defaultCurve and defaultDuration.- AnimationSpec.curve animates with a Curve over a fixed Duration.
Any AnimationSpec instance can be refined by calling one of the modifiers. A modifier returns a new AnimationSpec instance:
To apply an AnimationSpec to a state change, use Animated, withAnimation or AnimatingStateMixin.
Examples
Create an AnimationSpec with modifiers:
import 'package:flutter/animation.dart';
final animation = AnimationSpec.curve(Curves.ease, 300.ms)
.delay(250.s)
.repeat(2)
.speed(2.0);
- Mixed-in types
- Annotations
Constructors
- AnimationSpec()
-
Default animation which uses defaultCurve and defaultDuration.
const
- AnimationSpec.curve(Curve curve, [Duration duration = defaultDuration])
-
Animation which uses a
curve
and animates for a fixedduration
.
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
delay(
Duration delay) → AnimationSpec -
Returns a copy of this AnimationSpec which will start animating after
the given
delay
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
repeat(
int count, {bool reverse = true}) → AnimationSpec -
Returns a copy of this AnimationSpec which repeats
count
times. -
repeatForever(
{bool reverse = true}) → AnimationSpec - Returns a copy of this AnimationSpec which repeats forever.
-
speed(
double speed) → AnimationSpec -
Returns a copy of this AnimationSpec with the given
speed
. -
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Constants
- defaultCurve → const Curve
- The default Curve used for animations, when no curve is specified.
- defaultDuration → const Duration
- The default duration used for animations, when no duration is specified.