ParagraphBuilder class
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 new ParagraphBuilder 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
- 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
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
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. [...]
-
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. [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited