OnHover constructor
Creates an OnHover widget.
The action
parameter is called with true when hover begins and false when it ends.
The child
parameter is the widget that will detect hover events.
Example:
OnHover(
action: (hovering) {
setState(() => _isHovered = hovering);
},
child: Container(
color: _isHovered ? Colors.blue : Colors.grey,
child: Text("Hover to change color"),
),
)
Implementation
const OnHover({super.key, required this.action, required this.child});