adar2378 / draggable_widget

A flutter package which will help you to create a draggable widget that can be dragged around the screen.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get a precise position of the widget

Emafire003 opened this issue · comments

Hi, I'm trying to make this widget disapper whenever it gets enough distance from the center. The problem is that when getting the position from the dragcontroller it oftern unreliable. The way i'm doing is: Getting the first position the first time the widget is built, and save it to a startPos variable. Then, every time the widget is dragged (checking with onPointerMove) I get the position again with getCurrent position. The new position that i'm getting often varies a lot even if the widget is placed in the exact same spot, like setting it to the topleft. Like one time the first value of the offset is 144, and the when i do it again it's 90 or even 0.0. Any ideas on how to resolve this?