SelectableText.rich constructor

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

Creates a selectable text widget with a TextSpan.

The TextSpan.children attribute of the textSpan parameter must only contain TextSpans. Other types of InlineSpan are not allowed.

Implementation

const SelectableText.rich(
  TextSpan this.textSpan, {
  super.key,
  this.focusNode,
  this.style,
  this.strutStyle,
  this.textAlign,
  this.textDirection,
  @Deprecated(
    'Use textScaler instead. '
    'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. '
    'This feature was deprecated after v3.12.0-2.0.pre.',
  )
  this.textScaleFactor,
  this.textScaler,
  this.showCursor = false,
  this.autofocus = false,
  @Deprecated(
    'Use `contextMenuBuilder` instead. '
    'This feature was deprecated after v3.3.0-0.5.pre.',
  )
  this.toolbarOptions,
  this.minLines,
  this.maxLines,
  this.cursorWidth = 2.0,
  this.cursorHeight,
  this.cursorRadius,
  this.cursorColor,
  this.selectionHeightStyle = ui.BoxHeightStyle.tight,
  this.selectionWidthStyle = ui.BoxWidthStyle.tight,
  this.dragStartBehavior = DragStartBehavior.start,
  this.enableInteractiveSelection = true,
  this.selectionControls,
  this.onTap,
  this.scrollPhysics,
  this.semanticsLabel,
  this.textHeightBehavior,
  this.textWidthBasis,
  this.onSelectionChanged,
  this.contextMenuBuilder = _defaultContextMenuBuilder,
  this.magnifierConfiguration,
}) :  assert(maxLines == null || maxLines > 0),
  assert(minLines == null || minLines > 0),
  assert(
    (maxLines == null) || (minLines == null) || (maxLines >= minLines),
    "minLines can't be greater than maxLines",
  ),
  assert(
    textScaler == null || textScaleFactor == null,
    'textScaleFactor is deprecated and cannot be specified when textScaler is specified.',
  ),
  data = null;