Positioned.directional constructor

Positioned.directional({
  1. required TextDirection textDirection,
  2. double? start,
  3. double? top,
  4. double? end,
  5. double? bottom,
  6. required Widget child,
})

Creates a widget that controls where a child of a Stack is positioned.

Implementation

factory Positioned.directional({
  required TextDirection textDirection,
  double? start,
  double? top,
  double? end,
  double? bottom,
  required Widget child,
}) {
  double? left;
  double? right;
  switch (textDirection) {
    case TextDirection.rtl:
      left = end;
      right = start;
      break;
    case TextDirection.ltr:
      left = start;
      right = end;
      break;
  }
  return Positioned(
    left: left,
    top: top,
    right: right,
    bottom: bottom,
    child: child,
  );
}