getParagraphLong method

Paragraph getParagraphLong(
  1. String text,
  2. double width, {
  3. double fontsize = 30,
  4. TextAlign align = TextAlign.left,
})

Returns a [ui.Paragraph] object for the given long text with the specified width, font size, and alignment. [text] is the long text to create the paragraph for. [width] is the width of the paragraph. [fontsize] is the font size to use for the paragraph. [align] is the alignment to use for the paragraph. Returns a [ui.Paragraph] object.

Implementation

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