TextStyle
A style describing how to format and paint text.
Properties
-
baseline(Optional[TextBaseline]) –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(Optional[ColorValue]) –Text background https://flet.dev/docs/reference/colors.
-
color(Optional[ColorValue]) –Text foreground https://flet.dev/docs/reference/colors.
-
decoration(Optional[TextDecoration]) –The decorations to paint near the text (e.g., an underline).
-
decoration_color(Optional[ColorValue]) –The color in which to paint the text decorations.
-
decoration_style(Optional[TextDecorationStyle]) –The style in which to paint the text decorations (e.g., dashed).
-
decoration_thickness(Optional[Number]) –The thickness of the decoration stroke as a multiplier of the thickness defined by the font.
-
font_family(Optional[str]) – -
foreground(Optional[Paint]) –The paint drawn as a foreground for the text.
-
height(Optional[Number]) –The height of this text span, as a multiple of the font size.
-
italic(bool) –Whether to use italic typeface.
-
letter_spacing(Optional[Number]) –The amount of space (in logical pixels) to add between each letter. A negative value can be used to bring the letters closer.
-
overflow(Optional[TextOverflow]) –How visual text overflow should be handled.
-
shadow(Optional[BoxShadowValue]) –TBD
-
size(Optional[Number]) –The size of glyphs (in logical pixels) to use when painting the text.
-
weight(Optional[FontWeight]) –The typeface thickness to use when painting the text (e.g., bold).
-
word_spacing(Optional[Number]) –The amount of space (in logical pixels) to add at each sequence of white-space (i.e. between each word). A negative value can be used to bring the words closer.
Methods
-
copy–
Properties#
baseline
class-attribute
instance-attribute
#
baseline: Optional[TextBaseline] = None
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
class-attribute
instance-attribute
#
bgcolor: Optional[ColorValue] = None
Text background https://flet.dev/docs/reference/colors.
color
class-attribute
instance-attribute
#
color: Optional[ColorValue] = None
Text foreground https://flet.dev/docs/reference/colors.
decoration
class-attribute
instance-attribute
#
decoration: Optional[TextDecoration] = None
The decorations to paint near the text (e.g., an underline).
decoration_color
class-attribute
instance-attribute
#
decoration_color: Optional[ColorValue] = None
The color in which to paint the text decorations.
decoration_style
class-attribute
instance-attribute
#
decoration_style: Optional[TextDecorationStyle] = None
The style in which to paint the text decorations (e.g., dashed).
Defaults to TextDecorationStyle.SOLID.
decoration_thickness
class-attribute
instance-attribute
#
The thickness of the decoration stroke as a multiplier of the thickness defined by the font.
font_family
class-attribute
instance-attribute
#
foreground
class-attribute
instance-attribute
#
The paint drawn as a foreground for the text.
height
class-attribute
instance-attribute
#
The height of this text span, as a multiple of the font size.
See detailed explanation here.
letter_spacing
class-attribute
instance-attribute
#
The amount of space (in logical pixels) to add between each letter. A negative value can be used to bring the letters closer.
overflow
class-attribute
instance-attribute
#
overflow: Optional[TextOverflow] = None
How visual text overflow should be handled.
size
class-attribute
instance-attribute
#
The size of glyphs (in logical pixels) to use when painting the text.
Defaults to 14.
weight
class-attribute
instance-attribute
#
weight: Optional[FontWeight] = None
The typeface thickness to use when painting the text (e.g., bold).
Defaults to FontWeight.NORMAL.
word_spacing
class-attribute
instance-attribute
#
The amount of space (in logical pixels) to add at each sequence of white-space (i.e. between each word). A negative value can be used to bring the words closer.
Methods#
copy
#
copy(
*,
size: Optional[Number] = None,
height: Optional[Number] = None,
weight: Optional[FontWeight] = None,
italic: Optional[bool] = None,
decoration: Optional[TextDecoration] = None,
decoration_color: Optional[ColorValue] = None,
decoration_thickness: Optional[Number] = None,
decoration_style: Optional[TextDecorationStyle] = None,
font_family: Optional[str] = None,
color: Optional[ColorValue] = None,
bgcolor: Optional[ColorValue] = None,
shadow: Optional[BoxShadowValue] = None,
foreground: Optional[Paint] = None,
letter_spacing: Optional[Number] = None,
word_spacing: Optional[Number] = None,
overflow: Optional[TextOverflow] = None,
baseline: Optional[TextBaseline] = None,
)