buildText method

  1. @override
Widget buildText(
  1. BuildTree tree,
  2. InheritedProperties resolved,
  3. 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(),
      ),
    );
  }
}