Skip to content

StormShadonw/google_places_for_flutter_3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

pub package

Installation

flutter pub add google_places_for_flutter_3
 

or

dependencies:
  google_places_for_flutter_3: ^1.0.4

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}');
      
    },
),
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));
    },
);

Some Images

image image

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Dart 79.8%
  • HTML 13.3%
  • Ruby 4.9%
  • Swift 1.5%
  • Other 0.5%