DragSelectGridView constructor
DragSelectGridView({
- Key? key,
- double? autoScrollHotspotHeight,
- ScrollController? scrollController,
- DragSelectGridViewController? gridController,
- bool triggerSelectionOnTap = false,
- bool reverse = false,
- bool? primary,
- ScrollPhysics? physics,
- bool shrinkWrap = false,
- EdgeInsetsGeometry? padding,
- required SliverGridDelegate gridDelegate,
- required SelectableWidgetBuilder 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,
Creates a grid that supports both dragging and tapping to select its items.
It is possible to customize the height of the hotspot that enables
auto-scroll by specifying autoScrollHotspotHeight
.
The gridController provides information that can be used to update the UI to indicate whether there are selected items and how many are selected, besides allowing to directly update the selected items.
By leaving unselectOnWillPop
false, the items won't get unselected when
the user tries to pop the route.
The itemBuilder must be used to create widgets based on the index and whether they are selected or not.
For information about the clause of the other parameters, refer to GridView.builder.
Implementation
DragSelectGridView({
Key? key,
double? autoScrollHotspotHeight,
ScrollController? scrollController,
this.gridController,
this.triggerSelectionOnTap = false,
this.reverse = false,
this.primary,
this.physics,
this.shrinkWrap = false,
this.padding,
required this.gridDelegate,
required this.itemBuilder,
this.itemCount,
this.addAutomaticKeepAlives = true,
this.addRepaintBoundaries = true,
this.addSemanticIndexes = true,
this.cacheExtent,
this.semanticChildCount,
this.dragStartBehavior = DragStartBehavior.start,
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
this.restorationId,
this.clipBehavior = Clip.hardEdge,
}) : autoScrollHotspotHeight =
autoScrollHotspotHeight ?? defaultAutoScrollHotspotHeight,
scrollController = scrollController ?? ScrollController(),
super(key: key);