RelativeRect.fromDirectional constructor
- required TextDirection textDirection,
- required double start,
- required double top,
- required double end,
- required double bottom,
Creates a RelativeRect from horizontal position using start
and end
rather than left
and right
.
If textDirection
is TextDirection.rtl, then the start
argument is
used for the right property and the end
argument is used for the
left property. Otherwise, if textDirection
is TextDirection.ltr,
then the start
argument is used for the left property and the end
argument is used for the right property.
Implementation
factory RelativeRect.fromDirectional({
required TextDirection textDirection,
required double start,
required double top,
required double end,
required double bottom,
}) {
final (double left, double right) = switch (textDirection) {
TextDirection.rtl => (end, start),
TextDirection.ltr => (start, end),
};
return RelativeRect.fromLTRB(left, top, right, bottom);
}