Skip to content

A flutter package for location autocomplete using the Google Places API.

License

Notifications You must be signed in to change notification settings

komlan55/location_autocomplete

Repository files navigation

LocationAutocomplete

Features

Widget allowing you to search and select address using Google Place API

  • Address autocommplete
  • Location autocomplete (in person/virtual) Similar to Facebook Event Location Autocomplete

Preview

Getting started

Usage

For a simple address autocomplete use SimpleAddressSearchField

SimpleAddressSearchField(
                inputDecoration: InputDecoration(
                  labelText: "Search address",
                  hintText: "Search address",
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(15),
                  ),
                ),
                googleApiKey: "<Google API KEY>",
                onSelected:
                    (address) =>
                        address != null
                            ? ScaffoldMessenger.of(context).showSnackBar(
                              SnackBar(
                                content: Text(
                                  'Address selected: ${address.formattedAddress}',
                                ),
                              ),
                            )
                            : null,
              )

For a for a more complex location search similar to the Facebook event location autocomplete use LocationSearchField

LocationSearchField(
    hintText: "Location Search address",
    labelText: "Location: in person or virtual",
    googleApiKey: "<Google API KEY>",
    onSelected:
        (address) =>
            address != null
                ? ScaffoldMessenger.of(context).showSnackBar(
                    SnackBar(
                    content: Text(
                        'Location selected: ${address.displayText}',
                      ),
                    ),
                )
                : null,
),

Todo

About

A flutter package for location autocomplete using the Google Places API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published