You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
samples/place_tracker
Brett Morgan 5cd8718e4b
Migrate `place_tracker` away from deprecated BitmapDescriptor method (#2309)
7 months ago
..
android Update Samples for 3.16 (#2085) 1 year ago
assets Add smaller images, use AssetImage directory structure (#522) 4 years ago
ios Update Samples for 3.16 (#2085) 1 year ago
lib Migrate `place_tracker` away from deprecated BitmapDescriptor method (#2309) 7 months ago
test [multiple] Added copyright headers (#664) 4 years ago
web Bump deps and min SDKs, move web apps to new bootstrapping logic (#2292) 7 months ago
.gitignore Add web support to place_tracker (#550) 4 years ago
.metadata Fixup for failing Beta CI (#2092) 1 year ago
README.md Add web support to place_tracker (#550) 4 years ago
analysis_options.yaml Create `analysis_defaults` package (#1654) 2 years ago
codelab_rebuild.yaml Update Samples for 3.16 (#2085) 1 year ago
pubspec.yaml Bump deps and min SDKs, move web apps to new bootstrapping logic (#2292) 7 months ago

README.md

Place Tracker

A sample place tracking app that uses the google_maps_flutter plugin. Keep track of your favorite places, places you've visited, and places you want to go. View details about these places, show them on a map, and get directions to them.

Goals

  • Learn how to create an interface composed of GoogleMap and other widgets.
  • Learn how to show, control, and modify a GoogleMap widget.
  • Learn how to place a marker on a map.

The important bits

place_map.dart

This page shows a full-screen GoogleMap widget with place markers. Provides examples of how to stack other widgets on top of a GoogleMap widget, how to add markers to a map, and how to make other flutter widgets interact with the GoogleMap widget.

place_details.dart

This page shows a detailed view of a single place. Provides examples of how to place a GoogleMap widget inside of a ListView and how to disable certain touch gestures on the map.

Getting Started

To run this sample app, you will need an API key.

Get an API key at https://cloud.google.com/maps-platform/.

Android

Specify your API key in the application manifest android/app/src/main/AndroidManifest.xml:

<manifest ...
  <application ...
    <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="YOUR KEY HERE"/>

iOS

Specify your API key in AppDelegate.swift:

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GMSServices.provideAPIKey("YOUR API KEY HERE")
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Web

Add your API key to web/index.html in the <head> tag:

<script src="https://maps.googleapis.com/maps/api/js?key=<YOUR_API_KEY_HERE>"></script>

For additional help setting up the plugin, see the plugin's README page.

For help getting started with Flutter, view our online documentation.

Caveat

The google_maps_flutter plugin is in developer preview until dynamic thread merging is finished.

Questions/issues

If you have a general question about any of the techniques you see in the sample, the best places to go are:

If you run into an issue with the sample itself, please file an issue in the main Flutter repo.