StyledText constructor
StyledText({
- Key? key,
- required String text,
- bool newLineAsBreaks = true,
- TextStyle? style,
- @Deprecated('Use tags property instead of styles') Map<
String, TextStyle> ? styles, - Map<
String, StyledTextTagBase> ? tags, - TextAlign textAlign = TextAlign.start,
- TextDirection? textDirection,
- bool softWrap = true,
- TextOverflow overflow = TextOverflow.clip,
- double textScaleFactor = 1.0,
- int? maxLines,
- Locale? locale,
- 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);