TextConfig class

A Text Config contains all typographical information required to render texts; i.e., font size and color, family, etc.

It does not hold information regarding the position of the text to be render neither the text itself (the string). To hold all those information, use the Text component.

It is used by TextComponent.


TextConfig({double fontSize = 24.0, Color color = const Color(0xFF000000), String fontFamily = 'Arial', TextAlign textAlign = TextAlign.left, TextDirection textDirection = TextDirection.ltr, double lineHeight})
Creates a constant TextConfig with sensible defaults.


color Color
The font color to be used.
fontFamily String
The font family to be used. You can use available by default fonts for your platform (like Arial), or you can add custom fonts.
fontSize double
The font size to be used, in points.
hashCode int
The hash code for this object.
read-only, inherited
lineHeight double
The height of line, as a multiple of font size.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
textAlign TextAlign
The TextAlign to be used when creating the material.TextPainter.
textDirection TextDirection
The direction to render this text (left to right or right to left).


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
render(Canvas canvas, String text, Position p, {Anchor anchor = Anchor.topLeft}) → void
Renders a given text in a given position p using the provided canvas and anchor.
toString() String
A string representation of this object.
toTextPainter(String text) TextPainter
Returns a material.TextPainter that allows for text rendering and size measuring.
withColor(Color color) TextConfig
Creates a new TextConfig changing only the color.
withFontFamily(String fontFamily) TextConfig
Creates a new TextConfig changing only the fontFamily.
withFontSize(double fontSize) TextConfig
Creates a new TextConfig changing only the fontSize.
withTextAlign(TextAlign textAlign) TextConfig
Creates a new TextConfig changing only the textAlign.
withTextDirection(TextDirection textDirection) TextConfig
Creates a new TextConfig changing only the textDirection.


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