ReorderableSliverList class
Reorderable (drag and drop) version of SliverList, a widget that places multiple box draggable children in a linear array along the main axis.
A ScrollController must be explicitly provided to CustomScrollView when wrapping the widget with a CustomScrollView.
{@tool sample}
This sample shows how to create a reorderable sliver list with a sliver app bar.
CustomScrollView(
// a ScrollController must be included in CustomScrollView, otherwise
// ReorderableSliverList won't work
controller: _scrollController,
slivers: <Widget>[
SliverAppBar(
expandedHeight: 210.0,
flexibleSpace: FlexibleSpaceBar(
title: Text('ReorderableSliverList'),
background: Image.network(
'https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/Yushan'
'_main_east_peak%2BHuang_Chung_Yu%E9%BB%83%E4%B8%AD%E4%BD%91%2B'
'9030.png/640px-Yushan_main_east_peak%2BHuang_Chung_Yu%E9%BB%83'
'%E4%B8%AD%E4%BD%91%2B9030.png'),
),
),
ReorderableSliverList(
delegate: ReorderableSliverChildListDelegate(_rows),
// or use ReorderableSliverChildBuilderDelegate if needed
//delegate: ReorderableSliverChildBuilderDelegate(
// (BuildContext context, int index) => _rows[index],
// childCount: _rows.length
//),
onReorder: _onReorder,
)
],
)
{@end-tool}
See also:
- SliverList, for how to use SliverList.
- ReorderableSliverChildBuilderDelegate, for the reorderable version of SliverChildBuilderDelegate.
- ReorderableSliverChildListDelegate, for the reorderable version of SliverChildListDelegate.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ReorderableSliverList
Constructors
- ReorderableSliverList({required SliverChildDelegate delegate, required ReorderCallback onReorder, BuildItemsContainer? buildItemsContainer, BuildDraggableFeedback? buildDraggableFeedback, NoReorderCallback? onNoReorder, ReorderStartedCallback? onReorderStarted, VoidCallback? onDragStart, VoidCallback? onDragEnd, bool enabled = true, Key? key})
- Creates a reorderable list.
Properties
- buildDraggableFeedback → BuildDraggableFeedback?
-
final
- buildItemsContainer → BuildItemsContainer?
-
final
- delegate → SliverChildDelegate
-
The delegate that provides the children for this widget.
final
- enabled → bool
-
Sets whether the children are reorderable or not
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onDragEnd → VoidCallback?
-
Called when the drag process has ended, either via Draggable.onDraggableCanceled or Draggable.onDragCompleted
final
- onDragStart → VoidCallback?
-
Called when a drag process is started
final
- onNoReorder → NoReorderCallback?
-
final
- onReorder → ReorderCallback
-
Called when a child is dropped into a new position to shuffle the
children.
final
- onReorderStarted → ReorderStartedCallback?
-
Called when the draggable starts being dragged.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _ReorderableSliverListState -
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