OnHover constructor

const OnHover({
  1. Key? key,
  2. required void action(
    1. bool hovering
    ),
  3. required Widget child,
})

Creates an OnHover widget for detecting hover events in Arcane UI.

The action callback receives a boolean indicating the current hover state (true on enter, false on exit), enabling dynamic updates like color changes or Semantics live regions. The child is the interactive Widget wrapped for hover detection, typically an IconButton, Tile, or custom CardSection element. This constructor supports ArcaneTheme integration for themed hover animations and ensures accessibility by excluding from semantics if needed, while maintaining efficient rendering without rebuilds.

Example usage in an Arcane Tile:

OnHover(
  action: (hovering) {
    setState(() => _isHovered = hovering);
  },
  child: Tile(
    child: Text("Hover to change color"),
    backgroundColor: _isHovered ? ArcaneTheme.of(context).primary : ArcaneTheme.of(context).surface,
  ),
)

Integrates with InkWell for ripple on tap during hover and HapticFeedback for enhanced user experience.

Implementation

const OnHover({super.key, required this.action, required this.child});