createPainter method
Implementation
TextPainter createPainter(double width, FlexMeasureMode widthMode) {
var unconstrainedWidth =
widthMode == FlexMeasureMode.undefined || width < 0;
var maxWidth = unconstrainedWidth ? double.infinity : width;
if (span == null || dirty) {
span = createSpan(useChild: true);
dirty = false;
}
var painter = TextPainter(
maxLines: _numberOfLines ?? kMaxLineCount,
text: span,
textDirection: TextDirection.ltr,
textAlign: _textAlign,
ellipsis: kEllipsis,
textScaleFactor: _generateTextScale(),
);
painter.setPlaceholderDimensions(_placeholderDimensions);
painter.layout(maxWidth: maxWidth);
return painter;
}