StyledText constructor

StyledText({
  1. Key? key,
  2. required String text,
  3. bool newLineAsBreaks = true,
  4. TextStyle? style,
  5. @Deprecated('Use tags property instead of styles') Map<String, TextStyle>? styles,
  6. Map<String, StyledTextTagBase>? tags,
  7. TextAlign textAlign = TextAlign.start,
  8. TextDirection? textDirection,
  9. bool softWrap = true,
  10. TextOverflow overflow = TextOverflow.clip,
  11. double textScaleFactor = 1.0,
  12. int? maxLines,
  13. Locale? locale,
  14. StrutStyle? strutStyle,
})

Create a text widget with formatting via tags.

Implementation

StyledText({
  Key? key,
  required this.text,
  this.newLineAsBreaks = true,
  this.style,
  @Deprecated('Use tags property instead of styles')
      Map<String, TextStyle>? styles,
  Map<String, StyledTextTagBase>? tags,
  this.textAlign = TextAlign.start,
  this.textDirection,
  this.softWrap = true,
  this.overflow = TextOverflow.clip,
  this.textScaleFactor = 1.0,
  this.maxLines,
  this.locale,
  this.strutStyle,
})  : assert(
        styles != null || tags != null,
        'Styles and tags cannot be used at the same time. Use styles for compatibility only. They will be removed in future versions.',
      ),
      this.styles = // ignore: deprecated_member_use_from_same_package
          styles ?? const {},
      this.tags = tags ?? const {},
      this.selectable = false,
      this._focusNode = null,
      this._showCursor = false,
      this._autofocus = false,
      this._toolbarOptions = null,
      this._cursorWidth = null,
      this._cursorHeight = null,
      this._cursorRadius = null,
      this._cursorColor = null,
      this._dragStartBehavior = DragStartBehavior.start,
      this._enableInteractiveSelection = false,
      this._onTap = null,
      this._scrollPhysics = null,
      this._textHeightBehavior = null,
      this._textWidthBasis = null,
      super(key: key);