Giter Club home page Giter Club logo

Comments (2)

markusait avatar markusait commented on August 20, 2024

I found the solution: Set the Duration of the LongPressGestureRecognizer to < 1 milliseconds [here](https://github.com/Mantano/iridium/blob/fcc2e2e690276e2a1ce412d3c15ee813b7c13354/components/navigator/lib/src/epub/widget/webview_screen_state.dart#L209)

It can be done like this LongPressGestureRecognizer(duration: Duration(milliseconds: 1));

My guess is that when text is selected in a Flutter app, a LongPressGestureRecognizer is used to start the text selection process. If the user moves their finger while the long press gesture is being recognized, the gesture recognizer will interpret this as a scroll gesture and scroll the page.

By setting the duration property to Duration(milliseconds: 1), you're preventing the LongPressGestureRecognizer from interpreting the finger movement as a scroll gesture. This is because the long press gesture is recognized almost immediately, and the text selection process starts before the user has a chance to move their finger.

This makes it easier to select text, but it also changes the behavior of the long press gesture. If you want to use a long press gesture for other purposes in your app, you might need to adjust the duration to a longer value.

from iridium.

markusait avatar markusait commented on August 20, 2024

Setting the Duration to < 1 second can actually lead to issues with scrolling. Instead I added a VerticalDragGestureRecognizer and it worked as intented:

         gestureRecognizers: {
           Factory<WebViewHorizontalGestureRecognizer>(
               () => webViewHorizontalGestureRecognizer),
           Factory<VerticalDragGestureRecognizer>(
               () => VerticalDragGestureRecognizer()),
           Factory<LongPressGestureRecognizer>(() {
             return LongPressGestureRecognizer();
           }),
         },

from iridium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.