TextStyle class final
Flutter's TextStyle. Every field is optional: a span's style is merged
over its text's base style, as in Text.rich.
- Annotations
-
- @immutable
Constructors
-
TextStyle({String? fontFamily, List<
String> fontFamilyFallback = const [], int? fontWeight, FontStyle? fontStyle, double? fontSize, Color? color, Paint? foreground, double? letterSpacing, double? height, TextDecoration? decoration, Color? decorationColor, Color? backgroundColor, TextDecorationStyle? decorationStyle, double? decorationThickness, bool? tabularFigures, List<String> fontFeatures = const [], List<String> fontVariations = const [], TextLeadingDistribution? leadingDistribution, List<Effect> shadows = const [], String? from}) -
const
Properties
- backgroundColor → Color?
-
Painted behind the glyphs (a highlighted match): Flutter's
TextStyle.backgroundColor.final - color → Color?
-
Solid text color.
final
- decoration → TextDecoration?
-
final
- decorationColor → Color?
-
final
- decorationStyle → TextDecorationStyle?
-
final
- decorationThickness → double?
-
final
- fontFamily → String?
-
final
-
fontFamilyFallback
→ List<
String> -
final
-
fontFeatures
→ List<
String> -
OpenType feature settings (
TextStyle.fontFeatures): a four-character tag alone turns it on ("lnum","ss01"),tag=valuesets it ("liga=0"turns ligatures off,"salt=2"). A later entry for a tag wins;tnumis the same as tabularFigures.final - fontSize → double?
-
final
- fontStyle → FontStyle?
-
final
-
fontVariations
→ List<
String> -
A variable font's axes (
TextStyle.fontVariations, CSS'sfont-variation-settings):tag=valuefor each, a four-character axis tag and its value ("wdth=75"condensed,"opsz=24","slnt=-8"). A later entry for a tag wins. The weight axis follows fontWeight unless awghtentry sets it.final - fontWeight → int?
-
100–900.
final
- foreground → Paint?
-
A gradient or image paint for the glyphs, used instead of color.
final
- from → String?
-
The project's named text style this one starts from
(
ThemeTokens.textStyles), asTheme.of(context).textTheme.titleLarge .merge(this): its fields over the named style's. JSON:"style": "title", or{"from": "title", "color": "#FF..."}to change some of its fields. Resolved before rendering (resolveThemeRefs).final - hashCode → int
-
The hash code for this object.
no setteroverride
- height → double?
-
Line height as a multiple of the font size (Flutter's
height); null is the inherited default text style's (defaultTextStyle, Flutter'sDefaultTextStyle), or with none the font's own line height (its ascent, descent and line gap: Flutter'sheight: null, CSSline-height: normal).final - isEmpty → bool
-
no setter
- leadingDistribution → TextLeadingDistribution?
-
Where a line's extra (or missing) height goes (
TextStyle .leadingDistribution); null is Flutter's default, proportional.final - letterSpacing → double?
-
Logical pixels between letters.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
shadows
→ List<
Effect> -
Text shadows (drop shadows only).
final
- tabularFigures → bool?
-
Fixed-width digits (
OpenTypeFeature.tabularFigures).final
Methods
-
merge(
TextStyle? other) → TextStyle -
other's non-null fields over this style's. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Json -
toString(
) → String -
A string representation of this object.
override
-
withoutFrom(
) → TextStyle - This style without from.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override