title: How to detect a swipe in a game with flutter/flame
body: <p>I want to create a game in flutter with flame. For this game I want to detect swipes.</p>
  
  <p>I could implement a tap recognition with the help of a tutorial. But I could not implement it with swipe detection.</p>
  
  <p>my main with Taprecognition looks like this:
  My main function is</p>
  
  <pre class="lang-dart prettyprint-override"><code>void main() async{
    Util flameUtil = Util();
    await flameUtil.fullScreen();
    await flameUtil.setOrientation(DeviceOrientation.portraitUp);
  
    GameManager game = GameManager();
    runApp(game.widget);
  
    TapGestureRecognizer tapper = TapGestureRecognizer();
    tapper.onTapDown = game.onTapDown;
    flameUtil.addGestureRecognizer(tapper);
  }
  
  </code></pre>
  
  <p>In my GameManager class I do have:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class GameMAnager extends Game{
    // a few methods like update, render and constructor
    void onTapDown(TapDownDetails d) {
      if (bgRect.contains(d.globalPosition)) { //bgRect is the background rectangle, so the tap works on the whole screen
        player.onTapDown();
      }
    }
  </code></pre>
  
  <p>And my player class contains:</p>
  
  <pre><code>  void onTapDown(){
      rotate();
    }
  </code></pre>
  
  <p>Now I want to change this to rotate in the direction of the swipe instead of onTapDown. 
  I tried to somehow add </p>
  
  <pre><code>  GestureDetector swiper = GestureDetector();
    swiper.onPanUpdate = game.onPanUpdate;
  </code></pre>
  
  <p>to my main and</p>
  
  <pre><code>  void onPanUpdate() {
  
    }
  </code></pre>
  
  <p>to my gameManager class. But I cannot find anything similar to TapDownDetails for panning.</p>
  
  <p>Any suggestions on this?</p>
  
  <p>I saw some help for this to wrap the widget in a GestureDetector and use it like this:</p>
  
  <pre><code>GestureDetector(onPanUpdate: (details) {
    if (details.delta.dx &gt; 0) {
      // swiping in right direction
    }
  });
  </code></pre>
  
  <p>But I couldn't make it work on my project.</p>