RichText constructor
- Key? key,
- required InlineSpan text,
- TextAlign textAlign = TextAlign.start,
- 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,
- TextHeightBehavior? textHeightBehavior,
- SelectionRegistrar? selectionRegistrar,
- Color? selectionColor,
Creates a paragraph of rich text.
The maxLines
property may be null (and indeed defaults to null), but if
it is not null, it must be greater than zero.
The textDirection
, if null, defaults to the ambient Directionality,
which in that case must not be null.
Implementation
RichText({
super.key,
required this.text,
this.textAlign = TextAlign.start,
this.textDirection,
this.softWrap = true,
this.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,
this.maxLines,
this.locale,
this.strutStyle,
this.textWidthBasis = TextWidthBasis.parent,
this.textHeightBehavior,
this.selectionRegistrar,
this.selectionColor,
}) : assert(maxLines == null || maxLines > 0),
assert(selectionRegistrar == null || selectionColor != null),
assert(textScaleFactor == 1.0 || identical(textScaler, TextScaler.noScaling), 'Use textScaler instead.'),
textScaler = _effectiveTextScalerFrom(textScaler, textScaleFactor),
super(children: WidgetSpan.extractFromInlineSpan(text, _effectiveTextScalerFrom(textScaler, textScaleFactor)));