HWText
Render fixed or data-bound text.
HWText
Renders a string, either hardcoded or bound to a widget data field. Both constructors accept an optional HWTextStyle and HWTextAlign.
HWText.fixed
const HWText.fixed(String content, {HWTextStyle? style, HWTextAlign? textAlign})
Hardcoded literal — the value is baked into the generated native code.
HWText.fixed('Hello World')
HWText (data-bound)
const HWText(HWDataType data, {HWTextStyle? style, HWTextAlign? textAlign})
Reads the value from widget storage at runtime. Add the matching field to the entry by using it here or via HWDataOnly.
HWText(HWString('greeting'))
Styled example
HWText.fixed(
'46',
style: HWRoleTextStyle(
role: HWTextStyleRole.title,
color: HWDefaultColor(HWColorRole.contentPrimary),
fontWeight: HWFontWeight.bold,
),
)
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
content | String | required (.fixed) | Hardcoded text. |
data | HWDataType | required (default ctor) | Field whose value is rendered. |
style | HWTextStyle? | null | Font, weight, color — see HWTextStyle. |
textAlign | HWTextAlign? | null | Multi-line text alignment. |
Exactly one of content (via .fixed) or data (via the default constructor) is supplied — the constructor you call enforces this.