onTapUp method

void onTapUp(
  1. TapUpDetails details
)

Implementation

void onTapUp(TapUpDetails details) {
  if (!_hasPanned && _isDrawing) {
    final localPosition = details.localPosition;
    if (_isPointInBounds(localPosition)) {
      final tapPath = Path()
        ..addOval(Rect.fromCircle(
          center: localPosition,
          radius: _brushSize / 2,
        ));

      final tapStroke = DrawingStroke(
        points: [localPosition],
        size: _brushSize,
        color: _maskColor,
        path: tapPath,
      );

      _strokes.add(tapStroke);
      _redoStack.clear();

      _isDrawing = false;
      _currentStroke.clear();
      _currentPath = Path();
      notifyListeners();
    }
  } else if (_isDrawing) {
    _isDrawing = false;
    _currentStroke.clear();
    _currentPath = Path();
    notifyListeners();
  }
}