shift property

Offset get shift

How far the layer is drawn from where it is laid out: as far as the document has scrolled, down or to the right.

Implementation

Offset get shift {
  final s = _scroll;
  if (s == null || !s.hasPixels) return Offset.zero;
  if (s case ScrollPosition(:final axisDirection)) {
    return switch (axisDirection) {
      AxisDirection.down => Offset(0, s.pixels),
      AxisDirection.right => Offset(s.pixels, 0),
      _ => Offset.zero,
    };
  }
  return Offset(0, s.pixels);
}