ParagraphBuilder class Null safety
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.
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- placeholderCount → int
-
The number of placeholders currently in the paragraph.
read-only
-
placeholderScales
→ List<
double> -
The scales of the placeholders in the paragraph.
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
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 non-existent 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