ReorderableGridView.builder constructor
ReorderableGridView.builder({
- Key? key,
- required ReorderCallback onReorder,
- ScrollSpeedController? scrollSpeedController,
- DragWidgetBuilder? dragWidgetBuilder,
- DragWidgetBuilderV2? dragWidgetBuilderV2,
- PlaceholderBuilder? placeholderBuilder,
- OnDragStart? onDragStart,
- OnDragUpdate? onDragUpdate,
- bool reverse = false,
- ScrollController? controller,
- bool? primary,
- ScrollPhysics? physics,
- bool shrinkWrap = false,
- EdgeInsetsGeometry? padding,
- required SliverGridDelegate gridDelegate,
- required IndexedWidgetBuilder itemBuilder,
- int? itemCount,
- bool addAutomaticKeepAlives = true,
- bool addRepaintBoundaries = true,
- bool addSemanticIndexes = true,
- double? cacheExtent,
- int? semanticChildCount,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
- String? restorationId,
- Clip clipBehavior = Clip.hardEdge,
- Duration? dragStartDelay,
- bool? dragEnabled,
- bool restrictDragScope = false,
Implementation
ReorderableGridView.builder({
Key? key,
required ReorderCallback onReorder,
ScrollSpeedController? scrollSpeedController,
DragWidgetBuilder? dragWidgetBuilder,
DragWidgetBuilderV2? dragWidgetBuilderV2,
PlaceholderBuilder? placeholderBuilder,
OnDragStart? onDragStart,
OnDragUpdate? onDragUpdate,
bool reverse = false,
ScrollController? controller,
bool? primary,
ScrollPhysics? physics,
bool shrinkWrap = false,
EdgeInsetsGeometry? padding,
required SliverGridDelegate gridDelegate,
required IndexedWidgetBuilder itemBuilder,
int? itemCount,
bool addAutomaticKeepAlives = true,
bool addRepaintBoundaries = true,
bool addSemanticIndexes = true,
double? cacheExtent,
int? semanticChildCount,
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
ScrollViewKeyboardDismissBehavior keyboardDismissBehavior =
ScrollViewKeyboardDismissBehavior.manual,
String? restorationId,
Clip clipBehavior = Clip.hardEdge,
Duration? dragStartDelay,
bool? dragEnabled,
bool restrictDragScope = false,
}) : this(
key: key,
onReorder: onReorder,
dragWidgetBuilderV2: dragWidgetBuilderV2?? DragWidgetBuilderV2.createByOldBuilder9(dragWidgetBuilder),
scrollSpeedController: scrollSpeedController,
placeholderBuilder: placeholderBuilder,
onDragStart: onDragStart,
onDragUpdate: onDragUpdate,
// how to determine the
childrenDelegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
Widget child = itemBuilder(context, index);
assert(() {
if (child.key == null) {
throw FlutterError(
'Every item of ReorderableGridView must have a key.',
);
}
return true;
}());
return ReorderableItemView(
key: child.key!,
index: index,
child: child,
);
},
childCount: itemCount,
addAutomaticKeepAlives: addAutomaticKeepAlives,
addRepaintBoundaries: addRepaintBoundaries,
addSemanticIndexes: addSemanticIndexes,
),
gridDelegate: gridDelegate,
reverse: reverse,
controller: controller,
primary: primary,
physics: physics,
shrinkWrap: shrinkWrap,
padding: padding,
cacheExtent: cacheExtent,
semanticChildCount: semanticChildCount ?? itemCount,
dragStartBehavior: dragStartBehavior,
keyboardDismissBehavior: keyboardDismissBehavior,
restorationId: restorationId,
clipBehavior: clipBehavior,
dragStartDelay: dragStartDelay,
dragEnabled: dragEnabled,
restrictDragScope: restrictDragScope,
);