StyledText.selectable constructor

const StyledText.selectable({
  1. Key? key,
  2. required String text,
  3. bool newLineAsBreaks = false,
  4. TextStyle? style,
  5. Map<String, StyledTextTagBase>? tags,
  6. TextAlign? textAlign,
  7. TextDirection? textDirection,
  8. double? textScaleFactor,
  9. int? maxLines,
  10. StrutStyle? strutStyle,
  11. TextWidthBasis? textWidthBasis,
  12. TextHeightBehavior? textHeightBehavior,
  13. FocusNode? focusNode,
  14. bool showCursor = false,
  15. bool autofocus = false,
  16. @Deprecated('Use `contextMenuBuilder` instead. ' 'This feature was deprecated after Flutter v3.3.0-0.5.pre.') ToolbarOptions? toolbarOptions,
  17. EditableTextContextMenuBuilder contextMenuBuilder = _defaultContextMenuBuilder,
  18. TextSelectionControls? selectionControls,
  19. BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  20. BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  21. SelectionChangedCallback? onSelectionChanged,
  22. TextMagnifierConfiguration? magnifierConfiguration,
  23. double cursorWidth = 2.0,
  24. double? cursorHeight,
  25. Radius? cursorRadius,
  26. Color? cursorColor,
  27. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  28. bool enableInteractiveSelection = true,
  29. GestureTapCallback? onTap,
  30. ScrollPhysics? scrollPhysics,
  31. String? semanticsLabel,
})

Create a selectable text widget with formatting via tags.

See SelectableText.rich for more options.

Implementation

const StyledText.selectable({
  Key? key,
  required this.text,
  this.newLineAsBreaks = false,
  this.style,
  Map<String, StyledTextTagBase>? tags,
  this.textAlign,
  this.textDirection,
  this.textScaleFactor,
  this.maxLines,
  this.strutStyle,
  this.textWidthBasis,
  this.textHeightBehavior,
  FocusNode? focusNode,
  bool showCursor = false,
  bool autofocus = false,
  @Deprecated(
    'Use `contextMenuBuilder` instead. '
    'This feature was deprecated after Flutter v3.3.0-0.5.pre.',
  )
  // ignore: deprecated_member_use
  ToolbarOptions? toolbarOptions,
  EditableTextContextMenuBuilder contextMenuBuilder =
      _defaultContextMenuBuilder,
  TextSelectionControls? selectionControls,
  ui.BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  ui.BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  SelectionChangedCallback? onSelectionChanged,
  TextMagnifierConfiguration? magnifierConfiguration,
  double cursorWidth = 2.0,
  double? cursorHeight,
  Radius? cursorRadius,
  Color? cursorColor,
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  bool enableInteractiveSelection = true,
  GestureTapCallback? onTap,
  ScrollPhysics? scrollPhysics,
  String? semanticsLabel,
})  : 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 ??
          // ignore: deprecated_member_use
          const ToolbarOptions(
            selectAll: true,
            copy: true,
          ),
      this._contextMenuBuilder = contextMenuBuilder,
      this._selectionHeightStyle = selectionHeightStyle,
      this._selectionWidthStyle = selectionWidthStyle,
      this._selectionControls = selectionControls,
      this._onSelectionChanged = onSelectionChanged,
      this._magnifierConfiguration = magnifierConfiguration,
      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._semanticsLabel = semanticsLabel,
      super(key: key);