buildText function
Implementation
Widget buildText(BuildContext context, OpenUiNode node) {
final props = node.props;
final theme = node.theme;
final slot = BlockSlot.of(context, node.element);
final sizeName = props.string('size');
final size = theme.typography.text[sizeName];
final cardSized =
_isCardSized(slot) &&
sizeName != 'xs' &&
sizeName != 'sm' &&
sizeName != 'lg';
final subtitle = _isSubtitle(context, slot);
final metrics = cardSized
? (fontSize: theme.fontSizeOf('Text.card', 15), height: 22 / 15)
: subtitle
? (fontSize: theme.fontSizeOf('Text.subtitle', 13), height: 18 / 13)
: (
fontSize: size == null ? null : theme.typography.size(size.fontSize),
height: size?.height ?? 1.6,
);
final struck = props.boolean('lineThrough') == true;
final style = _textStyle(
theme,
color:
theme.fg(props['color']) ??
(subtitle || (struck && PressableScope.of(context))
? theme.muted
: null),
size: metrics.fontSize,
height: metrics.height,
weight: _weightNamed(theme.typography, props.string('weight')),
fontStyle: props.boolean('italic') == true ? FontStyle.italic : null,
decoration: struck ? TextDecoration.lineThrough : null,
fontFeatures: props.boolean('tabularNums') == true
? theme.typography.tabular
: theme.typography.allText,
);
return _subtitleGap(
_richText(context, node, props['text'], style, maxLines: _lineLimit(props)),
subtitle,
slot,
);
}