How to add a click event to any widget of Flutter.
TL;DR
Use GestureDetector
widget
Sample code
GestureDetector(
onTap: () {
print("onTap called.");
},
child: Text("foo"),
),
Environment
- Flutter 0.1.5
- Dart 2.0.0-dev.28.0
Link
user interface - Flutter - Container onPressed? - Stack Overflow
https://stackoverflow.com/questions/43692923/flutter-container-onpressed
Top comments (2)
Have you tried using InkWell()?