BidiSelectableText.rich constructor
const
BidiSelectableText.rich(
- TextSpan textSpan, {
- Key? key,
- FocusNode? focusNode,
- TextStyle? style,
- StrutStyle? strutStyle,
- TextAlign? textAlign,
- TextScaler? textScaler,
- bool showCursor = false,
- bool autofocus = false,
- int? minLines,
- int? maxLines,
- double cursorWidth = 2.0,
- double? cursorHeight,
- Radius? cursorRadius,
- Color? cursorColor,
- BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
- BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
- bool enableInteractiveSelection = true,
- TextSelectionControls? selectionControls,
- GestureTapCallback? onTap,
- ScrollPhysics? scrollPhysics,
- String? semanticsLabel,
- TextHeightBehavior? textHeightBehavior,
- TextWidthBasis? textWidthBasis,
- SelectionChangedCallback? onSelectionChanged,
- EditableTextContextMenuBuilder? contextMenuBuilder,
- TextMagnifierConfiguration? magnifierConfiguration,
- int? sampleLength = 50,
Creates a BidiSelectableText widget with a TextSpan — a drop-in replacement for SelectableText.rich.
Direction is detected by extracting all text from the TextSpan tree (nested TextSpan children are traversed; WidgetSpan nodes are ignored).
Example:
BidiSelectableText.rich(
TextSpan(children: [
TextSpan(text: 'مرحبا '),
TextSpan(text: 'world', style: TextStyle(color: Colors.blue)),
]),
)
Implementation
const BidiSelectableText.rich(
TextSpan this.textSpan, {
super.key,
this.focusNode,
this.style,
this.strutStyle,
this.textAlign,
this.textScaler,
this.showCursor = false,
this.autofocus = false,
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.enableInteractiveSelection = true,
this.selectionControls,
this.onTap,
this.scrollPhysics,
this.semanticsLabel,
this.textHeightBehavior,
this.textWidthBasis,
this.onSelectionChanged,
this.contextMenuBuilder,
this.magnifierConfiguration,
this.sampleLength = 50,
}) : data = null;