Listener constructor

const Listener(
  1. {Key key,
  2. void onPointerDown(
    1. PointerDownEvent event
    ),
  3. void onPointerMove(
    1. PointerMoveEvent event
    ),
  4. @Deprecated('Use MouseRegion.onEnter instead. See MouseRegion.opaque for behavioral difference. ' 'This feature was deprecated after v1.10.14.') void onPointerEnter(
    1. PointerEnterEvent event
    ),
  5. @Deprecated('Use MouseRegion.onExit instead. See MouseRegion.opaque for behavioral difference. ' 'This feature was deprecated after v1.10.14.') void onPointerExit(
    1. PointerExitEvent event
    ),
  6. @Deprecated('Use MouseRegion.onHover instead. See MouseRegion.opaque for behavioral difference. ' 'This feature was deprecated after v1.10.14.') void onPointerHover(
    1. PointerHoverEvent event
    ),
  7. void onPointerUp(
    1. PointerUpEvent event
    ),
  8. void onPointerCancel(
    1. PointerCancelEvent event
    ),
  9. void onPointerSignal(
    1. PointerSignalEvent event
    ),
  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,
  @Deprecated(
    'Use MouseRegion.onExit instead. See MouseRegion.opaque for behavioral difference. '
    'This feature was deprecated after v1.10.14.'
  )
  this.onPointerExit,
  @Deprecated(
    'Use MouseRegion.onHover instead. See MouseRegion.opaque for behavioral difference. '
    'This feature was deprecated after v1.10.14.'
  )
  this.onPointerHover,
  this.onPointerUp,
  this.onPointerCancel,
  this.onPointerSignal,
  this.behavior = HitTestBehavior.deferToChild,
  Widget child,
}) : assert(behavior != null),
     _child = child,
     super(key: key);