endStroke method
void
endStroke()
Commits the stroke in flight and starts the drying and arrow animations its brush has.
Implementation
void endStroke() {
if (currentPoints.isEmpty) return;
final stroke = Stroke(
points: List<StrokePoint>.of(currentPoints),
brushType: currentBrush,
color: currentColor,
thickness: _brushThicknessImageSpace,
isArrow: currentBrush == BrushType.arrow,
)..tailFactor = _activeWidthFactor;
strokes.add(stroke);
currentPoints.clear();
_activeCameraScale = 1.0;
_resetVelocityTracking();
if (stroke.isArrow) {
_computeArrowAnchor(stroke);
_runArrowAnimation(stroke);
}
if (_brushDries(stroke.brushType)) {
_runDryingAnimation(stroke);
} else {
stroke.tailFactor = 1.0;
}
notifyListeners();
}