buildText method
- BuildTree tree,
- InheritedProperties resolved,
- InlineSpan text
override
Builds RichText.
Implementation
@override
Widget buildText(
BuildTree tree,
InheritedProperties resolved,
InlineSpan text,
) {
if ((text as TextSpan).text == '→ ' && text.children?.isNotEmpty == true) {
/// Create a fake button if it's within the text
return SmoothHtmlFakeButton(children: text.children!);
} else if (<String>['li', 'ul'].contains(tree.element.localName)) {
/// Add some bottom padding to the list items
return Padding(
padding: const EdgeInsetsDirectional.only(bottom: 14.0),
child: SelectableText.rich(
TextSpan(
children: <InlineSpan>[text],
style: resolved.prepareTextStyle().copyWith(height: 1.6),
),
),
);
} else {
return SelectableText.rich(
TextSpan(
children: <InlineSpan>[text],
style: resolved.prepareTextStyle(),
),
);
}
}