Text constructor

const Text(
  1. String data, {
  2. Key? key,
  3. TextStyle? style,
  4. StrutStyle? strutStyle,
  5. TextAlign? textAlign,
  6. TextDirection? textDirection,
  7. Locale? locale,
  8. bool? softWrap,
  9. TextOverflow? overflow,
  10. @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,
  11. TextScaler? textScaler,
  12. int? maxLines,
  13. String? semanticsLabel,
  14. TextWidthBasis? textWidthBasis,
  15. TextHeightBehavior? textHeightBehavior,
  16. Color? selectionColor,
})

Creates a text widget.

If the style argument is null, the text will use the style from the closest enclosing DefaultTextStyle.

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, {
  super.key,
  this.style,
  this.strutStyle,
  this.textAlign,
  this.textDirection,
  this.locale,
  this.softWrap,
  this.overflow,
  @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.',
  )
  this.textScaleFactor,
  this.textScaler,
  this.maxLines,
  this.semanticsLabel,
  this.textWidthBasis,
  this.textHeightBehavior,
  this.selectionColor,
})  : textSpan = null,
      assert(
        textScaler == null || textScaleFactor == null,
        'textScaleFactor is deprecated and cannot be specified when textScaler is specified.',
      );