Description
Describe the bug
When using photo_view
to swipe through photos in a gallery, swiping (horizontal drag gesture) doesn't work sometimes. I enabled debugPrintGestureArenaDiagnostics
and the logs gives an idea of what's happening internally.
When swiping works:
I/flutter (26426): Gesture arena 170 ❙ ★ Opening new gesture arena.
I/flutter (26426): Gesture arena 170 ❙ Adding: DoubleTapGestureRecognizer#b7996(debugOwner: PhotoViewGestureDetector)
I/flutter (26426): Gesture arena 170 ❙ Adding: PhotoViewGestureRecognizer#36e70(debugOwner: PhotoViewGestureDetector)
I/flutter (26426): Gesture arena 170 ❙ Adding: HorizontalDragGestureRecognizer#3afc9(start behavior: start)
I/flutter (26426): Gesture arena 170 ❙ Closing with 3 members.
I/flutter (26426): Gesture arena 170 ❙ Accepting: HorizontalDragGestureRecognizer#3afc9(start behavior: start)
I/flutter (26426): Gesture arena 170 ❙ Self-declared winner: HorizontalDragGestureRecognizer#3afc9(start behavior: start)
When swiping doesn't work:
I/flutter (26426): Gesture arena 169 ❙ ★ Opening new gesture arena.
I/flutter (26426): Gesture arena 169 ❙ Adding: DoubleTapGestureRecognizer#b7996(debugOwner: PhotoViewGestureDetector)
I/flutter (26426): Gesture arena 169 ❙ Adding: PhotoViewGestureRecognizer#36e70(debugOwner: PhotoViewGestureDetector)
I/flutter (26426): Gesture arena 169 ❙ Adding: HorizontalDragGestureRecognizer#3afc9(start behavior: start)
I/flutter (26426): Gesture arena 169 ❙ Closing with 3 members.
I/flutter (26426): Gesture arena 169 ❙ Accepting: PhotoViewGestureRecognizer#36e70(debugOwner: PhotoViewGestureDetector)
I/flutter (26426): Gesture arena 169 ❙ Self-declared winner: PhotoViewGestureRecognizer#36e70(debugOwner: PhotoViewGestureDetector)
So at times PhotoViewGestureRecognizer
wins instead of HorizontalDragGestureRecognizer
which is causing this issue.
To Reproduce
Use the example app (https://github.com/bluefireteam/photo_view/releases/tag/0.14.0) and go to "gallery". Open the first photo from the gallery and swipe to the next photo. The first swipe doesn't work, the second does. The bug comes up randomly too while swiping through photos.
What is the current behaviour?
Swiping (horizontal drag gesture) doesn't work sometimes.
Expected behaviour
Swiping will always work and shows next/prev photo.
Screenshots
https://github.com/bluefireteam/photo_view/assets/77285023/e8001129-3cd6-4399-a331-5103841b58bb
Which versions of Flutter/Photo View, and which browser / OS are affected by this issue? Did this work in previous versions of Photo View?
Flutter v3.10.6
photo_view v0.14.0
Reproducible on both Android and iOS.