StrokeOrderAnimationController constructor

StrokeOrderAnimationController(
  1. String _strokeOrder,
  2. dynamic tickerProvider, {
  3. double strokeAnimationSpeed = 1,
  4. double hintAnimationSpeed = 3,
  5. bool showStroke = true,
  6. bool showOutline = true,
  7. bool showMedian = false,
  8. bool showUserStroke = false,
  9. bool highlightRadical = false,
  10. Color strokeColor = Colors.blue,
  11. Color outlineColor = Colors.black,
  12. Color medianColor = Colors.black,
  13. Color radicalColor = Colors.red,
  14. Color brushColor = Colors.black,
  15. double brushWidth = 8.0,
  16. int hintAfterStrokes = 3,
  17. Color hintColor = Colors.lightBlueAccent,
  18. Function? onQuizCompleteCallback,
  19. Function? onWrongStrokeCallback,
  20. Function? onCorrectStrokeCallback,
})

Implementation

StrokeOrderAnimationController(
  this._strokeOrder,
  tickerProvider, {
  double strokeAnimationSpeed = 1,
  double hintAnimationSpeed = 3,
  bool showStroke = true,
  bool showOutline = true,
  bool showMedian = false,
  bool showUserStroke = false,
  bool highlightRadical = false,
  Color strokeColor = Colors.blue,
  Color outlineColor = Colors.black,
  Color medianColor = Colors.black,
  Color radicalColor = Colors.red,
  Color brushColor = Colors.black,
  double brushWidth = 8.0,
  int hintAfterStrokes = 3,
  Color hintColor = Colors.lightBlueAccent,
  Function? onQuizCompleteCallback,
  Function? onWrongStrokeCallback,
  Function? onCorrectStrokeCallback,
})  : _strokeColor = strokeColor,
      _showStroke = showStroke,
      _showOutline = showOutline,
      _showMedian = showMedian,
      _showUserStroke = showUserStroke,
      _highlightRadical = highlightRadical,
      _outlineColor = outlineColor,
      _medianColor = medianColor,
      _radicalColor = radicalColor,
      _brushColor = brushColor,
      _brushWidth = brushWidth,
      _hintAfterStrokes = hintAfterStrokes,
      _hintColor = hintColor,
      _strokeAnimationSpeed = strokeAnimationSpeed,
      _hintAnimationSpeed = hintAnimationSpeed,
      _strokeAnimationController = AnimationController(
        vsync: tickerProvider,
      ),
      _hintAnimationController = AnimationController(
        vsync: tickerProvider,
      ) {
  _strokeAnimationController.addStatusListener(_strokeCompleted);

  _hintAnimationController.addStatusListener((status) {
    if (status == AnimationStatus.completed) {
      _hintAnimationController.reset();
    }
  });

  setStrokeOrder(_strokeOrder);
  _setCurrentStroke(0);
  _summary = QuizSummary(_nStrokes);

  addOnQuizCompleteCallback(onQuizCompleteCallback);
  addOnWrongStrokeCallback(onWrongStrokeCallback);
  addOnCorrectStrokeCallback(onCorrectStrokeCallback);

  notifyListeners();
}