getFarthestPoint method

Offset getFarthestPoint(
  1. Offset offset
)

Get the farthest corner from {offset}

Implementation

Offset getFarthestPoint(Offset offset) {
  final (topLeft, topRight, bottomLeft, bottomRight) = divideRect();

  if (topLeft.containsOffset(offset)) {
    return bottomRight.bottomRight;
  } else if (topRight.containsOffset(offset)) {
    return bottomLeft.bottomLeft;
  } else if (bottomLeft.containsOffset(offset)) {
    return topRight.topRight;
  } else if (bottomRight.containsOffset(offset)) {
    return topLeft.topLeft;
  } else {
    return center;
  }
}