TextPaint class
TextRenderer
implementation based on Flutter's TextPainter.
This renderer uses a fixed style to draw the text. This style cannot be modified dynamically, if you need to change any attribute of the text at runtime, such as color, then create a new TextPaint object using copyWith.
Constructors
- TextPaint({TextStyle? style, TextDirection? textDirection})
Properties
- formatter → TextPainterTextFormatter
-
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → TextStyle
-
no setter
- textDirection → TextDirection
-
no setter
Methods
-
copyWith(
TextStyle transform(TextStyle), {TextDirection? textDirection}) → TextPaint -
measureText(
String text) → Vector2 -
Compute the dimensions of
text
when rendered.inherited -
measureTextHeight(
String text) → double -
Compute the height of
text
when rendered.inherited -
measureTextWidth(
String text) → double -
Compute the width of
text
when rendered.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render(
Canvas canvas, String text, Vector2 position, {Anchor anchor = Anchor.topLeft}) → void -
Renders
text
on thecanvas
at a givenposition
.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
toTextPainter(
String text) → TextPainter - Returns a TextPainter that allows for text rendering and size measuring.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultTextStyle → const TextStyle