computeCloseHeightEnvelope static method
Absolute height envelope (logical px) of the closing glass blob:
coreHeight + 400 · u^1.1 with u = rawValue, plus any excess
restingHeight above coreHeight + 400 decaying rapidly as u^2.5.
Native glass collapses faster in height than the uniform platter scale
for tall menus and converges to the same absolute height regardless of
the menu size (≈109 pt @ 150 ms for both a 5- and a 10-item menu in
60 fps silhouettes), so a tall menu retracts as a droplet of fixed length
instead of hanging as a tall pill — without snapping height at u = 1.0
when restingHeight > 444 pt. Short menus (H · scale below the
envelope) are unaffected. Pass the result as
computeClosingPlatterRect's maxHeight.
Implementation
static double computeCloseHeightEnvelope({
required double coreHeight,
required double rawValue,
double restingHeight = 0.0,
}) {
final u = rawValue.clamp(0.0, 1.0);
final baseEnvelope =
coreHeight + _closeHeightEnvelopePx * math.pow(u, 1.1).toDouble();
final extraAboveEnvelope =
math.max(0.0, restingHeight - (coreHeight + _closeHeightEnvelopePx));
return baseEnvelope + extraAboveEnvelope * math.pow(u, 2.5).toDouble();
}