getParagraph method

Paragraph getParagraph(
  1. String text
)

Returns a ui.Paragraph object for the given text. text is the text to create the paragraph for. Returns a ui.Paragraph object.

Implementation

ui.Paragraph getParagraph(String text) {
  if (text.length == 1) text = "0$text";
  ui.ParagraphBuilder builder = ui.ParagraphBuilder(
      ui.ParagraphStyle(fontSize: 12.sp, textAlign: TextAlign.right))
    ..pushStyle(ui.TextStyle(color: Colors.black))
    ..addText(text);
  final ui.Paragraph paragraph = builder.build()
    ..layout(ui.ParagraphConstraints(width: 24.w));
  return paragraph;
}