How to do mouse hover in Flutter?

This Article is posted by seven.srikanth at 5/23/2019 6:22:51 PM



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)
...
)

Tags: mouse hover; mouse events;








0 Comments
Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.


© 2018 - Fluttercentral | Email to me - seven.srikanth@gmail.com