Text constructor Null safety
- String data,
- {Key? key,
- TextStyle? style,
- StrutStyle? strutStyle,
- TextAlign? textAlign,
- TextDirection? textDirection,
- Locale? locale,
- bool? softWrap,
- TextOverflow? overflow,
- double? textScaleFactor,
- int? maxLines,
- String? semanticsLabel,
- TextWidthBasis? textWidthBasis,
- TextHeightBehavior? textHeightBehavior}
Creates a text widget.
If the style
argument is null, the text will use the style from the
closest enclosing DefaultTextStyle.
The data
parameter must not be null.
The overflow
property's behavior is affected by the softWrap
argument.
If the softWrap
is true or null, the glyph causing overflow, and those that follow,
will not be rendered. Otherwise, it will be shown with the given overflow option.
Implementation
const Text(
String this.data, {
Key? key,
this.style,
this.strutStyle,
this.textAlign,
this.textDirection,
this.locale,
this.softWrap,
this.overflow,
this.textScaleFactor,
this.maxLines,
this.semanticsLabel,
this.textWidthBasis,
this.textHeightBehavior,
}) : assert(
data != null,
'A non-null String must be provided to a Text widget.',
),
textSpan = null,
super(key: key);