StyledText.selectable constructor
StyledText.selectable({
- Key? key,
- required String text,
- bool newLineAsBreaks = false,
- TextStyle? style,
- @Deprecated('Use tags property instead of styles') Map<
String, TextStyle> ? styles, - Map<
String, StyledTextTagBase> ? tags, - TextAlign textAlign = TextAlign.start,
- TextDirection? textDirection,
- double textScaleFactor = 1.0,
- int? maxLines,
- StrutStyle? strutStyle,
- FocusNode? focusNode,
- bool showCursor = false,
- bool autofocus = false,
- ToolbarOptions? toolbarOptions,
- double cursorWidth = 2.0,
- double? cursorHeight,
- Radius? cursorRadius,
- Color? cursorColor,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- bool enableInteractiveSelection = true,
- GestureTapCallback? onTap,
- ScrollPhysics? scrollPhysics,
- TextHeightBehavior? textHeightBehavior,
- TextWidthBasis? textWidthBasis,
Create a selectable text widget with formatting via tags.
See SelectableText.rich for more options.
Implementation
StyledText.selectable(
{Key? key,
required this.text,
this.newLineAsBreaks = false,
this.style,
@Deprecated('Use tags property instead of styles')
Map<String, TextStyle>? styles,
Map<String, StyledTextTagBase>? tags,
this.textAlign = TextAlign.start,
this.textDirection,
this.textScaleFactor = 1.0,
this.maxLines,
this.strutStyle,
FocusNode? focusNode,
bool showCursor = false,
bool autofocus = false,
ToolbarOptions? toolbarOptions,
double cursorWidth = 2.0,
double? cursorHeight,
Radius? cursorRadius,
Color? cursorColor,
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
bool enableInteractiveSelection = true,
GestureTapCallback? onTap,
ScrollPhysics? scrollPhysics,
TextHeightBehavior? textHeightBehavior,
TextWidthBasis? textWidthBasis})
: 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 = true,
this.softWrap = true,
this.overflow = TextOverflow.clip,
this.locale = null,
this._focusNode = focusNode,
this._showCursor = showCursor,
this._autofocus = autofocus,
this._toolbarOptions = toolbarOptions ??
const ToolbarOptions(
selectAll: true,
copy: true,
),
this._cursorWidth = cursorWidth,
this._cursorHeight = cursorHeight,
this._cursorRadius = cursorRadius,
this._cursorColor = cursorColor,
this._dragStartBehavior = dragStartBehavior,
this._enableInteractiveSelection = enableInteractiveSelection,
this._onTap = onTap,
this._scrollPhysics = scrollPhysics,
this._textHeightBehavior = textHeightBehavior,
this._textWidthBasis = textWidthBasis,
super(key: key);