Listener constructor

const Listener({Key key, PointerDownEventListener onPointerDown, PointerMoveEventListener onPointerMove, @Deprecated('Use MouseRegion.onEnter instead') PointerEnterEventListener onPointerEnter, @Deprecated('Use MouseRegion.onExit instead') PointerExitEventListener onPointerExit, @Deprecated('Use MouseRegion.onHover instead') PointerHoverEventListener onPointerHover, PointerUpEventListener onPointerUp, PointerCancelEventListener onPointerCancel, PointerSignalEventListener onPointerSignal, HitTestBehavior behavior: HitTestBehavior.deferToChild, 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')
  this.onPointerEnter, // ignore: deprecated_member_use_from_same_package
  @Deprecated('Use MouseRegion.onExit instead')
  this.onPointerExit, // ignore: deprecated_member_use_from_same_package
  @Deprecated('Use MouseRegion.onHover instead')
  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);