fabriziog
fabriziog

Reputation: 419

How can I use Vertical and Horizontal drag and Scalein the Same GestureDetector?

I'm trying to create a map in flutter and I have this rectangle which I can Scale using a GestureDetector and the onScaleStart, onScaleUpdate and onScaleEnd events like showed in this answer: How do I pan and zoom an image? and I tried adding onHorizontalDrag and onVerticalDrag but when I do so I get an error stating that I can't have them three at the same time or they'll interfere. So how can I do if I want to have the functionality of a basic map display like (Drag in both directions and scale)? Is there a faster and cleaner way of doing it than using a GestureDetector?

Upvotes: 0

Views: 1278

Answers (1)

Adrian Murray
Adrian Murray

Reputation: 2304

I think you just need to use the Scale gesture. It's a superset of Pan. which is a single point gesture for both vertical and horizontal movements.

Upvotes: 1

Related Questions