onTap method
Wraps the current Widget
in a GestureDetector
widget with a tap gesture callback.
This method allows you to easily add a tap gesture to any widget.
Example:
Text('Tap me').onTap(() {
print('Widget tapped!');
});
@param callback The function to be called when the widget is tapped.
@return A GestureDetector
widget wrapping the current widget.
Implementation
GestureDetector onTap(VoidCallback callback) =>
GestureDetector(onTap: callback, child: this);