How to support multiple Gesture recgonize in flutter

87 Views Asked by At

I want to do a record button that looks like WhatsApp which long presses it starts recording then if I swipe up it does an action if I swipe left it does another action. I do the first thing that I long press and start recording but i don't know to how to detect swipe left or up while I still long press

1

There are 1 best solutions below

0
Kudzaishe Bhuza On BEST ANSWER
            GestureDetector(
              onVerticalDragUpdate: (drag) {
                int sensitivity = 8;
                // you can change sensitivity to what you require
                if (drag.delta.dy > sensitivity) {
                  // call your record function
                  print('Recording in progress');
                } else if (drag.delta.dy < -sensitivity) {
                  // in case you ever want to detect swipe down
                }
              },
              child: const CircleAvatar(
                  backgroundColor: Colors.green,
                  child: Icon(
                    Icons.mic,
                    color: Colors.white,
                  )),
            ),