RenderParagraph constructor

RenderParagraph(
  1. InlineSpan text,
  2. {TextAlign textAlign = TextAlign.start,
  3. required TextDirection textDirection,
  4. bool softWrap = true,
  5. TextOverflow overflow = TextOverflow.clip,
  6. @Deprecated('Use textScaler instead. ' 'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. ' 'This feature was deprecated after v3.12.0-2.0.pre.') double textScaleFactor = 1.0,
  7. TextScaler textScaler = TextScaler.noScaling,
  8. int? maxLines,
  9. Locale? locale,
  10. StrutStyle? strutStyle,
  11. TextWidthBasis textWidthBasis = TextWidthBasis.parent,
  12. TextHeightBehavior? textHeightBehavior,
  13. List<RenderBox>? children,
  14. Color? selectionColor,
  15. SelectionRegistrar? registrar}
)

Creates a paragraph render object.

The maxLines property may be null (and indeed defaults to null), but if it is not null, it must be greater than zero.

Implementation

RenderParagraph(InlineSpan text, {
  TextAlign textAlign = TextAlign.start,
  required TextDirection textDirection,
  bool softWrap = true,
  TextOverflow overflow = TextOverflow.clip,
  @Deprecated(
    'Use textScaler instead. '
    'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. '
    'This feature was deprecated after v3.12.0-2.0.pre.',
  )
  double textScaleFactor = 1.0,
  TextScaler textScaler = TextScaler.noScaling,
  int? maxLines,
  Locale? locale,
  StrutStyle? strutStyle,
  TextWidthBasis textWidthBasis = TextWidthBasis.parent,
  ui.TextHeightBehavior? textHeightBehavior,
  List<RenderBox>? children,
  Color? selectionColor,
  SelectionRegistrar? registrar,
}) : assert(text.debugAssertIsValid()),
     assert(maxLines == null || maxLines > 0),
     assert(
       identical(textScaler, TextScaler.noScaling) || textScaleFactor == 1.0,
       'textScaleFactor is deprecated and cannot be specified when textScaler is specified.',
     ),
     _softWrap = softWrap,
     _overflow = overflow,
     _selectionColor = selectionColor,
     _textPainter = TextPainter(
       text: text,
       textAlign: textAlign,
       textDirection: textDirection,
       textScaler: textScaler == TextScaler.noScaling ? TextScaler.linear(textScaleFactor) : textScaler,
       maxLines: maxLines,
       ellipsis: overflow == TextOverflow.ellipsis ? _kEllipsis : null,
       locale: locale,
       strutStyle: strutStyle,
       textWidthBasis: textWidthBasis,
       textHeightBehavior: textHeightBehavior,
     ) {
  addAll(children);
  this.registrar = registrar;
}