onPanUpdate method
Returns true if the event was consumed by a vertical morph gesture.
Implementation
bool onPanUpdate(
DragUpdateDetails details, {
required double availableHeight,
}) {
_accumulated += details.delta;
// Record sample for predictive analysis
_sampleBuffer.addLast(
_GestureSample(details.delta, details.sourceTimeStamp ?? Duration.zero),
);
if (_sampleBuffer.length > _maxSamples) {
_sampleBuffer.removeFirst();
}
if (_lockedAxis == _DragAxis.none) {
final dx = _accumulated.dx.abs();
final dy = _accumulated.dy.abs();
final total = math.sqrt(dx * dx + dy * dy);
if (total < lockThreshold) return false;
// Use predictive axis detection combining delta + velocity analysis
_lockedAxis = _predictAxis(details);
if (_lockedAxis == _DragAxis.vertical) {
morphController.startDrag();
_verticalStarted = true;
}
}
if (_lockedAxis == _DragAxis.vertical) {
// Apply rubber-band when dragging beyond boundaries
double delta = details.delta.dy;
final progress = morphController.progress;
if ((progress <= 0.05 && delta > 0 && delta.abs() < 3) ||
(progress >= 0.95 && delta < 0)) {
delta *= rubberBandFactor;
}
morphController.updateDrag(delta, availableHeight);
return true;
}
return false;
}