Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sbis04/flutter_maps
A Flutter app using Google Maps SDK, Directions API
https://github.com/sbis04/flutter_maps
Last synced: 14 days ago
JSON representation
A Flutter app using Google Maps SDK, Directions API
- Host: GitHub
- URL: https://github.com/sbis04/flutter_maps
- Owner: sbis04
- License: mit
- Created: 2020-05-26T09:37:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-27T16:16:57.000Z (7 months ago)
- Last Synced: 2024-10-10T19:29:19.029Z (about 1 month ago)
- Language: Dart
- Homepage:
- Size: 2.25 MB
- Stars: 340
- Watchers: 9
- Forks: 157
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Flutter Maps
A Flutter app using Google Maps SDK & Directions API
## Plugins
The plugins used in this project are:
* [google_maps_flutter](https://pub.dev/packages/google_maps_flutter)
* [geolocator](https://pub.dev/packages/geolocator)
* [flutter_polyline_points](https://pub.dev/packages/flutter_polyline_points)## Features
* Detect the current location of the user
* Use Geocoding for converting addresses to coordinates and vice versa
* Add Markers to the Map View
* Draw the route between two places using Polylines and Directions API
* Calculate the actual distance of the route## Usage
Before using it, you will need to make a new project in the **Google Cloud Platform**, and enable the Google Maps API for that project. Also, don't forget to setup the [Billing](https://console.cloud.google.com/project/_/billing/enable) for that project on GCP, otherwise you will receive the following error:
![](https://github.com/sbis04/flutter_maps/raw/master/screenshots/billing_error.png)
* Clone the repository.
```bash
git clone https://github.com/sbis04/flutter_maps.git
```* Open the project using your favorite IDE. For opening with VS Code:
```bash
code flutter_maps
```* For the **Android** part, go to `android/app/src/main/AndroidManifest.xml` file and add your **API key** here.
```xml
```* For the **iOS** part, go to `ios/Runner/AppDelegate.swift` file and add your **API key** here.
```swift
GMSServices.provideAPIKey("YOUR KEY HERE")
```
* Go to the `lib/secrets.dart` file and add your **API key** here.## Full configuration (already done in this project)
You do not require to complete these configurations if you are cloning this project, as they are already done in it. But these may be helpful if you are setting up a new Flutter project for using Google Maps and location services.
### Android setup
* Navigate to the file `android/app/src/main/AndroidManifest.xml` and add the following code snippet inside the `application` tag:
```xml
```* Also, you will need location access in the app. So, add the following permission in the same file inside the `manifest` tag:
```xml
```### iOS setup
* Navigate to the file `ios/Runner/AppDelegate.swift` and replace the whole code with the following:
```swift
import UIKit
import Flutter
import GoogleMaps
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
//Add your Google Maps API Key here
GMSServices.provideAPIKey("YOUR KEY HERE")
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
```* Also, add the following to `ios/Runner/Info.plist` file:
```
io.flutter.embedded_views_preview
YES
```* For getting location permission, add the following to the same file:
```
NSLocationWhenInUseUsageDescription
This app needs access to location when open.
```This completes the setup for both the platforms in Flutter.
## License
Copyright (c) 2020 Souvik Biswas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.