fluttercommunity / flutter_google_places

Google Places - Google places autocomplete widgets for flutter. No wrapper, use https://pub.dev/packages/google_maps_webservice. Maintainer: @juliansteenbakker
https://pub.dev/packages/flutter_google_places
Other
305 stars 423 forks source link

Getting the Place Details using AutoCompleteTextField #25

Closed makkasbed closed 6 years ago

makkasbed commented 6 years ago

Hello,

Is there a way to get the place details using autocompletetextfield of this plugin?

Regards,

lejard-h commented 6 years ago

not directly with the library.

check the example https://github.com/lejard-h/flutter_google_places/blob/master/example/lib/main.dart

It use package:google_maps_webservice/places.dart to get place details here

savasadar commented 4 years ago
Future<Null> displayPrediction(Prediction p, ScaffoldState scaffold) async {
  if (p != null) {
    // get detail (lat/lng)
    PlacesDetailsResponse detail = await _places.getDetailsByPlaceId(p.placeId);
    final lat = detail.result.geometry.location.lat;
    final lng = detail.result.geometry.location.lng;

    scaffold.showSnackBar(
      SnackBar(content: Text("${p.description} - $lat/$lng")),
    );
  }
}