getParagraphInfo method

Paragraph getParagraphInfo(
  1. String text, {
  2. double fontsize = 30,
})

Returns a [ui.Paragraph] object for the given text with the specified font size. [text] is the text to create the paragraph for. [fontsize] is the font size to use for the paragraph. Returns a [ui.Paragraph] object.

Implementation

ui.Paragraph getParagraphInfo(String text, {double fontsize = 30}) {
  if (text.length == 1) text = "0$text";
  ui.ParagraphBuilder builder = ui.ParagraphBuilder(
      ui.ParagraphStyle(fontSize: fontsize, textAlign: TextAlign.left))
    ..pushStyle(ui.TextStyle(color: Colors.black))
    ..addText(text);
  final ui.Paragraph paragraph = builder.build()
    ..layout(ui.ParagraphConstraints(width: paddingLeft! * 9));
  return paragraph;
}