AnimatedReorderableGridView<E extends Object> class
A GridView that enables users to interactively reorder items through dragging, with animated insertion and removal of items.
enterTransition: [FadeIn(), ScaleIn()],
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.
All list items must have a key.
While a drag is underway, the widget returned by the AnimatedReorderableListView.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
- AnimatedReorderableGridView
Constructors
-
AnimatedReorderableGridView.new({Key? key, required List<
E> items, required ItemBuilder<Widget, E> itemBuilder, required SliverGridDelegate sliverGridDelegate, required ReorderCallback onReorder, List<AnimationEffect> ? enterTransition, List<AnimationEffect> ? exitTransition, Duration? insertDuration, Duration? removeDuration, void onReorderStart(int)?, void onReorderEnd(int)?, ReorderItemProxyDecorator? proxyDecorator, EdgeInsetsGeometry? padding, Axis scrollDirection = Axis.vertical, bool reverse = false, ScrollController? controller, bool? primary, ScrollPhysics? physics, ScrollBehavior? scrollBehavior, String? restorationId, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, DragStartBehavior dragStartBehavior = DragStartBehavior.start, Clip clipBehavior = Clip.hardEdge, bool longPressDraggable = true, bool shrinkWrap = false, AnimatedWidgetBuilder<Widget, dynamic> ? insertItemBuilder, AnimatedWidgetBuilder<Widget, dynamic> ? removeItemBuilder, required bool isSameItem(E a, E b), Duration dragStartDelay = const Duration(milliseconds: 500), List<E> nonDraggableItems = const [], List<E> lockedItems = const [], bool enableSwap = true}) -
Creates a AnimatedReorderableGridView that enables users to interactively reorder items through dragging,
with animated insertion and removal of items.
const
Properties
- 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
- dragStartDelay → Duration
-
The amount of time to wait before starting the drag operation.
final
- enableSwap → bool
-
Whether to enable swap animation when changing the order of the items.
final
-
enterTransition
→ List<
AnimationEffect> ? -
A list of AnimationEffect used for the appearing animation when an item is added to the list.
final
-
exitTransition
→ List<
AnimationEffect> ? -
A 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 is inserted into the list.
final
-
insertItemBuilder
→ AnimatedWidgetBuilder<
Widget, dynamic> ? -
A custom builder that is for adding items with animations.
final
- isSameItem → bool Function(E a, E b)
-
A callback function to determine if two items in the list are considered the same.
final
-
itemBuilder
→ ItemBuilder<
Widget, E> -
Called, as needed, to build list item widgets.
final
-
items
→ List<
E> -
The current list of items that thisAnimatedReorderableGridView 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
-
lockedItems
→ List<
E> -
A list of items that are locked and can't be reordered.
final
- longPressDraggable → bool
-
Set dragStartDelay to Duration.zero to start the drag operation immediately.
final
-
nonDraggableItems
→ List<
E> -
A list of items that are not draggable.
final
- onReorder → ReorderCallback
-
A callback used by AnimatedReorderableGridView 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 is 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
- shrinkWrap → bool
-
Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed.
final
- sliverGridDelegate → SliverGridDelegate
-
Controls the layout of tiles in a grid.
Given the current constraints on the grid,
a SliverGridDelegate computes the layout for the tiles in the grid.
The tiles can be placed arbitrarily,
but it is more efficient to place tiles in roughly in order by scroll offset because grids reify a contiguous sequence of children.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< AnimatedReorderableGridView< 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, 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
-
maybeOf(
BuildContext context) → AnimatedReorderableGridViewState< Object> ? - The state from the closest instance of this class that encloses the given context.
-
of(
BuildContext context) → AnimatedReorderableGridViewState< Object> - The state from the closest instance of this class that encloses the given context.