isOffScreen method

bool isOffScreen(
  1. double x,
  2. double shapeDimension,
  3. double screenDimension
)

Whether or not the shape as any parts that are off screen.

shapeDimension is the width or height of the shape depending on the ScrollDirection. Width in the case of horizontal (left/right) scrolling and height in the case of vertical (up/down) scrolling.

screenDimension is the width or height of the screen depending on the ScrollDirection. Width in the case of horizontal (left/right) scrolling and height in the case of vertical (up/down) scrolling.

Implementation

bool isOffScreen(double x, double shapeDimension, double screenDimension) {
  return x < 0 || x > screenDimension - shapeDimension;
}