onPointerUp method

  1. @override
void onPointerUp(
  1. PointerUpEvent event
)
override

Used by the Listener callback to finish a line

Implementation

@override
void onPointerUp(PointerUpEvent event) {
  if (!value.supportedPointerKinds.contains(event.kind)) return;
  final pos =
      event.kind == PointerDeviceKind.mouse ? value.pointerPosition : null;
  if (value is Drawing) {
    value = _finishLineForState(_addPoint(event, value)).copyWith(
      pointerPosition: pos,
      activePointerIds:
          value.activePointerIds.where((id) => id != event.pointer).toList(),
    );
  } else if (value is Erasing) {
    value = _erasePoint(event).copyWith(
      pointerPosition: pos,
      activePointerIds:
          value.activePointerIds.where((id) => id != event.pointer).toList(),
    );
  }
}