RichText constructor Null safety
- {Key? key,
- required InlineSpan text,
- TextAlign textAlign = TextAlign.start,
- TextDirection? textDirection,
- bool softWrap = true,
- TextOverflow overflow = TextOverflow.clip,
- double textScaleFactor = 1.0,
- int? maxLines,
- Locale? locale,
- StrutStyle? strutStyle,
- TextWidthBasis textWidthBasis = TextWidthBasis.parent,
- TextHeightBehavior? textHeightBehavior,
- SelectionRegistrar? selectionRegistrar,
- Color? selectionColor}
Creates a paragraph of rich text.
The text, textAlign, softWrap, overflow, and textScaleFactor arguments must not be null.
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,
this.textScaleFactor = 1.0,
this.maxLines,
this.locale,
this.strutStyle,
this.textWidthBasis = TextWidthBasis.parent,
this.textHeightBehavior,
this.selectionRegistrar,
this.selectionColor,
}) : assert(text != null),
assert(textAlign != null),
assert(softWrap != null),
assert(overflow != null),
assert(textScaleFactor != null),
assert(maxLines == null || maxLines > 0),
assert(textWidthBasis != null),
assert(selectionRegistrar == null || selectionColor != null),
super(children: _extractChildren(text));