AnimatedReorderableListView<E extends Object> class
A ListView that enables users to interactively reorder items through dragging, with animated insertion and removal of items.
enterTransition: FadeEffect(), ScaleEffect()
,
Effects are always run in parallel (ie. the fade and scale effects in the example above would be run simultaneously), but you can apply delays to offset them or run them in sequence.
The onReorder parameter is required and will be called when a child widget is dragged to a new position.
By default, on TargetPlatformVariant.desktop
platforms each item will
have a drag handle added on top of it that will allow the user to grab it
to move the item. On TargetPlatformVariant.mobile
, no drag handle will be
added, but when the user long presses anywhere on the item it will start
moving the item.Displaying drag handles can be controlled with AnimatedReorderableListView.buildDefaultDragHandles.
All list items must have a key.
While a drag is underway, the widget returned by the AnimatedReorderableGridView.proxyDecorator callback serves as a "proxy" (a substitute) for the item in the list. The proxy is created with the original list item as its child.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AnimatedReorderableListView
Constructors
-
AnimatedReorderableListView({Key? key, required List<
E> items, required ItemBuilder<Widget, dynamic> itemBuilder, required ReorderCallback onReorder, List<AnimationEffect> ? enterTransition, List<AnimationEffect> ? exitTransition, Duration? insertDuration, Duration? removeDuration, void onReorderStart(int)?, void onReorderEnd(int)?, ReorderItemProxyDecorator? proxyDecorator, Axis scrollDirection = Axis.vertical, EdgeInsetsGeometry? padding, bool reverse = false, ScrollController? controller, bool? primary, ScrollPhysics? physics, ScrollBehavior? scrollBehavior, String? restorationId, bool buildDefaultDragHandles = true, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, DragStartBehavior dragStartBehavior = DragStartBehavior.start, Clip clipBehavior = Clip.hardEdge, AnimatedWidgetBuilder<Widget, dynamic> ? insertItemBuilder, AnimatedWidgetBuilder<Widget, dynamic> ? removeItemBuilder}) -
const
Properties
- buildDefaultDragHandles → bool
-
If true, on desktop platforms, a drag handle is stacked over the center of each item's trailing edge;
on mobile platforms, a long press anywhere on the item starts a drag.
final
- clipBehavior → Clip
-
Defaults to Clip.hardEdge.
final
- controller → ScrollController?
-
ScrollController to get the current scroll position.
final
- dragStartBehavior → DragStartBehavior
-
Creates a ScrollView that creates custom scroll effects using slivers.
See the ScrollView constructor for more details on these arguments.
final
-
enterTransition
→ List<
AnimationEffect> ? -
List of AnimationEffect used for the appearing animation when an item was inserted into the list.
final
-
exitTransition
→ List<
AnimationEffect> ? -
List of AnimationEffect used for the disappearing animation when an item was removed from the list.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- insertDuration → Duration?
-
The duration of the animation when an item was inserted into the list.
final
-
insertItemBuilder
→ AnimatedWidgetBuilder<
Widget, dynamic> ? -
A custom builder that is for adding items with animations.
final
-
itemBuilder
→ ItemBuilder<
Widget, dynamic> -
Called, as needed, to build list item widget
final
-
items
→ List<
E> -
The current list of items that thisAnimatedReorderableListView should represent.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardDismissBehavior → ScrollViewKeyboardDismissBehavior
-
ScrollViewKeyboardDismissBehavior the defines how this ScrollView will
dismiss the keyboard automatically.
final
- onReorder → ReorderCallback
-
A callback used by ReorderableList to report that a list item has moved
to a new position in the list.
final
- onReorderEnd → (void Function(int)?)
-
A callback that is called when the dragged item is dropped.
final
- onReorderStart → (void Function(int)?)
-
A callback that is called when an item drag has started.
final
- padding → EdgeInsetsGeometry?
-
The amount of space by which to inset the list contents.
final
- physics → ScrollPhysics?
-
How the scroll view should respond to user input.
final
- primary → bool?
-
When this is true, the scroll view is scrollable even if it does not have
sufficient content to actually scroll. Otherwise, by default the user can
only scroll the view if it has sufficient content. See physics.
final
- proxyDecorator → ReorderItemProxyDecorator?
-
A callback that allows the app to add an animated decoration around
an item when it is being dragged.
final
- removeDuration → Duration?
-
The duration of the animation when an item was removed from the list.
final
-
removeItemBuilder
→ AnimatedWidgetBuilder<
Widget, dynamic> ? -
A custom builder that is for removing items with animations.
final
- restorationId → String?
-
Creates a ScrollView that creates custom scroll effects using slivers.
See the ScrollView constructor for more details on these arguments.
final
- reverse → bool
-
Whether the scroll view scrolls in the reading direction.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollBehavior → ScrollBehavior?
-
ScrollBehaviors also provide ScrollPhysics. If an explicit
ScrollPhysics is provided in physics, it will take precedence,
followed by scrollBehavior, and then the inherited ancestor
ScrollBehavior.
final
- scrollDirection → Axis
-
The axis along which the scroll view scrolls.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AnimatedReorderableListView< E> > -
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}) → 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