direction property

  1. @override
TextDirection get direction
override

Implementation

@override
TextDirection get direction {
  // CSS 'direction' is inherited via the DOM parent chain. For out-of-flow
  // render reparenting (e.g., positioned elements), prefer the DOM parent’s
  // renderStyle over the render tree parent to ensure correct inheritance.
  if (_direction != null) return _direction!;
  final dom.Element? domParent = target.parentElement;
  if (domParent != null) {
    return domParent.renderStyle.direction;
  }
  // Fallback to render parent when DOM parent is unavailable (e.g., root).
  final RenderStyle? renderParent = getParentRenderStyle();
  if (renderParent != null) return renderParent.direction;
  return TextDirection.ltr;
}
set direction (TextDirection? value)

Implementation

set direction(TextDirection? value) {
  if (_direction == value) return;
  _direction = value;
  // Update all the children text and flow layout with specified style property not set due to style inheritance.
  _markNestChildrenTextAndLayoutNeedsLayout(this, DIRECTION);
}