SelectableText constructor

const SelectableText(
  1. String data,
  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. Radius cursorRadius,
  16. Color cursorColor,
  17. DragStartBehavior dragStartBehavior: DragStartBehavior.start,
  18. bool enableInteractiveSelection: true,
  19. GestureTapCallback onTap,
  20. ScrollPhysics scrollPhysics,
  21. TextHeightBehavior textHeightBehavior,
  22. TextWidthBasis textWidthBasis}
)

Creates a selectable text widget.

If the style argument is null, the text will use the style from the closest enclosing DefaultTextStyle.

The showCursor, autofocus, dragStartBehavior, and data parameters must not be null. If specified, the maxLines argument must be greater than zero.

Implementation

/// The [showCursor], [autofocus], [dragStartBehavior], and [data] parameters
/// must not be null. If specified, the [maxLines] argument must be greater
/// than zero.
const SelectableText(
  this.data, {
  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.cursorRadius,
  this.cursorColor,
  this.dragStartBehavior = DragStartBehavior.start,
  this.enableInteractiveSelection = true,
  this.onTap,
  this.scrollPhysics,
  this.textHeightBehavior,
  this.textWidthBasis,
}) :  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(
        data != null,
        'A non-null String must be provided to a SelectableText widget.',
      ),
      textSpan = null,
      toolbarOptions = toolbarOptions ??
        const ToolbarOptions(
          selectAll: true,
          copy: true,
        ),
      super(key: key);