7

The Dismissible widget in Flutter gives you an onDismissed: (direction) {....} to tell you the direction it was dragged after it has been dismissed. How can I get the direction (or delta) the widget is currently being dragged?

I tried wrapping it in a GestureDectecor() which has onHorizontalDragStart: etc but it seems to stop the Dismissible from working (i.e. you can't drag it)

MSpeed
  • 8,153
  • 7
  • 49
  • 61

2 Answers2

10

Wrap your Dismissible widget inside Listener and use the onPointerMove callBack.

  Listener(
            onPointerMove: (PointerMoveEvent event) {
              print("Event : $event");
            },
            child: Dismissible(
             ...
             ,
            ),
          )
diegoveloper
  • 93,875
  • 20
  • 236
  • 194
  • PointerMoveEvent contains a `delta`. For more info: https://api.flutter.dev/flutter/gestures/PointerMoveEvent-class.html – MSpeed Sep 02 '19 at 09:08
1

Dismissible has onUpdate callback that reports progress:

onUpdate: (details) {
  print("onUpdate : ${details.progress}");
},
Andrey Gordeev
  • 30,606
  • 13
  • 135
  • 162