Flutter: How to dispatch gestures between a WebView and an InteractiveViewer?

Viewed 183

I have a WebView inside an InteractiveViewer. The goal is to display a preview of a Google Document and allow the user to scroll it as well as zoom and pan. The basic construction is as simple as this:

InteractiveViewer(child: WebView(
  initialUrl: 'https://docs.google.com/document/d/$documentId/preview',
  gestureRecognizers: Set()..add(Factory(() => VerticalDragGestureRecognizer())),
  userAgent: 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0',
))

This allows me to scroll the WebView or zoom and pan the InteractiveViewer. But if I zoom it and then scroll, I cannot get to the border because the gesture recognizer captures the scrolling gesture even if the document cannot scroll anymore and the InteractiveViewer isn't allowed to handle the gesture and let its zoomed view pan. Is there any way to detect whether the WebView can or cannot scroll in the desired direction and dispatch the gesture to the WebView or to the InteractiveViewer accordingly?

0 Answers
Related