plushie/widget/text
Text widget builder.
Types
Option type for text properties.
pub type Opt {
Size(Float)
Color(color.Color)
Font(font.Font)
Width(length.Length)
Height(length.Length)
LineHeight(line_height.LineHeight)
AlignX(alignment.Alignment)
AlignY(alignment.Alignment)
Wrapping(wrapping.Wrapping)
Ellipsis(String)
TextDirection(text_direction.TextDirection)
Shaping(shaping.Shaping)
Style(TextStyle)
A11y(a11y.A11y)
}
Constructors
-
Size(Float) -
Color(color.Color) -
Font(font.Font) -
Width(length.Length) -
Height(length.Length) -
LineHeight(line_height.LineHeight) -
AlignX(alignment.Alignment) -
AlignY(alignment.Alignment) -
Wrapping(wrapping.Wrapping) -
Ellipsis(String) -
TextDirection(text_direction.TextDirection) -
Shaping(shaping.Shaping) -
Style(TextStyle) -
A11y(a11y.A11y)
pub type TextStyle {
DefaultStyle
PrimaryStyle
SecondaryStyle
SuccessStyle
DangerStyle
WarningStyle
Custom(style_map.StyleMap)
}
Constructors
-
DefaultStyle -
PrimaryStyle -
SecondaryStyle -
SuccessStyle -
DangerStyle -
WarningStyle -
Custom(style_map.StyleMap)Reusable-design-token style: pass a StyleMap that other widgets may also honor (background, border, shadow, state overrides). Only
text_coloris currently applied by the text widget itself; other fields are silently ignored for raw text. Wrap text in a container to apply background / border / shadow.
Values
pub fn align_x(text: Text, a: alignment.Alignment) -> Text
Set the horizontal alignment.
pub fn line_height(
text: Text,
lh: line_height.LineHeight,
) -> Text
Set the line height.
pub fn line_height_animated(
text: Text,
animation: node.PropValue,
) -> Text
Set line_height to an animation descriptor (Transition, Spring, or Sequence).
The descriptor must be pre-encoded via its module’s encode function.
pub fn size_animated(
text: Text,
animation: node.PropValue,
) -> Text
Set size to an animation descriptor (Transition, Spring, or Sequence).
The descriptor must be pre-encoded via its module’s encode function.
pub fn text_direction(
text: Text,
direction: text_direction.TextDirection,
) -> Text
Set the text direction used by logical text alignment.