photo_view
photo_view copied to clipboard
[BUG] Swiping through gallery doesn't work sometimes
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.
Same error here, any solution?
Same issue. Every first swipe it doesn't work:
I/flutter (26851): Gesture arena 581 ❙ ★ Opening new gesture arena. I/flutter (26851): Gesture arena 581 ❙ Adding: DoubleTapGestureRecognizer#2dfb4(debugOwner: PhotoViewGestureDetector) I/flutter (26851): Gesture arena 581 ❙ Adding: PhotoViewGestureRecognizer#7fa14(debugOwner: PhotoViewGestureDetector) I/flutter (26851): Gesture arena 581 ❙ Adding: HorizontalDragGestureRecognizer#d9dac(start behavior: start) I/flutter (26851): Gesture arena 581 ❙ Closing with 3 members. I/flutter (26851): Gesture arena 581 ❙ Accepting: PhotoViewGestureRecognizer#7fa14(debugOwner: PhotoViewGestureDetector) I/flutter (26851): Gesture arena 581 ❙ Self-declared winner: PhotoViewGestureRecognizer#7fa14(debugOwner: PhotoViewGestureDetector)
Then on the second on it works: I/flutter (26851): Gesture arena 582 ❙ ★ Opening new gesture arena. I/flutter (26851): Gesture arena 582 ❙ Adding: DoubleTapGestureRecognizer#2dfb4(debugOwner: PhotoViewGestureDetector) I/flutter (26851): Gesture arena 582 ❙ Adding: PhotoViewGestureRecognizer#7fa14(debugOwner: PhotoViewGestureDetector) I/flutter (26851): Gesture arena 582 ❙ Adding: HorizontalDragGestureRecognizer#d9dac(start behavior: start) I/flutter (26851): Gesture arena 582 ❙ Closing with 3 members. I/flutter (26851): Gesture arena 582 ❙ Accepting: HorizontalDragGestureRecognizer#d9dac(start behavior: start) I/flutter (26851): Gesture arena 582 ❙ Self-declared winner: HorizontalDragGestureRecognizer#d9dac(start behavior: start) [GETX] CLOSE TO ROUTE /MyPhotoViewGallery
Is there a workaround ?
same issue
I think it's related to "android gesture navigation" because when this is disabled it works without issue.
look this issues https://github.com/bluefireteam/photo_view/issues/383