onPressed method

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

Adds a handler for primary press/tap gestures to this widget in Arcane UI.

Equivalent to onTap in GestureDetector, ideal for standard interactions in IconButton or Tile. The action executes on press, with optional behavior for hit testing (e.g., opaque for full coverage) and supportedDevices to limit to touch or mouse. Enhances with ArcaneTheme press states and InkWell integration for material ripples, plus HapticFeedback for light impact. Efficient for primary actions without rebuilds.

Example in an Arcane CardSection:

Tile(child: Text("Tap me")).onPressed(() => Navigator.push(...))

Returns the wrapped Widget for chaining.

Implementation

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