Draggable class
The Draggable detects drag operations for touch and mouse interactions and optionally creates a drag avatar for visual feedback of the drag. Event streams are provided to track touch or mouse dragging:
A Draggable can be created for one Element or an ElementList.
Constructors
- Draggable(dynamic elementOrElementList, {AvatarHandler? avatarHandler, bool horizontalOnly = false, bool verticalOnly = false, String? handle, String cancel = 'input, textarea, button, select, option', String draggingClass = 'dnd-dragging', String draggingClassBody = 'dnd-drag-occurring', int minDragStartDistance = 4})
-
Creates a new Draggable for
elementOrElementList
. TheelementOrElementList
must be of type Element, ElementList, or List<Element>.
Properties
- avatarHandler ↔ AvatarHandler?
-
avatarHandler is a function to create a
DragAvatar
for this Draggable. See Draggable constructor.getter/setter pair - cancel ↔ String
-
Prevents dragging from starting on specified elements.
See Draggable constructor.
getter/setter pair
- clickSuppression ↔ int
-
The minimum distance for a drag to prevent click events.
DEPRECATED: Please use minDragStartDistance instead.
getter/setter pair
- draggingClass ↔ String
-
CSS class set to the dragged element during a drag.
See Draggable constructor.
getter/setter pair
- draggingClassBody ↔ String
-
CSS class set to the html body tag during a drag.
See Draggable constructor.
getter/setter pair
- handle ↔ String?
-
Restricts dragging from starting to the handle.
See Draggable constructor.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- horizontalOnly ↔ bool
-
When set to true, only horizontal dragging is tracked. This enables
vertical touch dragging to be used for scrolling.
getter/setter pair
- id → int
-
An auto-generated id used to identify this Draggable.
final
- minDragStartDistance ↔ int
-
The minimum distance in pixels that is needed for a drag to start.
See Draggable constructor.
getter/setter pair
-
onDrag
→ Stream<
DraggableEvent> -
Fired periodically throughout the drag operation.
no setter
-
onDragEnd
→ Stream<
DraggableEvent> -
Fired when the user ends the dragging.
Is also fired when the user clicks the 'esc'-key or the window loses focus.
no setter
-
onDragStart
→ Stream<
DraggableEvent> -
Fired when the user starts dragging.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- verticalOnly ↔ bool
-
When set to true, only vertical dragging is tracked. This enables
horizontal touch dragging to be used for scrolling.
getter/setter pair
Methods
-
abort(
) → void - Abort the current drag
-
destroy(
) → void - Resets the draggable elements to their initial state.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited