onPanEnd method

void onPanEnd(
  1. DragEndDetails details
)

Implementation

void onPanEnd(DragEndDetails details) {
  if (!_isDrawing) return;

  _isDrawing = false;

  if (_currentStroke.isNotEmpty) {
    final stroke = DrawingStroke(
      points: List.from(_currentStroke),
      size: _brushSize,
      color: _maskColor,
      path: Path.from(_currentPath),
    );

    _strokes.add(stroke);
    _currentStroke.clear();
    _currentPath = Path();
    _redoStack.clear();
  }
  notifyListeners();
}