DragSelectGridView class

Grid that supports both dragging and tapping to select its items.

By default, a long-press enables selection. The user may select/unselect any item by tapping on it. Dragging allows cascade select/unselect. The flag triggerSelectionOnTap allows selection to be enabled by tapping.

Through auto-scroll, this widget adds the ability to select items that go beyond screen bounds without having to stop the drag. To do so, this widget creates two imaginary zones that, if reached by the pointer while dragging, triggers the auto-scroll.

The first zone is at the top, and triggers backward auto-scrolling. The second is at the bottom, and triggers forward auto-scrolling.

Inheritance

Constructors

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, bool impliesAppBarDismissal = true})
Creates a grid that supports both dragging and tapping to select its items.

Properties

addAutomaticKeepAlives bool
Refer to SliverChildBuilderDelegate.addAutomaticKeepAlives.
final
addRepaintBoundaries bool
Refer to SliverChildBuilderDelegate.addRepaintBoundaries.
final
addSemanticIndexes bool
Refer to SliverChildBuilderDelegate.addSemanticIndexes.
final
autoScrollHotspotHeight double
The height of the hotspot that enables auto-scroll.
final
cacheExtent double?
Refer to ScrollView.cacheExtent.
final
clipBehavior Clip
Refer to ScrollView.clipBehavior.
final
dragStartBehavior DragStartBehavior
Refer to ScrollView.dragStartBehavior.
final
gridController DragSelectGridViewController?
Controller of the grid.
final
gridDelegate SliverGridDelegate
Refer to GridView.gridDelegate.
final
hashCode int
The hash code for this object.
no setterinherited
impliesAppBarDismissal bool
Refer to LocalHistoryEntry.impliesAppBarDismissal.
final
itemBuilder SelectableWidgetBuilder
Called whenever a child needs to be built.
final
itemCount int?
Refer to SliverChildBuilderDelegate.childCount.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardDismissBehavior ScrollViewKeyboardDismissBehavior
Refer to ScrollView.keyboardDismissBehavior.
final
padding EdgeInsetsGeometry?
Refer to BoxScrollView.padding.
final
physics ScrollPhysics?
Refer to ScrollView.physics.
final
primary bool?
Refer to ScrollView.primary.
final
restorationId String?
Refer to ScrollView.restorationId.
final
reverse bool
Refer to ScrollView.reverse.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ScrollController
Refer to ScrollView.controller.
final
semanticChildCount int?
Refer to ScrollView.semanticChildCount.
final
shrinkWrap bool
Refer to ScrollView.shrinkWrap.
final
triggerSelectionOnTap bool
Whether should start selection by tapping instead of long-pressing.
final

Methods

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

Constants

defaultAutoScrollHotspotHeight → const double
Default height of the hotspot that enables auto-scroll.