dispatchSelectionEventToChild method

  1. @override
SelectionResult dispatchSelectionEventToChild(
  1. Selectable selectable,
  2. SelectionEvent event
)
override

Dispatches a selection event to a specific Selectable.

Override this method if subclasses need to generate additional events or treatments prior to sending the SelectionEvent.

Implementation

@override
SelectionResult dispatchSelectionEventToChild(Selectable selectable, SelectionEvent event) {
  switch (event.type) {
    case SelectionEventType.startEdgeUpdate:
      didReceiveSelectionEventFor(selectable: selectable, forEnd: false);
      ensureChildUpdated(selectable);
    case SelectionEventType.endEdgeUpdate:
      didReceiveSelectionEventFor(selectable: selectable, forEnd: true);
      ensureChildUpdated(selectable);
    case SelectionEventType.clear:
      clearInternalSelectionStateForSelectable(selectable);
    case SelectionEventType.selectAll:
    case SelectionEventType.selectWord:
    case SelectionEventType.selectParagraph:
      break;
    case SelectionEventType.granularlyExtendSelection:
    case SelectionEventType.directionallyExtendSelection:
      didReceiveSelectionEventFor(selectable: selectable);
      ensureChildUpdated(selectable);
  }
  return super.dispatchSelectionEventToChild(selectable, event);
}