checkStroke method

void checkStroke(
  1. List<Offset> stroke
)

Implementation

void checkStroke(List<Offset> stroke) {
  final strokeLength = getLength(stroke);

  if (isQuizzing &&
      currentStroke < strokeOrder.nStrokes &&
      strokeLength > 0) {
    if (strokeIsCorrect(strokeLength, stroke)) {
      notifyCorrectStrokeCallbacks();
      _summary.correctStrokePaths[currentStroke] = List.from(stroke);
      _setCurrentStroke(currentStroke + 1);

      if (currentStroke == strokeOrder.nStrokes) {
        stopQuiz();
        notifyQuizCompleteCallbacks();
      }
    } else {
      summary.mistakes[currentStroke] += 1;
      notifyWrongStrokeCallbacks();

      if (summary.mistakes[currentStroke] >= hintAfterStrokes) {
        animateHint();
      }
    }

    notifyListeners();
  }
}