asText method
- TextStyle? style,
- StrutStyle? strutStyle,
- TextAlign? textAlign,
- TextDirection? textDirection,
- Locale? locale,
- bool? softWrap,
- TextOverflow? overflow,
- TextScaler? textScaler,
- int? maxLines,
- String? semanticsLabel,
- TextWidthBasis? textWidthBasis,
- String defaultText = "",
- bool validate = true,
Converts the object to a Text widget with the specified properties.
If the object is null, it returns defaultText
in a Text widget.
If the object is already a Text widget, it returns the object itself.
If validate
is true and the object is not valid (see isValid()), it returns defaultText
in a Text widget.
Otherwise, it converts the object to a Text widget with the default text.
The style
, strutStyle
, textAlign
, textDirection
, locale
, softWrap
,
overflow
, textScaler
, maxLines
, semanticsLabel
, and textWidthBasis
parameters are used to customize the appearance and behavior of the Text widget.
Returns a Text widget with the specified properties.
Implementation
Text asText({
TextStyle? style,
StrutStyle? strutStyle,
TextAlign? textAlign,
TextDirection? textDirection,
Locale? locale,
bool? softWrap,
TextOverflow? overflow,
TextScaler? textScaler,
int? maxLines,
String? semanticsLabel,
TextWidthBasis? textWidthBasis,
String defaultText = "",
bool validate = true,
}) =>
asNullableText(
style: style,
strutStyle: strutStyle,
textAlign: textAlign,
textDirection: textDirection,
locale: locale,
softWrap: softWrap,
overflow: overflow,
textScaler: textScaler,
maxLines: maxLines,
semanticsLabel: semanticsLabel,
textWidthBasis: textWidthBasis,
validate: validate,
)!;