fysoul17/google_maps_place_picker

We don't want to search location again if camera location is changed by zooming in/out

Closed this issue · 3 comments

bool hasZoomChanged = provider.cameraPosition != null && provider.prevCameraPosition != null && provider.cameraPosition!.zoom != provider.prevCameraPosition!.zoom;

Actually, we want to. With current approach, please test:

  • show place picker with autoselect current location
  • move pin without zooming in/out: new location picked up correctly
  • press my location button. Map will zoom to current position, but new location won't be searched, because zoom has been changed. So result will be new pin position with invalid address selected

To solve that, need to remove restriction or better - determine if pin position has been changed while zooming or not. Or another approach - determine zoom reason, if it's after my location tap, search location again.

Have you tried with parameter [forceSearchOnZoomChanged] ?

I was blind, of course you are right. However, that could be good improvement to search only when pin position changed. That's actually not related to zoom change, most important is to determine if pin position changed or not. Zoom change may affect pin position or not.

@giaur500 I'm working on this thing in my own fork right now to improve it and yes, you are right about that and I dislike it, too. So, I made a PR to change the behavior in a sense that it will always search when the location has changed, no matter what.