getTextPainterFor function

TextPainter getTextPainterFor(
  1. String text,
  2. TextStyle textStyle, {
  3. TextDirection textDirection = TextDirection.ltr,
})

Implementation

TextPainter getTextPainterFor(
  String text,
  TextStyle textStyle, {
  TextDirection textDirection = TextDirection.ltr,
}) {
  final textSpan = TextSpan(text: text, style: textStyle);
  final textPainter = TextPainter(text: textSpan, textDirection: textDirection);
  textPainter.layout();
  return textPainter;
}