Flutter Google Places in custom TextField

1,888

I was having the same issue with using the flutter_google_places package and I ended up simply using a GET request in the project to directly interact with the Places API.

basically I used a TextEditingController on the TextFormField to listen for when new characters were input, then (after throttling the API request) made the API request and returned the locations as custom card results.

I created a video showing step by step how I did this https://youtu.be/rJOkoAmC5GY

Share:
1,888
MaylorTaylor
Author by

MaylorTaylor

I am a highly skilled Full Stack Developer with 6+ years of experience in a real world work environment. I work well in a team environment, and am seasoned enough to accomplish projects with minimal direction and oversight. I am looking for a position with opportunity for growth, including leading a team of my own and learning new skills and languages. 5+ years with SQL and MySQL databases, C# language, Razor templates, and MVC framework 5+ years using .NET 4.6 and 4.7 4+ years of AngularJS development, HTML, CSS/LESS 2+ years using latest .NET Core and .NET Standard technologies and builds 2+ years experience with Node, Express, MEAN stack, and Angular 2+ Well versed on proper RESTful standards, HTML5 standards, ADA compliance standards, and C# coding patterns such as the “Visitor Pattern”

Updated on December 12, 2022

Comments

  • MaylorTaylor
    MaylorTaylor over 1 year

    How would you use a Dart package like Flutter_Google_Places or Google_Places_Picker in your own custom TextFormField?

    Both of these libraries seem to just use Future to await the user picking the place. (example shown below)

        String placeName;        
    
        var place = await PluginGooglePlacePicker.showAutocomplete(
        mode: PlaceAutocompleteMode.MODE_FULLSCREEN,
        countryCode: country,
        typeFilter: TypeFilter.CITIES);
    
        placeName = place.name;
    

    Both of these libraries also have two MODES. One for a pre-built pop up search bar and one that is a fullscreen search mode.

    enter image description here

    I would like to have this auto search feature but have it use my custom TextFormField.