简体   繁体   English

Flutter 手势检测器

[英]Flutter GestureDetector

How can I make a flutter app that makes a particular action based on swiping in the screen from a point to another and its important that I want the start and end point to be specified or also can use if you can help me make the swipe in a particular angle and the swipe have to be above or below a certain length So in short I want I want either start and end point of the swipe or angle and length and I will be so happy if you can do both of them如何制作一个 flutter 应用程序,该应用程序基于在屏幕上从一个点滑动到另一个执行特定操作,重要的是我希望指定起点和终点,或者如果您可以帮助我进行滑动,也可以使用它一个特定的角度和滑动必须高于或低于某个长度所以简而言之,我想要滑动的起点和终点或角度和长度,如果你能同时做到这两个我会很高兴

Try this:尝试这个:

GestureDetector(
      onPanUpdate: (details) {
        // Swiping in right direction.
        if (details.delta.dx > 0) {}

        // Swiping in left direction.
        if (details.delta.dx < 0) {}
      },

      onPanEnd: (details) {
        // User swiped Left
        if (details.primaryVelocity > 0) {}
          
        // User swiped Right
        if (details.primaryVelocity < 0) {}
      },
      child: YourWidget(),
    )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM