DEV Community

How to add a click event to any widget of Flutter

Rui Kowase on April 01, 2018

How to add a click event to any widget of Flutter. TL;DR Use GestureDetector widget Sample code GestureDetector( onTap...
Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
tayormi profile image
Temitope Ajiboye

Have you tried using InkWell()?

Collapse
 
mxglt profile image
Maxime Guilbert

On the onTap behaviour it's the same
But there is a huge gap as an InkWell will have a "hover" style, changing the background color and will have a click effect. If you don't want to have this, the GestureDetector is what you need.