pikaju / flutter-maps-launcher

Simple Flutter package to open the maps application (or browser) on all platforms.
https://pub.dev/packages/maps_launcher
MIT License
61 stars 47 forks source link

fix(ios): apple maps launchCoordinates launches maps with pin #19

Closed kevinpthorne closed 1 year ago

kevinpthorne commented 3 years ago

Running the following only centers the map on iOS Apple Maps:

MapsLauncher.launchCoordinates(
      mylat,
      mylng,
    );

Changing the Apple Maps URL creation to use q instead of ll drops the pin as hoped for.

I tried using sll as documented but it just refused to work. I would like for someone else to verify this, though.

kevinpthorne commented 3 years ago

Could I get a screenshot? Is the launchCoordinates supposed to drop a pin on the coords. given or not? I guess this is also a question of intended functionality.

livtanong commented 3 years ago

According to apple documentation, you need to have BOTH q AND ll set to place a pin.

The ll parameter can also represent a pin location when you use the q parameter to specify a name.

So if you want to always place a pin (and I think you usually do), the solution would be to use ll just as before, and if no label is set for q, stringify the coordinates to pass it again as q.

Aristidios commented 2 years ago

Same issue on iOS search with coordinates doesn't place a pin on map

Doddlin commented 1 year ago

+1 for adding this, perhaps as a conditional option to be added, a pin just feels like a nice addition

pikaju commented 1 year ago

Hey, I'm a bit late to the party, but unfortunately I can't test anything because I don't have an Apple device. Isn't it enough to specify a label for the pin as the third parameter of launchCoordinates?

Doddlin commented 1 year ago

Actually yes, the pin is now added in iOS Maps. I am using this code:

ElevatedButton( onPressed: () => MapsLauncher.launchCoordinates( locationsViewModel.selectedLocation!.lat, locationsViewModel.selectedLocation!.long, locationsViewModel.selectedLocation!.locname), child: const Text("Åk till loppisen!"), style: const ButtonStyle( backgroundColor: MaterialStatePropertyAll<Color>(darkGreenColor), ), ),

pikaju commented 1 year ago

Alright, seeing as no one probably ever wants to open the map without a pin, I will add a default label. Hope this resolves the issue.