BidiText.rich constructor

const BidiText.rich(
  1. InlineSpan textSpan, {
  2. Key? key,
  3. TextStyle? style,
  4. StrutStyle? strutStyle,
  5. TextAlign? textAlign,
  6. Locale? locale,
  7. bool? softWrap,
  8. TextOverflow? overflow,
  9. TextScaler? textScaler,
  10. int? maxLines,
  11. String? semanticsLabel,
  12. TextWidthBasis? textWidthBasis,
  13. TextHeightBehavior? textHeightBehavior,
  14. Color? selectionColor,
  15. int? sampleLength = 50,
})

Creates a BidiText widget with an InlineSpan — a drop-in replacement for Text.rich.

Direction is detected by extracting all text from the InlineSpan tree (including nested TextSpan children; WidgetSpan nodes are ignored).

Example:

BidiText.rich(
  TextSpan(children: [
    TextSpan(text: 'مرحبا '),
    TextSpan(text: 'world', style: TextStyle(fontWeight: FontWeight.bold)),
  ]),
)

Implementation

const BidiText.rich(
  InlineSpan this.textSpan, {
  super.key,
  this.style,
  this.strutStyle,
  this.textAlign,
  this.locale,
  this.softWrap,
  this.overflow,
  this.textScaler,
  this.maxLines,
  this.semanticsLabel,
  this.textWidthBasis,
  this.textHeightBehavior,
  this.selectionColor,
  this.sampleLength = 50,
}) : data = null;