PlayAnimation<T> class
Widget that creates and plays an animation until the end.
You need to specify a tween that describes your animation and builder function that is called each frame you are animating. This function has signature of AnimatedWidgetBuilder.
It's also useful to specify a duration (default is 1 second).
To improve the performance of your animation you should put all widgets that are not effected by the animation into the child property. You get that child widget passed into the builder function. See also AnimatedWidgetBuilder.
If you specify a delay the animation will wait for the given duration until it will started animating.
The curve parameter can be used to apply a non-linear animation to your tween.
The callbacks onStart and onComplete can be used to track the start and end of an animation.
You can optionally limit the framerate (fps) of the animation by setting the fps value.
If you work with multiple animation widgets that are conditionally rendered, you might want to set a key. Otherwise Flutter will recycled your "old animation" which results in strange behavior.
You can connect this widget to the closest AnimationDeveloperTools
by setting developerMode to true
.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- PlayAnimation
Constructors
-
PlayAnimation({required AnimatedWidgetBuilder<
T> builder, required Animatable<T> tween, Duration duration = const Duration(seconds: 1), Duration delay = Duration.zero, Curve curve = Curves.linear, Widget? child, int? fps, bool developerMode = false, VoidCallback? onStart, VoidCallback? onComplete, Key? key}) -
Creates a new PlayAnimation widget.
See class documentation for more information.
const
Properties
-
builder
→ AnimatedWidgetBuilder<
T> -
final
- child → Widget?
-
final
- curve → Curve
-
final
- delay → Duration
-
final
- developerMode → bool
-
final
- duration → Duration
-
final
- fps → int?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onComplete → VoidCallback?
-
final
- onStart → VoidCallback?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
tween
→ Animatable<
T> -
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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
-
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, int wrapWidth = 65}) → 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