I want to use the function LongPressDown which also gives LongPressDownDetails of GestureDetector but sadly, Gesture Detector comes without the ripple touch effect. So if I choose to use InkWell it doesn't have the LongPressDownDetails.
So my question is, how can I get the ripple effect of InkWell with the features of GestureDetector?
It's pretty straightforward, just add an Inkwell over the GestureDetector and you'll be good to go (no need to write anything in the onTap).
return InkWell(
onTap: () {},
child: GestureDetector(
onLongPress: (){
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text('Tap'),
));
}
,
child: const Padding(
padding: EdgeInsets.all(12.0),
child: Text('Flat Button'),
),
),
);
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