humazed / google_map_location_picker

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

Camera position different from the current location #50

Closed FabianGrob closed 4 years ago

FabianGrob commented 4 years ago

I am trying to edit an entity that has a pair of Latitude and Longitude, so i edit it through this widget. I want it to show in the map the old location and not my current location. I am setting the automaticallyAnimateToCurrentLocation: as false, but this centers the camera tu a remote island idkwhere. Is there a way to set the camera at a certain LatLng?

My code is the following:

Widget build(BuildContext context) { return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ RaisedButton( onPressed: () async { LocationResult result; if (initialLat != 0 || initialLong != 0) { result = await showLocationPicker( context, 'AIzaSyD8_lvGEpZodiVIfNTBE5sOzgRfeVHpFe4', initialCenter: LatLng(initialLat, initialLong), myLocationButtonEnabled: true, automaticallyAnimateToCurrentLocation: false, ); } else { result = await showLocationPicker( context, 'AIzaSyD8_lvGEpZodiVIfNTBE5sOzgRfeVHpFe4', myLocationButtonEnabled: true); } setState(() => _pickedLocation = result); setLat(_pickedLocation.latLng.latitude); setLong(_pickedLocation.latLng.longitude); }, child: Text('Mark your location!'), ), ], ), );

Thanks in advance!

humazed commented 4 years ago

yes you need to set initialCenter

FabianGrob commented 4 years ago

But its not working with the initialcenter, idk why. Maybe by looking at my code you can realize:

LocationResult result; if (initialLat != 0 || initialLong != 0) { result = await showLocationPicker( context, 'key', initialCenter: LatLng(initialLat, initialLong), myLocationButtonEnabled: true, automaticallyAnimateToCurrentLocation: false, ); } else { result = await showLocationPicker( context, 'key', myLocationButtonEnabled: true); }

El dom., 1 mar. 2020 a las 8:59, Ibrahim Eid (notifications@github.com) escribió:

Closed #50 https://github.com/humazed/google_map_location_picker/issues/50.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/humazed/google_map_location_picker/issues/50?email_source=notifications&email_token=AGODYBKM4XPK66SVKZOM5CLRFJE27A5CNFSM4KZKAOHKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOW7URJDA#event-3085505676, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGODYBNIEDAGQP2AEVC6EGTRFJE27ANCNFSM4KZKAOHA .

humazed commented 4 years ago

could you try with the example app and if you can reproduce it there

FabianGrob commented 4 years ago

Thanks i'll try. Also we got a problem that everywhere that we put the pin, its says unnamed place, do you know how could we fix it? Thnks! Sorry for bothering.

El lun., 2 de mar. de 2020 18:38, Ibrahim Eid notifications@github.com escribió:

could you try with the example app and if you can reproduce it there

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/humazed/google_map_location_picker/issues/50?email_source=notifications&email_token=AGODYBL66RSXRFGNKRIDQN3RFQRMDA5CNFSM4KZKAOHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENRCW7Q#issuecomment-593636222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGODYBP5S2ZAIYZLEKOCDILRFQRMDANCNFSM4KZKAOHA .

humazed commented 4 years ago

regarding the unnamed places please take a look at https://github.com/humazed/google_map_location_picker/issues/16