photo_view icon indicating copy to clipboard operation
photo_view copied to clipboard

[BUG] Swiping through gallery doesn't work sometimes

Open ashilkn opened this issue 1 year ago • 6 comments

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.

ashilkn avatar Sep 22 '23 07:09 ashilkn

Same error here, any solution?

Julianojc avatar Dec 24 '23 17:12 Julianojc

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

sirk390 avatar Feb 03 '24 17:02 sirk390

Is there a workaround ?

alh67 avatar Mar 24 '24 12:03 alh67

same issue

Hilbert2048 avatar Apr 07 '24 12:04 Hilbert2048

I think it's related to "android gesture navigation" because when this is disabled it works without issue.

sirk390 avatar Apr 07 '24 12:04 sirk390

look this issues https://github.com/bluefireteam/photo_view/issues/383

ChaoQunPeng avatar Aug 16 '24 06:08 ChaoQunPeng