You need to Wrap your widget inside a Listner.
Listener helps to track Mouse Touch and Trackpad events.
Here is the example,
bool _animiplaying = false;
void _startanime(PointerEnterEvent _) => setState(() => _animiplaying = true);
void _stopanime(PointerExitEvent _) => setState(() => _animiplaying = false);
Listner(
onPointerEnter: _startanime(),
onPointerExit: _stopanime(),
child: ...
//assign the _animiplaying to the widget to get the action
//AnimiWidget is a user defined widged used for example here, and it should accept animeplaying property.
AnimeWidget(animeplaying: _animiplaying)
...
)