dispatchEvent method

  1. @override
void dispatchEvent (PointerEvent event, HitTestResult result, { TestBindingEventSource source: TestBindingEventSource.device })
override

Dispatch an event to a hit test result's path.

This sends the given event to every HitTestTarget in the entries of the given HitTestResult, and catches exceptions that any of the handlers might throw. The result argument must not be null.

Implementation

@override
void dispatchEvent(PointerEvent event, HitTestResult result, {
  TestBindingEventSource source = TestBindingEventSource.device
}) {
  switch (source) {
    case TestBindingEventSource.test:
      if (!renderView._pointers.containsKey(event.pointer)) {
        assert(event.down);
        renderView._pointers[event.pointer] = _LiveTestPointerRecord(event.pointer, event.position);
      } else {
        renderView._pointers[event.pointer].position = event.position;
        if (!event.down)
          renderView._pointers[event.pointer].decay = _kPointerDecay;
      }
      _handleViewNeedsPaint();
      super.dispatchEvent(event, result, source: source);
      break;
    case TestBindingEventSource.device:
      if (deviceEventDispatcher != null)
        deviceEventDispatcher.dispatchEvent(event, result);
      break;
  }
}