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