setDownInfo method Null safety
- PointerEvent event,
- Offset newLocation,
- {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 PointerDownEvent:
assert(!isDown);
_isDown = true;
break;
case PointerUpEvent:
case PointerCancelEvent:
assert(isDown);
_isDown = false;
break;
default:
break;
}
return isDown;
}