ElementScope constructor

const ElementScope({
  1. Key? key,
  2. required Widget child,
  3. required void onDragStart(
    1. DragStartDetails details
    ),
  4. required void onDragUpdate(
    1. DragUpdateDetails details
    ),
  5. required void onDragEnd(
    1. DragEndDetails details
    ),
  6. VoidCallback? onDragCancel,
  7. bool isDraggable = true,
  8. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  9. VoidCallback? onTap,
  10. VoidCallback? onDoubleTap,
  11. void onContextMenu(
    1. ScreenPosition screenPosition
    )?,
  12. VoidCallback? onMouseEnter,
  13. VoidCallback? onMouseLeave,
  14. MouseCursor? cursor,
  15. HitTestBehavior hitTestBehavior = HitTestBehavior.opaque,
  16. AutoPanConfig? autoPan,
  17. void onAutoPan(
    1. Offset delta
    )?,
  18. Rect getViewportBounds()?,
  19. Offset screenToGraph(
    1. Offset screenPosition
    )?,
  20. PointerTracking pointerTracking = PointerTracking.anchored,
})

Creates an element scope with the specified interaction callbacks.

The onDragStart, onDragUpdate, and onDragEnd callbacks are required and form the core drag lifecycle. Other callbacks are optional.

Implementation

const ElementScope({
  super.key,
  required this.child,
  required this.onDragStart,
  required this.onDragUpdate,
  required this.onDragEnd,
  this.onDragCancel,
  this.isDraggable = true,
  this.dragStartBehavior = DragStartBehavior.start,
  this.onTap,
  this.onDoubleTap,
  this.onContextMenu,
  this.onMouseEnter,
  this.onMouseLeave,
  this.cursor,
  this.hitTestBehavior = HitTestBehavior.opaque,
  // Autopan parameters
  this.autoPan,
  this.onAutoPan,
  this.getViewportBounds,
  this.screenToGraph,
  this.pointerTracking = PointerTracking.anchored,
});