google_places_for_flutter

Creator: coderz1093

Last updated:

Add to Cart

Description:

google places for flutter

Google Places for Flutter #
A Flutter package which uses the Google Maps API to make a TextField that autocomplete places as the user types in.
It also gives coordinates and more ...
Extended Google Maps for Flutter plugin

Installation #
flutter pub add google_places_for_flutter

copied to clipboard
or
dependencies:
google_places_for_flutter: ^1.0.0

copied to clipboard
Usage #

import 'package:google_places_for_flutter/google_places_for_flutter.dart';

SearchGooglePlacesWidget(
placeType: PlaceType.address, // PlaceType.cities, PlaceType.geocode, PlaceType.region etc
placeholder: 'Enter the address',
apiKey:
'Your Google Map API Key goes here',
onSearch: (Place place) {},
onSelected: (Place place) async {
print('address ${place.description}');

},
),
copied to clipboard
SearchGooglePlacesWidget(
apiKey: 'Your Google Map API Key goes here',
// The language of the autocompletion
language: 'en',
// The position used to give better recomendations. In this case we are using the user position
location: userPosition.coordinates,
radius: 30000,
onSelected: (Place place) async {
final geolocation = await place.geolocation;

// Will animate the GoogleMap camera, taking us to the selected position with an appropriate zoom
final GoogleMapController controller = await _mapController.future;
controller.animateCamera(CameraUpdate.newLatLng(geolocation.coordinates));
controller.animateCamera(CameraUpdate.newLatLngBounds(geolocation.bounds, 0));
},
);
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.