Skip to content

hanif-simform/Google-AutoComplete-TextField-Flutter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

google_places_flutter

Add dependency into pubspec.yml

dependencies:
  flutter:
    sdk: flutter
  google_places_flutter: <last-version>
  

Google AutoComplete TextField Widget code

    GooglePlaceAutoCompleteTextField(
        textEditingController: controller,
        googleAPIKey: "YOUR_GOOGLE_API_KEY",
        inputDecoration: InputDecoration()
        debounceTime: 800 // default 600 ms,
        countries: ["in","fr"],// optional by default null is set
        isLatLngRequired:true,// if you required coordinates from place detail
        getPlaceDetailWithLatLng: (Prediction prediction) {
         // this method will return latlng with place detail
        print("placeDetails" + prediction.lng.toString());
        }, // this callback is called when isLatLngRequired is true
        itmClick: (Prediction prediction) {
         controller.text=prediction.description;
          controller.selection = TextSelection.fromPosition(TextPosition(offset: prediction.description.length));
        }
    )
    

Customization Option

You can customize a text field input decoration and debounce time

Screenshorts

About

Google auto complete with fixed dio issue

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 96.6%
  • Swift 1.9%
  • Kotlin 1.3%
  • Objective-C 0.2%