TextStyle
A style describing how to format and paint text.
Properties
baseline- The common baseline that should be aligned between this text span and its parent text span, or, for the root text spans, with the line box.bgcolor- Text background https://flet.dev/docs/types/colors.color- Text foreground https://flet.dev/docs/types/colors.decoration- The decorations to paint near the text (e.g., an underline).decoration_color- The color in which to paint the text decorations.decoration_style- The style in which to paint the text decorations (e.g., dashed).decoration_thickness- The thickness of the decoration stroke as a multiplier of the thickness defined by the font.font_family- See https://flet.dev/docs/controls/text#font_family.font_family_fallback- Ordered fallback font families to use when glyphs are not available infont_family.foreground- The paint drawn as a foreground for the text.height- The height of this text span, as a multiple of the font size.italic- Whether to use italic typeface.letter_spacing- The amount of space (in logical pixels) to add between each letter.overflow- How visual text overflow should be handled.shadow- A list of shadows painted underneath the text.size- The size of glyphs (in logical pixels) to use when painting the text.weight- The typeface thickness to use when painting the text (e.g., bold).word_spacing- The amount of space (in logical pixels) to add at each sequence of white-space (i.e.
Methods
copy- Returns a copy of this object with the specified properties overridden.
Properties
baselineclass-attributeinstance-attribute
baseline: TextBaseline | None = NoneThe common baseline that should be aligned between this text span and its parent text span, or, for the root text spans, with the line box.
bgcolorclass-attributeinstance-attribute
bgcolor: ColorValue | None = NoneText background https://flet.dev/docs/types/colors.
colorclass-attributeinstance-attribute
color: ColorValue | None = NoneText foreground https://flet.dev/docs/types/colors.
decorationclass-attributeinstance-attribute
decoration: TextDecoration | None = NoneThe decorations to paint near the text (e.g., an underline).
decoration_colorclass-attributeinstance-attribute
decoration_color: ColorValue | None = NoneThe color in which to paint the text decorations.
decoration_styleclass-attributeinstance-attribute
decoration_style: TextDecorationStyle | None = NoneThe style in which to paint the text decorations (e.g., dashed).
Defaults to TextDecorationStyle.SOLID.
decoration_thicknessclass-attributeinstance-attribute
decoration_thickness: Number | None = NoneThe thickness of the decoration stroke as a multiplier of the thickness defined by the font.
font_familyclass-attributeinstance-attribute
font_family: str | None = Nonefont_family_fallbackclass-attributeinstance-attribute
font_family_fallback: list[str] | None = NoneOrdered fallback font families to use when glyphs are not available in
font_family.
foregroundclass-attributeinstance-attribute
foreground: Paint | None = NoneThe paint drawn as a foreground for the text.
heightclass-attributeinstance-attribute
height: Number | None = NoneThe height of this text span, as a multiple of the font size.
See detailed explanation here.
letter_spacingclass-attributeinstance-attribute
letter_spacing: Number | None = NoneThe amount of space (in logical pixels) to add between each letter. A negative value can be used to bring the letters closer.
overflowclass-attributeinstance-attribute
overflow: TextOverflow | None = NoneHow visual text overflow should be handled.
shadowclass-attributeinstance-attribute
shadow: BoxShadowValue | None = NoneA list of shadows painted underneath the text.
Multiple shadows can be used to simulate lighting from multiple sources. Shadow order matters because different orders can produce different transparency results.
sizeclass-attributeinstance-attribute
size: Number | None = NoneThe size of glyphs (in logical pixels) to use when painting the text.
Defaults to 14.
weightclass-attributeinstance-attribute
weight: FontWeight | None = NoneThe typeface thickness to use when painting the text (e.g., bold).
Defaults to FontWeight.NORMAL.
Methods
copy
copy(
size: Number | None = None,
height: Number | None = None,
weight: FontWeight | None = None,
italic: bool | None = None,
decoration: TextDecoration | None = None,
decoration_color: ColorValue | None = None,
decoration_thickness: Number | None = None,
decoration_style: TextDecorationStyle | None = None,
font_family: str | None = None,
font_family_fallback: list[str] | None = None,
color: ColorValue | None = None,
bgcolor: ColorValue | None = None,
shadow: BoxShadowValue | None = None,
foreground: Paint | None = None,
letter_spacing: Number | None = None,
word_spacing: Number | None = None,
overflow: TextOverflow | None = None,
baseline: TextBaseline | None = None,
)Returns a copy of this object with the specified properties overridden.