For context: https://dartpad.dev/c9689b40a5402e12538c726b5c0380ff
I have a GestureDetector (that has some specific business logic) that listens to single taps and has a child as parameter.
In a specific location, I want this child widget to look like a button. However, using a real button widget apparently skips the onTap of GestureDetector.
At first I thought that onTapCancel would then kick in, but for onTapCancel to trigger the widget needs to be 'long pressed'.
Any suggestions on how to solve this? (Using IgnorePointer around the child doesn't work.)
AbsorbPointer
Widget build(BuildContext context) {
return GestureDetector(
child: AbsorbPointer(child : child),
onTap: () {
print('tap');
onTap();
},
onTapCancel: () {
print('tapCancel');
});
}
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