主题
TextStyle
A style describing how to format and paint text.
属性
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
size | Optional[Number] | None | The size of glyphs (in logical pixels) to use when painting the text. Defaults to 14. |
height | Optional[Number] | None | The height of this text span, as a multiple of the font size. See detailed explanation here. |
weight | Optional[FontWeight] | None | The typeface thickness to use when painting the text (e.g., bold). Defaults to NORMAL. |
italic | bool | False | Whether to use italic typeface. |
decoration | Optional[TextDecoration] | None | The decorations to paint near the text (e.g., an underline). |
decoration_color | Optional[ColorValue] | None | The color in which to paint the text decorations. |
decoration_thickness | Optional[Number] | None | The thickness of the decoration stroke as a multiplier of the thickness defined by the font. |
decoration_style | Optional[TextDecorationStyle] | None | The style in which to paint the text decorations (e.g., dashed). Defaults to TextDecorationStyle.SOLID. |
font_family | Optional[str] | None | See https://flet.dev/docs/controls/text#font_family. |
font_family_fallback | Optional[list[str]] | None | Ordered fallback font families to use when glyphs are not available in font_family. |
color | Optional[ColorValue] | None | Text foreground https://flet.dev/docs/types/colors. |
bgcolor | Optional[ColorValue] | None | Text background https://flet.dev/docs/types/colors. |
shadow | Optional[BoxShadowValue] | None | A 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. |
foreground | Optional[Paint] | None | The paint drawn as a foreground for the text. |
letter_spacing | Optional[Number] | None | The amount of space (in logical pixels) to add between each letter. A negative value can be used to bring the letters closer. |
word_spacing | Optional[Number] | None | 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. |
overflow | Optional[TextOverflow] | None | How visual text overflow should be handled. |
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. |
方法
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
copy | — | — | 返回此对象的副本,可覆盖指定属性。 |