build method
The final step in the chain. Converts the StyledElement tree, with its
attached Style
elements, into an InlineSpan
tree that includes
Widget/TextSpans that can be rendered in a RichText widget.
Implementation
@override
InlineSpan build(ExtensionContext context) {
if (context.styledElement is LinebreakContentElement) {
return TextSpan(
text: '\n',
style: context.styledElement!.style.generateTextStyle(),
);
}
final element = context.styledElement! as TextContentElement;
return TextSpan(
style: element.style.generateTextStyle(),
text: element.text!.transformed(element.style.textTransform),
);
}