strokeText method
Implementation
void strokeText(String text, double x, double y, {double? maxWidth}) {
addAction((Canvas canvas, Size size) {
TextPainter textPainter = _getTextPainter(text, strokeStyle, shouldStrokeText: true);
if (maxWidth != null) {
// FIXME: should scale down to a smaller font size in order to fit the text in the specified width.
textPainter.layout(maxWidth: maxWidth);
} else {
textPainter.layout();
}
double offsetToBaseline = textPainter.computeDistanceToActualBaseline(TextBaseline.alphabetic);
// Paint text start with baseline.
textPainter.paint(canvas, Offset(x, y - offsetToBaseline) - _getAlignOffset(textPainter.width));
});
}