A general-purpose widget for building animations.
AnimatedBuilder is useful for more complex widgets that wish to include an animation as part of a larger build function. To use AnimatedBuilder, simply construct the widget and pass it a builder function.
If your builder function contains a subtree that does not depend on the animation, it's more efficient to build that subtree once instead of rebuilding it on every animation tick.
If you pass the pre-built subtree as the child parameter, the AnimatedBuilder will pass it back to your builder function so that you can incorporate it into your build.
Using this pre-built child is entirely optional, but can improve performance significantly in some cases and is therefore a good practice.
For simple cases without additional state, consider using AnimatedWidget.
- Inheritance
- Object
- Widget
- StatefulWidget
- AnimatedWidget
- AnimatedBuilder
Constructors
- AnimatedBuilder({Key key, @required Animation<Object> animation, @required TransitionBuilder builder, Widget child })
-
Creates an animated builder.
Properties
- builder → TransitionBuilder
-
Called every time the animation changes value.
read-only - child → Widget
-
If your builder function contains a subtree that does not depend on the animation, it's more efficient to build that subtree once instead of rebuilding it on every animation tick.
read-only - animation → Animation<Object>
-
The animation to which this widget is listening.
read-only, inherited - hashCode → int
-
Get a hash code for this object.
read-only, inherited - key → Key
-
Controls how one widget replaces another widget in the tree.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
build(
BuildContext context) → Widget -
Override this method to build widgets that depend on the current value of the animation.
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited -
createState(
) → _AnimatedState -
Subclasses typically do not override this method.
inherited -
debugFillDescription(
List<String> description) → void -
Add additional information to the given description for use by
toString
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited -
toStringShort(
) → String -
A short, textual description of this widget.
inherited