Last updated:
0 purchases
google places for flutter 3
Google Places for Flutter 3 #
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
This is a package that seeks to maintain the package that has not been updated for more than 3 years: google_places_for_flutter
Installation #
flutter pub add google_places_for_flutter_3
copied to clipboard
or
dependencies:
google_places_for_flutter_3: ^1.0.4
copied to clipboard
Usage #
import 'package:google_places_for_flutter/google_places_for_flutter_3.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
Some Images #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.