humazed / google_map_location_picker

🌍 Map location picker component for flutter Based on google_maps_flutter
Apache License 2.0
206 stars 310 forks source link

set value to initialCenter is not working #24

Closed moriswala closed 4 years ago

moriswala commented 4 years ago

Hi,

Thank you for the wonderful library.

I want to use this library in one of my flutter project. I am able to use a location picker(add location) but I want to use the same picker to allow user to change location. For that I tried to use it like below:

LatLng location = getLatLng(state.latLng);
result = await LocationPicker.pickLocation(
        context,
        Constants.GOOGLE_API_KEY,
        initialCenter: location,
);

but unfortunately its not pinned to specified location and always showing my current location. How can I set the pinned location while initiating picker ?

Dararii commented 4 years ago

Same issue here. I use version 3.0.1.

moriswala commented 4 years ago

Since no update on this I decided to continue developing using another plugin https://pub.dev/packages/place_picker

Hope it will help you.

Dararii commented 4 years ago

Thank you so much, I'll definitely try that plugin.

humazed commented 4 years ago

The initialCenter works as expected and as long as the current user location is known the map is animated to it. I think adding a flag to configure this behavior is what you want.

I will add automaticallyAnimateToCurrentLocation

humazed commented 4 years ago

Added automaticallyAnimateToCurrentLocation in 3.1.0 if this doesn't solve your problem feel free to reopen.

kamal0808 commented 4 years ago

Hi @humazed , the new option automaticallyAnimateToCurrentLocation is able to animate to the current location, but it shows the animation moving from the initial position that is hardcoded const LatLng(45.521563, -122.677433),. This might confuse the user as to why his map initially shows a location in Poland, and then animates to his own location. Can you please include a variable initialCenter so that the map can initially show the current user location?

Anna225 commented 4 years ago

@humazed I have got the issue same to above. I added initialCenter option but it doesn't work. Could you help me? image