Listener constructor

const Listener(
  1. {Key key,
  2. PointerDownEventListener onPointerDown,
  3. PointerMoveEventListener onPointerMove,
  4. @Deprecated('Use MouseRegion.onEnter instead. See MouseRegion.opaque for behavioral difference. ' 'This feature was deprecated after v1.10.14.') PointerEnterEventListener onPointerEnter,
  5. @Deprecated('Use MouseRegion.onExit instead. See MouseRegion.opaque for behavioral difference. ' 'This feature was deprecated after v1.10.14.') PointerExitEventListener onPointerExit,
  6. @Deprecated('Use MouseRegion.onHover instead. See MouseRegion.opaque for behavioral difference. ' 'This feature was deprecated after v1.10.14.') PointerHoverEventListener onPointerHover,
  7. PointerUpEventListener onPointerUp,
  8. PointerCancelEventListener onPointerCancel,
  9. PointerSignalEventListener onPointerSignal,
  10. HitTestBehavior behavior: HitTestBehavior.deferToChild,
  11. Widget child}
)

Creates a widget that forwards point events to callbacks.

The behavior argument defaults to HitTestBehavior.deferToChild.

Implementation

const Listener({
  Key key,
  this.onPointerDown,
  this.onPointerMove,
  // We have to ignore the lint rule here in order to use deprecated
  // parameters and keep backward compatibility.
  // TODO(tongmu): After it goes stable, remove these 3 parameters from Listener
  // and Listener should no longer need an intermediate class _PointerListener.
  // https://github.com/flutter/flutter/issues/36085
  @Deprecated(
    'Use MouseRegion.onEnter instead. See MouseRegion.opaque for behavioral difference. '
    'This feature was deprecated after v1.10.14.'
  )
  this.onPointerEnter, // ignore: deprecated_member_use_from_same_package
  @Deprecated(
    'Use MouseRegion.onExit instead. See MouseRegion.opaque for behavioral difference. '
    'This feature was deprecated after v1.10.14.'
  )
  this.onPointerExit, // ignore: deprecated_member_use_from_same_package
  @Deprecated(
    'Use MouseRegion.onHover instead. See MouseRegion.opaque for behavioral difference. '
    'This feature was deprecated after v1.10.14.'
  )
  this.onPointerHover, // ignore: deprecated_member_use_from_same_package
  this.onPointerUp,
  this.onPointerCancel,
  this.onPointerSignal,
  this.behavior = HitTestBehavior.deferToChild,
  Widget child,
}) : assert(behavior != null),
     _child = child,
     super(key: key);