onPressed method

Widget onPressed(
  1. VoidCallback action, {
  2. HitTestBehavior? behavior,
  3. Set<PointerDeviceKind>? supportedDevices,
})

Adds a handler for primary press/tap gestures (equivalent to onTap).

Example:

Text("Tap me").onPressed(() => print("Text was tapped"))

Implementation

Widget onPressed(VoidCallback action,
        {HitTestBehavior? behavior,
        Set<PointerDeviceKind>? supportedDevices}) =>
    OnGesture.press(
        action: action,
        behavior: behavior,
        supportedDevices: supportedDevices,
        child: this);