ReorderableListBuilder<T> class

You can configure reorderable lists in a similar fashion to ListBuilder.

Data is passed to source and each element is generated by builder.

By defining onReorder, a callback can be specified when the order is changed, and the actual data can be changed.

If top is set, the top elements are lined up before the source elements are lined up.

If bottom is set, the elements of bottom are lined up after the elements of source are lined up.

When insert is set, insert is inserted at the position of insertPosition in source.

If listenWhenListenable is true, ListenableListener will be wrapped around each element if source inherits Listenable. Therefore, each element of source is monitored individually, and if any element is updated, only that element is updated in the drawing.

ListBuilderと同じような形で順番変更可能なリストを構成することができます。

sourceにデータを渡し、builderで各要素の生成を行います。

onReorderを定義することで順番が変更されたときのコールバックを指定することができ、実データの変更を行うことが可能です。

topを設定するとsourceの要素を並べる前にtopの要素を並べます。

bottomを設定するとsourceの要素を並べた後にbottomの要素を並べます。

insertを設定するとsourceinsertPositionの位置にinsertが挿入されます。

listenWhenListenabletrueになっている場合、sourceListenableを継承している場合ListenableListenerが各要素にラップされます。 そのため、sourceの各要素をそれぞれ監視し、いずれかの要素が更新された場合その要素のみ描画が更新されます。

Inheritance
Available Extensions

Constructors

ReorderableListBuilder({Key? key, Axis scrollDirection = Axis.vertical, bool reverse = false, ScrollController? controller, bool? primary, ScrollPhysics? physics, bool shrinkWrap = false, EdgeInsetsGeometry? padding, List<Widget>? top, List<Widget>? insert, int insertPosition = 0, List<Widget>? bottom, double? itemExtent, required List<T> source, required List<Widget>? builder(BuildContext context, T item, int index), required void onReorder(int oldPosition, int newPosition, T item, List<T> reordered), double? cacheExtent, Object keyBuilder(T item)?, bool listenWhenListenable = true, DragStartBehavior dragStartBehavior = DragStartBehavior.start, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, String? restorationId, Clip clipBehavior = Clip.hardEdge})
You can configure reorderable lists in a similar fashion to ListBuilder.
const

Properties

bottom List<Widget>?
If bottom is set, the elements of bottom are lined up after the elements of source are lined up.
final
builder List<Widget>? Function(BuildContext context, T item, int index)
Builder to display on the list.
final
cacheExtent double?
Specify the area to hold the cache.
final
clipBehavior Clip
Specify here to adjust the clip function of the listing.
final
controller ScrollController?
If you want to control scrolling from the outside, pass ScrollController.
final
dragStartBehavior DragStartBehavior
Provides the ability to initiate a drag.
final
hashCode int
The hash code for this object.
no setterinherited
insert List<Widget>?
When insert is set, insert is inserted at the position of insertPosition in source.
final
insertPosition int
If an element of insert exists, insert insert at the insertPositionth position of source.
final
itemExtent double?
The height (width) of each element. If Null, the bare height (width) of each element is set.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardDismissBehavior ScrollViewKeyboardDismissBehavior
Define here if you want to implement a mechanism to close the keyboard triggered by scrolling.
final
keyBuilder → (Object Function(T item)?)
When reordering, a key identifying the element is required.
final
listenWhenListenable bool
If listenWhenListenable is true, ListenableListener will be wrapped around each element if source inherits Listenable. Therefore, each element of source is monitored individually, and if any element is updated, only that element is updated in the drawing.
final
onReorder → void Function(int oldPosition, int newPosition, T item, List<T> reordered)
Callback when the order is changed. This callback can be used to change the actual data.
final
padding EdgeInsetsGeometry?
List view padding.
final
physics ScrollPhysics?
Pass ScrollPhysics to set the scrolling method.
final
primary bool?
If this is true, it is recognized as the primary scrolling view.
final
restorationId String?
Restore ID to save and restore the scroll offset of the listing.
final
reverse bool
If this is true, the scroll direction is reversed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection Axis
Scroll direction.
final
shrinkWrap bool
If this is true, the area for scrolling is reduced to only where the content resides.
final
source List<T>
List of data to be displayed in the list.
final
top List<Widget>?
If top is set, the top elements are lined up before the source elements are lined up.
final

Methods

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

Static Methods

defaultOnReorder<M>(int oldPosition, int newPosition, M data, List<M> reordered, {required double onRetrieve(M data), required FutureOr<void> onUpdate(M data, double order), double? defaultOrderValue}) Future<M>
Method to define ReorderableListBuilder.onReorder when the data in the list consists of M.
defaultOnReorderForDynamicMap<M extends DynamicMap>(int oldPosition, int newPosition, M map, List<M> reordered, {FutureOr<void> onSaved(M data)?, String key = "order", double? defaultOrderValue}) Future<M>
Method to define ReorderableListBuilder.onReorder when the list data consists of DynamicMap.