google_places_for_flutter 1.0.1 copy "google_places_for_flutter: ^1.0.1" to clipboard
google_places_for_flutter: ^1.0.1 copied to clipboard

A Flutter package which uses the Google Maps API to make a TextField that tries to autocomplete places as the user types, with simple smooth animations, providing a nice UI and UX. This will also prov [...]

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

pub package

Installation #

flutter pub add google_places_for_flutter
 

or

dependencies:
  google_places_for_flutter: ^1.0.0

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}');
      
    },
),
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));
    },
);
7
likes
100
pub points
86%
popularity

Publisher

unverified uploader

A Flutter package which uses the Google Maps API to make a TextField that tries to autocomplete places as the user types, with simple smooth animations, providing a nice UI and UX. This will also provide great information about the user selected place, like the coordinates, the bounds to determine the zoom of the GoogleMap widget, and so on.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter, google_maps_flutter, http

More

Packages that depend on google_places_for_flutter