hgl
hgl

Reputation: 2214

How do I detect a finger moves into or moves out of a widget

I wonder what's the best way to detect if a finger moves into or moves out of a widget, without lifting the finger?

By that I mean, for example, if I have a bunch of containers lives inside a parent container, after touching down, without lifting the finger, I move across the screen, and get notified about the containers my finger leaves and enters.

I think it should be done by adding a Listener to the parent container and listen for onPointerMove event, find a container that contains the finger position. But I have no idea how to compare finger position with container position.

Upvotes: 2

Views: 981

Answers (1)

Yash
Yash

Reputation: 5978

The type of thing you are asking for can be done using RenderBox and GestureDetector.

I've prepared a demo for you so you can refer it on this gist.

Upvotes: 2

Related Questions