fysoul17 / google_maps_place_picker

Place picker on Google Maps for Flutter
MIT License
222 stars 357 forks source link

Use the current pin/marker location #47

Open tshepo-m opened 4 years ago

tshepo-m commented 4 years ago

I required the ability to use the current pin/marker position. Your plugin does not seem to have the functionality. I modified your plugin to provide the required functionality which is a button "Use pin location", which has a callback with the current CameraPosition. I am willing to contribute the feature.

Screenshot of the modification

Untitled
fysoul17 commented 4 years ago

I am not sure what exactly you need, but I think the feature already exists. We have [usePinPointingSearch] option to drag the camera to select the current location. [selectInitialPosition] also make sure it automatically selects the current position (pin position) at the beginning.

Aren't these what you need?

themegat commented 4 years ago

Setting usePinPointingSearch to true does not do anything. So I did not see this functionality. Also, onMapCreated does not return the controller the callback also does not seem to fire.

fysoul17 commented 4 years ago

[usePinPointingSearch] is set to true by default, and I can see the pin in your screenshot which means it is working. Thus, if you drag the map, the pinned location will be selected after a few milliseconds based on your setting if you changed the default one.

Have you also set [selectInitialPosition] to true as well? This is false by default and you need to set to true in order to get pinned location at the beginning.

Can you also provide your PlacePicker code so that I can understand your problem?

jeroen-meijer commented 3 years ago

I can confirm that onMapCreated is not passed to the GoogleMap instance used internally. If this were to be fixed, you could fetch the current center location.

Exposing an API that just gives you the current LatLng that's fired when the user drags or is done dragging would be way easier, of course.

d7h commented 3 years ago

Any updates regarding this issue? I try to explain the problem once again with an example: selectInitialPosition is set to true Now you search for an address -> pin jumps to searched place. Now u drag the pin a little more to the right and a little more up. Now u press the button "Select here". After dragging the pin, the location.lat and location.lng has the same value as before dragging the pin to the right and up. The selected place is still the same that's correct.

As example on a lake, lat lng is always the same

nomanmurtaza786 commented 2 years ago

Any updates regarding this issue? I try to explain the problem once again with an example: selectInitialPosition is set to true Now you search for an address -> pin jumps to searched place. Now u drag the pin a little more to the right and a little more up. Now u press the button "Select here". After dragging the pin, the location.lat and location.lng has the same value as before dragging the pin to the right and up. The selected place is still the same that's correct.

As example on a lake, lat lng is always the same

Did you get any solution? How we can get lat and lng of the pin without api call ?