textDirection property

TextDirection get textDirection

The directionality of the text.

This decides how the TextAlign.start, TextAlign.end, and TextAlign.justify values of textAlign are interpreted.

This is also used to disambiguate how to render bidirectional text. For example, if the text is an English phrase followed by a Hebrew phrase, in a TextDirection.ltr context the English phrase will be on the left and the Hebrew phrase to its right, while in a TextDirection.rtl context, the English phrase will be on the right and the Hebrew phrase on its left.

Implementation

// TextPainter.textDirection is nullable, but it is set to a
// non-null value in the RenderEditable constructor and we refuse to
// set it to null here, so _textPainter.textDirection cannot be null.
TextDirection get textDirection => _textPainter.textDirection!;
set textDirection (TextDirection value)

Implementation

set textDirection(TextDirection value) {
  if (_textPainter.textDirection == value) {
    return;
  }
  _textPainter.textDirection = value;
  markNeedsLayout();
  markNeedsSemanticsUpdate();
}