buildOudsAnnotatedText function
- void block(
- OudsAnnotatedTextBuilder builder
Builds annotated text for use with a typography .rich constructor.
Colors are resolved from the consuming widget's context, so they follow the active theme.
Example:
OudsHeadingText.rich(
text: buildOudsAnnotatedText((builder) {
builder.append('Heading with ');
builder.withColor(
(context) => OudsTheme.of(context).colorScheme(context).contentBrandPrimary,
() => builder.append('colored text'),
);
}),
)
Implementation
OudsAnnotatedText buildOudsAnnotatedText(
void Function(OudsAnnotatedTextBuilder builder) block,
) {
final builder = OudsAnnotatedTextBuilder();
block(builder);
return OudsAnnotatedText._(builder._segments);
}