ExtendedSelectableText.rich constructor

const ExtendedSelectableText.rich(
  1. TextSpan textSpan, {
  2. Key? key,
  3. FocusNode? focusNode,
  4. TextStyle? style,
  5. StrutStyle? strutStyle,
  6. TextAlign? textAlign,
  7. TextDirection? textDirection,
  8. double? textScaleFactor,
  9. bool showCursor = false,
  10. bool autofocus = false,
  11. ToolbarOptions? toolbarOptions,
  12. int? minLines,
  13. int? maxLines,
  14. double cursorWidth = 2.0,
  15. double? cursorHeight,
  16. Radius? cursorRadius,
  17. Color? cursorColor,
  18. BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  19. BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  20. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  21. bool enableInteractiveSelection = true,
  22. TextSelectionControls? selectionControls,
  23. GestureTapCallback? onTap,
  24. ScrollPhysics? scrollPhysics,
  25. String? semanticsLabel,
  26. TextHeightBehavior? textHeightBehavior,
  27. TextWidthBasis? textWidthBasis,
  28. SelectionChangedCallback? onSelectionChanged,
  29. bool selectedAll = false,
})

Creates a selectable text widget with a TextSpan.

The textSpan parameter must not be null and only contain TextSpan in textSpan.children. Other type of InlineSpan is not allowed.

The autofocus and dragStartBehavior arguments must not be null.

Implementation

const ExtendedSelectableText.rich(
  TextSpan this.textSpan, {
  Key? key,
  this.focusNode,
  this.style,
  this.strutStyle,
  this.textAlign,
  this.textDirection,
  this.textScaleFactor,
  this.showCursor = false,
  this.autofocus = false,
  ToolbarOptions? 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.selectedAll = false,
})  : assert(showCursor != null),
      assert(autofocus != null),
      assert(dragStartBehavior != null),
      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(
        textSpan != null,
        'A non-null TextSpan must be provided to a SelectableText.rich widget.',
      ),
      data = null,
      toolbarOptions = toolbarOptions ??
          const ToolbarOptions(
            selectAll: true,
            copy: true,
          ),
      super(key: key);