AnimatedWrap class

An animated version of Wrap that smoothly transitions children when their positions change.

Inheritance

Constructors

AnimatedWrap({Key? key, Axis direction = Axis.horizontal, WrapAlignment alignment = WrapAlignment.start, double spacing = 0.0, WrapAlignment runAlignment = WrapAlignment.start, double runSpacing = 0.0, AnimatedWrapCrossAlignment crossAxisAlignment = AnimatedWrapCrossAlignment.start, TextDirection? textDirection = TextDirection.ltr, VerticalDirection verticalDirection = VerticalDirection.down, Clip clipBehavior = Clip.none, List<Widget>? children = const <Widget>[], double sensitivity = 5, Duration movementDuration = defaultMoveAnimationDuration, Duration? removalDuration = defaultRemovalDuration, Widget removalBuilder(Widget child, Animation<double> controller)?, Duration? insertionDuration = defaultInsertionDuration, Widget insertionBuilder(Widget child, Animation<double> controller)?, Duration? staggeredInitialInsertionAnimation})
Creates an animated wrap layout.
const

Properties

alignment WrapAlignment
How the children within a run should be placed in the main axis. This has special significance for animation, as it's used as a hint as to how the topLeft of the widget may be moving in response to size changes in the AnimatedWrap. So, you can use this to fix certain animation glitches. As an example: if your AnimatedWrap is center-aligned within its parent, and the size of the AnimatedWrap increases, then if you incorrectly passed WrapAlignment.start, the children will glitch to the left before animating into place. You can fix that by passing WrapAlignment.center. runAlignment has the same dynamics but on the other axis.
final
children List<Widget>?
The widgets below this widget in the tree. if null, doesn't override the state's copy of the children. Set to null for stateful management of children (which you'd need if you want to remove without a removal animation, or if you want to insert directly from a drag animation)
final
clipBehavior Clip
The content will be clipped (or not) according to this option.
final
crossAxisAlignment AnimatedWrapCrossAlignment
How the children within a run should be aligned relative to each other in the cross axis.
final
direction Axis
The direction to use as the main axis.
final
hashCode int
The hash code for this object.
no setterinherited
insertionBuilder Widget Function(Widget child, Animation<double> controller)?
The builder that wraps widgets for insertion animations.
final
insertionDuration Duration?
The duration over which to animate the insertion of children.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
movementDuration Duration
The duration over which to animate changes in child positions.
final
removalBuilder Widget Function(Widget child, Animation<double> controller)?
The builder that wraps widgets for removal animations.
final
removalDuration Duration?
The duration over which to animate the removal of children.
final
runAlignment WrapAlignment
How the runs themselves should be placed in the cross axis. This also impacts how size change animations are processed, solving or causing animation glitches. (See alignment).
final
runSpacing double
How much space to place between the runs themselves in the cross axis.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sensitivity double
The minimum amount of movement required to trigger an animation. Movements smaller than this will happen instantly.
final
spacing double
How much space to place between children in a run in the main axis.
final
staggeredInitialInsertionAnimation Duration?
if non-null, we do an effect where the first children animate in with a cascade (the first one animates in immediately, the next one staggeredInitialInsertionAnimation later, etc.). Set this to zero if you just want stuff to animate in at the same time. Leave it as null if you don't want to run insertion animations for initial children.
final
textDirection TextDirection?
Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction.
final
verticalDirection VerticalDirection
Determines the order to lay children out vertically and how to interpret start and end in the vertical direction.
final
wrappingLineChangeAnimation bool
When a widget goes from one line to another, if this is false, it just moves there in the obvious way, while if this is true, it wraps out from the right side of the previous line, into the next line (it gets rendered twice to acheive this visual effect). Surprisingly, this looks way more normal in many cases.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<AnimatedWrap>
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
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

Static Methods

material3({Key? key, Axis direction = Axis.horizontal, WrapAlignment alignment = WrapAlignment.start, double spacing = 0.0, WrapAlignment runAlignment = WrapAlignment.start, double runSpacing = 0.0, AnimatedWrapCrossAlignment crossAxisAlignment = AnimatedWrapCrossAlignment.start, TextDirection textDirection = TextDirection.ltr, VerticalDirection verticalDirection = VerticalDirection.down, Clip clipBehavior = Clip.none, double sensitivity = 5, Duration movementDuration = material3MoveAnimationDuration, Duration removalDuration = material3RemovalDuration, Widget removalBuilder(Widget child, Animation<double> controller)?, Duration insertionDuration = material3InsertionDuration, Widget insertionBuilder(Widget child, Animation<double> controller)?, Duration? staggeredInitialInsertionAnimation, List<Widget> children = const <Widget>[]}) AnimatedWrap
Has a bunch of nice defaults that I think fit well into material design 3.