Solutions posted here didn’t help me, so I’ve decided to revive this thread for anyone finiding it, looking for an answer (like me, recently).
In my case I wanted to create a widget in a position of another widget, but it should also work with moving widget around.
First of all, this is the post that helped me
And this is my implementation: