TextStyle class

A styling class for text that mimics Flutter's TextStyle and converts to CSS styles.

Constructors

TextStyle({bool truncate = false, bool selectable = false, bool softWrap = false, Display? display, Color? color, Dim? fontSize, Color? backgroundColor, Gradient? gradient, FontWeight? fontWeight, FontStyle? fontStyle, FontFamily? fontFamily, Dim? letterSpacing, Dim? wordSpacing, Dim? lineHeight, TextDecorationLine? decorationLine, Color? decorationLineColor, TextDecorationStyle? decorationStyle, Dim? decorationThickness, Dim? width, TextAlign? textAlign, int? maxLines, EdgeInsets? padding, EdgeInsets? margin, Map<String, String>? extra, Color? selectionBackgroundColor, Color? selectionTextColor, TextOverflow? overflow})
Creates a new TextStyle with the given styling attributes.
const

Properties

backgroundColor → Color?
Background color of text.
final
color → Color?
Color to use when painting the text (default: currentcolor)
final
cssText → String
Returns the CSS text from the style properties.
no setter
decorationLine → TextDecorationLine?
Line decoration to paint on or near the text.
final
decorationLineColor → Color?
Color in which to paint the text line decoration.
final
decorationStyle → TextDecorationStyle?
Style in which to paint the text decoration (e.g. dashed).
final
decorationThickness → Dim?
Thickness of the text decoration.
final
display → Display?
Display property of the text.
final
extra → Map<String, String>?
Additional CSS style properties applied to the text.
final
fontFamily → FontFamily?
Font family to use when painting the text (e.g. 'Inter', 'sans-serif').
final
fontSize → Dim?
Size of glyphs when painting the text.
final
fontStyle → FontStyle?
Typeface style (e.g. italic) to use when painting the text.
final
fontWeight → FontWeight?
Typeface thickness to use when painting the text.
final
gradient → Gradient?
Background gradient of text.
final
hashCode → int
The hash code for this object.
no setterinherited
letterSpacing → Dim?
Space to add between font glyphs.
final
lineHeight → Dim?
Line height of the text.
final
margin → EdgeInsets?
Margin of the text.
final
maxLines → int?
Maximum lines of text to display. If null, the full text will be rendered, otherwise the text will be truncated with an ellipsis if it overflows more than the allowed lines.
final
overflow → TextOverflow?
Text overflow behavior.
final
padding → EdgeInsets?
Padding of the text.
final
props → Map<String, String>
Converts the text style attributes to a CSS style map.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectable → bool
If true, the text will be selectable.
final
selectionBackgroundColor → Color?
Background color of text when selected.
final
selectionTextColor → Color?
Color of text when selected.
final
softWrap → bool
Whether the text should break at soft line breaks.
final
textAlign → TextAlign?
Alignment of the text.
final
truncate → bool
If true, the text will be truncated with an ellipsis if it overflows. This property is ignored if maxLines is greater than 1.
final
width → Dim?
Width of the text.
final
wordSpacing → Dim?
Space to add between words.
final

Methods

combineWith(TextStyle? other) → TextStyle
Combines this text style with another text style. other is the style that takes precedence.
copyWith({Display? display, Color? color, Color? backgroundColor, Gradient? gradient, bool? softWrap, Dim? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, FontFamily? fontFamily, Dim? letterSpacing, Dim? wordSpacing, Dim? lineHeight, Dim? width, TextDecorationLine? decorationLine, Color? decorationLineColor, TextDecorationStyle? decorationStyle, Dim? decorationThickness, TextAlign? textAlign, bool? truncate, bool? selectable, int? maxLines, EdgeInsets? padding, EdgeInsets? margin, Map<String, String>? extra, Color? selectionBackgroundColor, Color? selectionTextColor, TextOverflow? overflow}) → TextStyle
Creates a copy of this text style with the existing style attributes replaced with the new values, while null attributes remain unchanged.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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