1

I want to long press a first widget and trigger a function. During the same PointerDownEvent (that is, without removing finger or mouse from the screen) continue and drag the finger or mouse to a second widget. This second widget should trigger another function when the so named onPointerUp event happens.

I was thinking on using GestureDetector instances, but they don't seem to have what I am looking for, maybe I'm wrong. Another option would be using Listener instances and handling on whether their offsets match the pointer's offset. Could this be the solution? I wonder if there is a more straightforward way.

Something like pressing a key in a phone's keyboard and dragging the finger to select a symbol could be a good example.

enter image description here

1 Answer 1

2

You can create a Draggable with an invisible child on top of the original widget and each of the targets (in case more than one) can be a DragTarget. You then execute your desired function in the onAccept property of the DragTarget.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.