StyledText.selectable constructor

StyledText.selectable({
  1. Key? key,
  2. required String text,
  3. bool newLineAsBreaks = false,
  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. double textScaleFactor = 1.0,
  10. int? maxLines,
  11. StrutStyle? strutStyle,
  12. FocusNode? focusNode,
  13. bool showCursor = false,
  14. bool autofocus = false,
  15. ToolbarOptions? toolbarOptions,
  16. double cursorWidth = 2.0,
  17. double? cursorHeight,
  18. Radius? cursorRadius,
  19. Color? cursorColor,
  20. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  21. bool enableInteractiveSelection = true,
  22. GestureTapCallback? onTap,
  23. ScrollPhysics? scrollPhysics,
  24. TextHeightBehavior? textHeightBehavior,
  25. 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);