AnimChain class

AnimChain lets you define a sequence of widgets, where each one will be displayed after the previous. You can chain widgets which are totally different from one another. However, if you define implicitly animated widgets (like AnimatedAlignPositioned, AnimatedContainer, AnimatedOpacity etc) you can create an animation.

Example:

return AnimChain(repeat: true, initialDelay: Duration(milliseconds: 150))
   // Show the yellow box and wait 5 seconds.
   .next(
      wait: Duration(seconds: 5),
      widget: AnimatedAlignPositioned(
         alignment: Alignment.bottomCenter,
         rotateDegrees: 0,
         child: Container(color: Colors.yellow),
         ),
      )
   // Rotate to the red box in 3 seconds.
   .next(
      wait: Duration(seconds: 3),
      widget: AnimatedAlignPositioned(
         duration: Duration(seconds: 3),
         rotateDegrees: 180,
         child: Container(color: Colors.red),
         ),
      )
   // Finally, translate the blue in the vertical axis.
   .next(
      widget: AnimatedAlignPositioned(
         duration: Duration(seconds: 15),
         alignment: Alignment.bottomCenter,
         dy: 150,
         rotateDegrees: 180,
         child: Container(color: Colors.blue),
         ),
      ),
    );
Inheritance

Constructors

AnimChain({Key? key, bool repeat = false, Duration? initialDelay})

Properties

durations List<Duration>
final
hashCode int
The hash code for this object.
no setterinherited
initialDelay Duration?
initialDelay is the initial delay before starting the animation chain. It's only applied at first, when the widget is put in the screen. It will not be repeated when repeat is true. For this reason, it is different from the delay you can apply when you use the wait parameter of the next method, which is repeated.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
repeat bool
if repeat is true, the animation chain will be repeated as soon as it ends. Otherwise, it will play only once.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
widgets List<Widget>
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _AnimChainState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
next({required Widget widget, Duration wait = const Duration()}) AnimChain
Define the next widget in the chain. The wait parameter specifies for how long it should be displayed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited