-1

In Android I was able to call Google Places screen to let user pick a location to save it, I want to do this with flutter.

I searched and found almost nothing implement that, and I understood that now this is the the most official library (still not implement what I want to do) https://pub.dartlang.org/packages/google_maps_flutter

and it's still not finished yet (Developers Preview)

Abdallah Gaber
  • 65
  • 1
  • 11

2 Answers2

1
GoogleMap(
   onTap: _mapTapped,
   compassEnabled: true,
   onMapCreated: makeController,
   initialCameraPosition: CameraPosition(
     target: LatLng(40.712776,-74.005974),
     zoom: 12.0,
   ),
)

_mapTapped(LatLng location) {
   print(location);
// The result will be the location you've been selected 
// something like this LatLng(12.12323,34.12312)
// you can do whatever you do with it

}
Tarek Mahfouz
  • 126
  • 1
  • 3
0

I am using this in my pubspec

map_view: 
    git:
      url: git://github.com/Eimji/flutter_google_map_view

Then you can capture onclick events on the map

mapView.onMapTapped.listen((location) {
      currentLatitude = location.latitude;
      currentLongitude = location.longitude;
      //Show only one marker
      mapView.clearAnnotations();
      mapView.setMarkers(
          [Marker("1", "Location", currentLatitude, currentLongitude)]);
      //Do whatever you want with the chosen location
      mapView.setCameraPosition(
          CameraPosition(Location(currentLatitude, currentLongitude), 18));
      .............
    });
Hachemi Hamadi
  • 103
  • 2
  • 9