capRect method

Rect capRect(
  1. Size size,
  2. double p
)

The cap rectangle at press p in a box of size. p may overshoot a little on the bouncy release (1200/0.7): the cap rises ≤ 0.1 dp.

Implementation

Rect capRect(Size size, double p) {
  final d = travelFor(size);
  final y = d * p.clamp(-0.2, 1.0);
  return Rect.fromLTWH(0, y, size.width, size.height - d);
}