google_maps_place_search_dencity

Pub Dev

Custom Google search places autocomplete widget with landmark images and distance calculation.

πŸ‘‹ Get started

google_maps_place_search_dencity provides programmatic access to Google's database for the place autocomplete search and also their landmark images, as well as distance with respect to the device's current place.

πŸ’‘ Features

Help your customers explore where they are and what’s around them:

  • Place Autocomplete automatically fills in the name and/or address of a place as users type.
  • Place Geolocator gives the distance with respect to current position.
  • Place Photos returns high-quality images of a place.

πŸš€ Installation

Add dependency

You can use the command to add google_maps_place_search_dencity as a dependency with the latest stable version:

$ dart pub add google_maps_place_search_dencity

Or you can manually add google_maps_place_search_dencity into the dependencies section in your pubspec.yaml:

dependencies:
  google_maps_place_search_dencity: ^replace-with-latest-version

Add image for the icon to appear it is required in the package to work.

flutter:
  # To add assets to your package, add an assets section, like this:
  assets:
    - assets/search.png

The latest version is: Pub The latest version including pre-releases is: Pub

Before you upgrade: Breaking changes might happen in major and minor versions of packages.
See the Migration Guide for the complete breaking changes list.

Super simple to use

import 'package:google_maps_place_search_dencity/google_maps_place_search_dencity.dart';

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Container(
          child: SingleChildScrollView(
            child: GooglePlaceSearchAdvance(
              initialLatitude: 48.8566,
              initialLongitude: 2.3522,
              googleMapsApiKey: "GOOGLE_MAPS_API_KEY",
              lightTheme: false,
              country: "fr",
              iconImagePath: "assets/search.png",
              onLocationSelected: (double lat, double lng, String address,
                  String mainText, String imageURL) {
                print("Coordinates are $lat,$lng");
                print("Address is : $address");
                print("Image URL is: $imageURL");
                print("Main Text is: $mainText");
              },
              focusNode: focusNode!,
            ),
          ),
        ),
      ),
    );
  }
}
    

πŸ”‘ Generate App key

  1. Go to the Google Maps Platform > Credentials page.
  2. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key.
  3. Click Close.The new API key is listed on the Credentials page under API keys.(Remember to restrict the API key before using it in production.)

πŸ‘¨β€πŸ’» Developer Details

GitHub Icon LinkedIn Icon