computePosition method

  1. @override
double computePosition({
  1. required ParentLayout parent,
  2. required ChildLayout child,
  3. required LayoutAxis direction,
})
override

Returns the current scroll offset of the parent along the specified axis.

For horizontal axis, returns the X scroll offset. For vertical axis, returns the Y scroll offset.

Implementation

@override
double computePosition({
  required ParentLayout parent,
  required ChildLayout child,
  required LayoutAxis direction,
}) {
  return switch (direction) {
    LayoutAxis.horizontal => parent.scrollOffsetX,
    LayoutAxis.vertical => parent.scrollOffsetY,
  };
}