render method

  1. @override
RenderObject render(
  1. BuildContext context,
  2. T value
)
override

Creates a RenderObject (which is then passed to createRenderObject).

Implementation

@override
RenderObject render(BuildContext context, T value) {
  assert(debugCheckHasDirectionality(context));
  DefaultTextStyle? inherited;
  TextStyle textStyle = style;
  if (textStyle is MaterialTextStyle) {
    textStyle = textStyle.select(Theme.of(context).textTheme);
  }
  if (textStyle.inherit) {
    inherited = DefaultTextStyle.of(context);
    textStyle = inherited.style.merge(style);
    if (MediaQuery.boldTextOf(context)) {
      textStyle = textStyle.copyWith(fontWeight: FontWeight.bold);
    }
  }
  final SelectionRegistrar? registrar = SelectionContainer.maybeOf(context);

  return RenderParagraph(
    TextSpan(text: describe(value), style: textStyle),
    locale: Localizations.maybeLocaleOf(context),
    maxLines: maxLines ?? inherited?.maxLines,
    selectionColor: registrar != null ? DefaultSelectionStyle.of(context).selectionColor : null,
    overflow: overflow ?? inherited?.overflow ?? TextOverflow.clip,
    softWrap: softWrap ?? inherited?.softWrap ?? true,
    strutStyle: strutStyle,
    textScaler: textScaler ?? MediaQuery.textScalerOf(context),
    textHeightBehavior: textHeightBehavior ?? inherited?.textHeightBehavior,
    textAlign: align ?? inherited?.textAlign ?? TextAlign.start,
    textWidthBasis: textWidthBasis ?? inherited?.textWidthBasis ?? TextWidthBasis.parent,
    textDirection: Directionality.of(context),
    registrar: registrar,
  );
}