buildText method

Widget? buildText(
  1. BuildTree tree,
  2. InheritedProperties resolved,
  3. InlineSpan text
)

Builds RichText.

Implementation

Widget? buildText(
  BuildTree tree,
  InheritedProperties resolved,
  InlineSpan text,
) {
  const selectionColorDefault = DefaultSelectionStyle.defaultColor;
  final selectionRegistrar = resolved.get<SelectionRegistrar>();
  final selectionStyle = resolved.get<DefaultSelectionStyle>();

  Widget built = RichText(
    maxLines: tree.maxLines > 0 ? tree.maxLines : null,
    overflow: tree.overflow,
    selectionColor: selectionStyle?.selectionColor ?? selectionColorDefault,
    selectionRegistrar: selectionRegistrar,
    softWrap: resolved.get<CssWhitespace>() != CssWhitespace.nowrap,
    text: text,
    textAlign: resolved.get() ?? TextAlign.start,
    textDirection: resolved.get(),
  );

  if (selectionRegistrar != null) {
    built = MouseRegion(cursor: SystemMouseCursors.text, child: built);
  }

  return built;
}