ParagraphBuilder class abstract

Builds a Paragraph containing text with the given styling information.

To set the paragraph's alignment, truncation, and ellipsizing behavior, pass an appropriately-configured ParagraphStyle object to the ParagraphBuilder.new constructor.

Then, call combinations of pushStyle, addText, and pop to add styled text to the object.

Finally, call build to obtain the constructed Paragraph object. After this point, the builder is no longer usable.

After constructing a Paragraph, call Paragraph.layout on it and then paint it with Canvas.drawParagraph.

Constructors

ParagraphBuilder(ParagraphStyle style)
Creates a new ParagraphBuilder object, which is used to create a Paragraph.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
placeholderCount int
The number of placeholders currently in the paragraph.
no setter
placeholderScales List<double>
The scales of the placeholders in the paragraph.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addPlaceholder(double width, double height, PlaceholderAlignment alignment, {double scale = 1.0, double? baselineOffset, TextBaseline? baseline}) → void
Adds an inline placeholder space to the paragraph.
addText(String text) → void
Adds the given text to the paragraph.
build() Paragraph
Applies the given paragraph style and returns a Paragraph containing the added text and associated styling.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pop() → void
Ends the effect of the most recent call to pushStyle.
pushStyle(TextStyle style) → void
Applies the given style to the added text until pop is called.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

shouldDisableRoundingHack bool
Whether the rounding hack enabled by default in SkParagraph and TextPainter is disabled.
no setter

Static Methods

setDisableRoundingHack(bool disableRoundingHack) → void
Do not call this method as it is for migration purposes only and will soon be removed.