fix(mobile): tall image scrolling (#25649)

Add cross-axis gesture detection in PhotoView so vertical scrolling works on tall images that don't fill the screen width (have black bars)
This commit is contained in:
Marius
2026-01-28 23:03:11 +01:00
committed by GitHub
parent 141be5cbc9
commit f2f11b1924

View File

@@ -203,9 +203,13 @@ class PhotoViewGestureRecognizer extends ScaleGestureRecognizer {
void _decideIfWeAcceptEvent(PointerEvent event) { void _decideIfWeAcceptEvent(PointerEvent event) {
final move = _initialFocalPoint! - _currentFocalPoint!; final move = _initialFocalPoint! - _currentFocalPoint!;
final bool shouldMove = validateAxis == Axis.vertical
? hitDetector!.shouldMove(move, Axis.vertical) // Accept gesture if movement is possible in the direction the user is swiping
: hitDetector!.shouldMove(move, Axis.horizontal); final bool isHorizontalGesture = move.dx.abs() > move.dy.abs();
final bool shouldMove = isHorizontalGesture
? hitDetector!.shouldMove(move, Axis.horizontal)
: hitDetector!.shouldMove(move, Axis.vertical);
if (shouldMove || _pointerLocations.keys.length > 1) { if (shouldMove || _pointerLocations.keys.length > 1) {
final double spanDelta = (_currentSpan! - _initialSpan!).abs(); final double spanDelta = (_currentSpan! - _initialSpan!).abs();
final double focalPointDelta = (_currentFocalPoint! - _initialFocalPoint!).distance; final double focalPointDelta = (_currentFocalPoint! - _initialFocalPoint!).distance;