a button should be long pressed to record something. If during the long press a swipe is detected the record should be deleted.
I tried to combine onLongPressStart/End with onPanUpdate, but it doesn’t work
GestureDetector(
child: Icon(Icons.mic_none_outlined),
onLongPressStart: (_) async {
setState(() {
startRecording = true; //start recording
});
do {
await Future.delayed(Duration(seconds: 1));
} while (startRecording );
},
onLongPressEnd: (_) async {
setState(() {
startRecording = false; //end recording
});
},
onPanUpdate: (details) { //<----- not working
// Swiping in left direction
if (details.delta.dx < 0) {
//delete record
}
},
),
2
Answers
this code works:
Use OnHorizontalDragUpdate