Skip to content

fix: improve image viewer gestures (driver approach)#2434

Open
Gibbz wants to merge 1 commit into
krille-chan:mainfrom
Gibbz:fix/image-viewer-gestures
Open

fix: improve image viewer gestures (driver approach)#2434
Gibbz wants to merge 1 commit into
krille-chan:mainfrom
Gibbz:fix/image-viewer-gestures

Conversation

@Gibbz

@Gibbz Gibbz commented Dec 17, 2025

Copy link
Copy Markdown

Replaces gesture arena logic with a driver approach where InteractiveViewer handles all touches. Adds manual scroll driving, double-tap zoom, and reliable pinch-to-zoom transition.

Thank you so much for your contribution to FluffyChat ❤️❤️❤️

Pull Request has been tested on:

  • Android
  • iOS
  • Browser (Chromium based)
  • Browser (Firefox based)
  • Browser (WebKit based)
  • Desktop Linux
  • Desktop Windows
  • Desktop macOS

Replaces gesture arena logic with a driver approach where InteractiveViewer handles all touches. Adds manual scroll driving, double-tap zoom, and reliable pinch-to-zoom transition.
@Gibbz Gibbz requested a review from krille-chan as a code owner December 17, 2025 12:34
@Gibbz

Gibbz commented Dec 17, 2025

Copy link
Copy Markdown
Author

this is related to the issues:
#1632
#2176

@@ -0,0 +1,108 @@
import 'package:flutter/material.dart';

class ZoomableImage extends StatefulWidget {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do you have this code from? Is it from a package or an example from stackoverflow?

// We disable the intrinsic scrolling of the PageView because we want
// the [ZoomableImage] to drive the scrolling manually.
// This allows us to seamlessly switch between scrolling (1 finger)
// and zooming (2 fingers) without the Gesture Arena locking us out.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks like a lot of workarounds for something that should be built into the framework. Are you sure this is the correct approach, that we maintain 174 new lines of code by ourself?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a dig around and found the main issue is that the viewer is in a scroll widget. As soon as the scroll moves a tiny amount, it takes control of the gestures.
I tried working around the issue, but couldn't get it to work. So this was a better solution. It's still not great and the image viewer experience is still frustrating.

Maybe it would be better to use a specific library designed for image gallery. This would reduce the burden of image viewer maintenance and usability. The following looks to be popular and easy to use.

https://github.com/bluefireteam/photo_view/

@l3u

l3u commented Dec 18, 2025

Copy link
Copy Markdown

Thank you so much for working on this. Zooming not working as expected is a really annoying bug …

But when we're at it, I would like to add another aspect: In virtually all apps, browsing through images is implemented as swiping left and right. Here, we swipe up and down to do that. Whilst one could argue that this is what we do to navigate through the chat history, it's not what one would expect. Maybe it would be worth considering changing this, too?

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants