tailSideFor function

TailSide? tailSideFor(
  1. Rect tooltip,
  2. Rect hole
)

The tooltip's edge facing the hole, derived purely from geometry.

The side is computed from the actual rects at paint time, so it always agrees with the real placement — including the auto-flip on scroll (no side needs to be stored by the placement delegate or threaded through the layout phase, where the child's final offset is not known yet).

Returns null when the tooltip overlaps the hole in both axes — the degenerate "nothing fits" fallback corner: an arrow would point at nothing, so no tail is drawn.

Implementation

TailSide? tailSideFor(Rect tooltip, Rect hole) {
  if (tooltip.bottom <= hole.top + _kEpsilon) return TailSide.bottom;
  if (tooltip.top >= hole.bottom - _kEpsilon) return TailSide.top;
  if (tooltip.right <= hole.left + _kEpsilon) return TailSide.right;
  if (tooltip.left >= hole.right - _kEpsilon) return TailSide.left;
  return null;
}