I'm trying to create a context menu that is displayed after a long press whilst keeping your finger held on the object, afterwards you would select an option (by dragging your finger) and lift it to initiate the action.
I noticed something that to me is a little strange. So first, the code:
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: Scaffold(
body: GestureDetector(
onLongPress: () {
print("onLongPress");
},
onTapUp: (TapUpDetails details) {
print("onTapUp");
},
child: Center(
child: FlutterLogo(),
),
),
),
));
}
So if I run this, after long pressing the icon, then the handler for onLongPress
is called but after lifting your finger onTapUp
isn't called. If I comment out the handler for onLongPress
(all 3 lines) then after a long press onTapUp
is called. I would like to handle both onTapUp
and onLongPress
.
Any ideas why this is happening?
You can wrap in another gesture detector that will handle tap up.
I am not sure if current behavior is a bug, so you might want to submit it to issue tracker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With