TextPaint class
It does not hold information regarding the position of the text to be rendered, nor does it contain the text itself (the string). To use that information, use the TextComponent, which uses TextPaint.
- Inheritance
-
- Object
- TextRenderer
- TextPaint
Constructors
- TextPaint.new({TextStyle? style, TextDirection? textDirection})
Properties
- 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
-
final
- textDirection → TextDirection
-
finalinherited
Methods
-
copyWith(
TextStyle transform(TextStyle), {TextDirection? textDirection}) → TextPaint -
measureText(
String text) → Vector2 -
Given a
text
String, returns a Vector2 with the size of thattext
has.inherited -
measureTextHeight(
String text) → double -
Given a
text
String, returns the height of thattext
.override -
measureTextWidth(
String text) → double -
Given a
text
String, returns the width of thattext
.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render(
Canvas canvas, String text, Vector2 p, {Anchor anchor = Anchor.topLeft}) → void -
Renders a given
text
in a given positionposition
using the providedcanvas
andanchor
.override -
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