google_maps_place_search_dencity 0.0.1
google_maps_place_search_dencity: ^0.0.1 copied to clipboard
Dencity Modified Search Package.
google_maps_place_search_dencity #
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:
The latest version including pre-releases is:
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 #
- Go to the Google Maps Platform > Credentials page.
- On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key.
- 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.)