SceneView constructor

const SceneView({
  1. SceneController? controller,
  2. ImageResolver? imageResolver,
  3. SceneStaticLayerCache? staticLayerCache,
  4. SceneTextLayoutCache? textLayoutCache,
  5. SceneStrokePathCache? strokePathCache,
  6. SceneViewPointerSampleCallback? onPointerSampleBefore,
  7. SceneViewPointerSampleCallback? onPointerSampleAfter,
  8. ValueChanged<SceneController>? onControllerReady,
  9. PointerInputSettings? pointerSettings,
  10. double? dragStartSlop,
  11. String nodeIdGenerator()?,
  12. Color selectionColor = const Color(0xFF1565C0),
  13. double selectionStrokeWidth = 1,
  14. double gridStrokeWidth = 1,
  15. Key? key,
})

Creates a view for the provided controller.

If controller is null, the view creates and owns a controller with an empty scene. Use onControllerReady to access the internal controller once it is created.

When controller is null, pointerSettings, dragStartSlop, and nodeIdGenerator are used to configure the internal controller. These parameters are ignored when an external controller is provided.

If staticLayerCache is null, the view creates and owns an internal cache and disposes it when the view is disposed. If a cache is provided, the caller owns it and must dispose it.

If textLayoutCache / strokePathCache are null, the view creates and owns internal LRU caches to reduce per-frame work. If caches are provided, the caller owns them.

onPointerSampleBefore / onPointerSampleAfter let apps hook into the pointer pipeline without re-implementing input dispatch. The call order for each pointer sample is:

  1. Create PointerSample from the Flutter event
  2. Invoke onPointerSampleBefore
  3. Call controller.handlePointer(sample)
  4. Invoke onPointerSampleAfter
  5. Process internal pointer signals (double-tap) and schedule pending flush

Callbacks run synchronously and must not block for long.

Implementation

const SceneView({
  this.controller,
  this.imageResolver,
  this.staticLayerCache,
  this.textLayoutCache,
  this.strokePathCache,
  this.onPointerSampleBefore,
  this.onPointerSampleAfter,
  this.onControllerReady,
  this.pointerSettings,
  this.dragStartSlop,
  this.nodeIdGenerator,
  this.selectionColor = const Color(0xFF1565C0),
  this.selectionStrokeWidth = 1,
  this.gridStrokeWidth = 1,
  super.key,
});