setDownInfo method

bool setDownInfo(
  1. PointerEvent event,
  2. Offset newLocation,
  3. {int? buttons}
)

If a custom event is created outside of this class, this function is used to set the isDown.

Implementation

bool setDownInfo(
  PointerEvent event,
  Offset newLocation, {
  int? buttons,
}) {
  _location = newLocation;
  if (buttons != null) {
    _buttons = buttons;
  }
  switch (event.runtimeType) {
    case const (PointerDownEvent):
      assert(!isDown);
      _isDown = true;
    case const (PointerUpEvent):
    case const (PointerCancelEvent):
      assert(isDown);
      _isDown = false;
    default:
      break;
  }
  return isDown;
}