createParagraph function

Paragraph createParagraph(
  1. String text,
  2. DrawableStyle style,
  3. DrawablePaint? foregroundOverride
)

Creates a Paragraph object using the specified text, style, and foregroundOverride.

Implementation

Paragraph createParagraph(
  String text,
  DrawableStyle style,
  DrawablePaint? foregroundOverride,
) {
  final ParagraphBuilder builder = ParagraphBuilder(ParagraphStyle())
    ..pushStyle(
      style.textStyle!.toFlutterTextStyle(
        foregroundOverride: foregroundOverride,
      ),
    )
    ..addText(text);
  return builder.build()..layout(_infiniteParagraphConstraints);
}