StrokeOrderAnimationController(- String _strokeOrder,
- dynamic 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}
)
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();
}