Question : tap gesture flutter
Answered by :
// The GestureDetector wraps the button.
GestureDetector( // When the child is tapped, show a snackbar. onTap: () { const snackBar = SnackBar(content: Text('Tap')); ScaffoldMessenger.of(context).showSnackBar(snackBar); }, // The custom button child: Container( padding: const EdgeInsets.all(12.0), decoration: BoxDecoration( color: Colors.lightBlue, borderRadius: BorderRadius.circular(8.0), ), child: const Text('My Button'), ),
)
Source : https://docs.flutter.dev/cookbook/gestures/handling-taps | Last Update : Wed, 22 Jun 22