Finger Route
This example demonstrates how to create a Flutter app that allows users to draw a route on a map using their finger, calculates the route based on the drawn waypoints, and displays it using the Maps SDK for Flutter.
How It Works
The example app demonstrates the following features:
- Allow users to draw a route on the map with their finger.
- Calculate a route based on the drawn waypoints.
- Display the route on a map and provide options to cancel or clear the routes.
Initial map view
Finger-drawn route
Calculated route based on drawing
UI and Map Integration
This code sets up the basic structure of the app, including the map and the app bar. It also provides buttons in the app bar for drawing, building, canceling, and clearing routes.
Drawing and Route Calculation
This code handles drawing waypoints on the map, calculating the route based on those waypoints, and provides options to cancel or clear the routes. The map is centered on the calculated routes, and a label showing the distance and duration is displayed.