DndDraggable class

A drag source for the Jaspr adapter.

DndDraggable registers a stable id with the enclosing DndScope's controller, measures its DOM element on activation, and drives the shared DndPointerSensor from browser pointer events. It uses pointer capture and element-level pointer events (wired through Jaspr's events: map), so it needs no document-level listeners and stays safe to import in any Jaspr render mode — all DOM access is guarded by kIsWeb.

Active drag visuals are rendered through DndDragOverlay, keeping the source subtree stable while the shared runtime updates pointer state.

Constructors

DndDraggable({required DndId id, required Component child, Object? data, bool disabled = false, DndSensorActivationConstraint constraint = DndSensorActivationConstraint.none, double keyboardDragStep = 25, String? label, String? description, DndDragStartCallback? onDragStart, DndDragMoveCallback? onDragMove, DndDragEndCallback? onDragEnd, DndDragCancelCallback? onDragCancel, Key? key})
Creates a draggable wrapping child.
const

Properties

child → Component
The visual content of the draggable.
final
constraint → DndSensorActivationConstraint
The activation constraint applied before a drag session starts.
final
data → Object?
Optional application-owned data associated with the draggable.
final
description → String?
Optional keyboard-usage instructions exposed to assistive tech.
final
disabled → bool
Whether dragging is disabled.
final
hashCode → int
The hash code for this object.
no setterinherited
id → DndId
The stable draggable id registered with the controller.
final
key → Key?
Controls how one component replaces another component in the tree.
finalinherited
keyboardDragStep → double
Logical pixels moved for each keyboard arrow key press.
final
label → String?
Optional accessible label applied as aria-label.
final
onDragCancel → DndDragCancelCallback?
Called when a pending or active drag is cancelled.
final
onDragEnd → DndDragEndCallback?
Called when the active drag ends.
final
onDragMove → DndDragMoveCallback?
Called when the active drag moves.
final
onDragStart → DndDragStartCallback?
Called when a drag session starts.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() → Element
Creates a StatefulElement to manage this component's location in the tree.
inherited
createState() → State<DndDraggable>
Creates the mutable state for this component at a given location in the tree.
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