# flutter-mapbox-gl
**Repository Path**: aprilmrwei/flutter-mapbox-gl
## Basic Information
- **Project Name**: flutter-mapbox-gl
- **Description**: A Mapbox GL flutter package for creating custom maps.(用于创建自定义地图的Mapbox GL flutter程序包)
- **Primary Language**: Unknown
- **License**: BSD-2-Clause
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2020-04-27
- **Last Updated**: 2024-05-29
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Flutter Mapbox GL Native
> **Please note that this project is community driven and is not an official Mapbox product.** We welcome [feedback](https://github.com/tobrun/flutter-mapbox-gl/issues) and contributions.
This Flutter plugin for [mapbox-gl-native](https://github.com/mapbox/mapbox-gl-native) enables
embedded interactive and customizable vector maps inside a Flutter widget by embedding Android and iOS views.

## Install
This project is available on [pub.dev](https://pub.dev/packages/mapbox_gl), follow the [instructions](https://flutter.dev/docs/development/packages-and-plugins/using-packages#adding-a-package-dependency-to-an-app) to integrate a package into your flutter application.
## :new: :new: Who's using this SDK :new: :new:
We're compiling a list of apps using this SDK. If you want to be listed here, please open a PR and add yourself below (or open a ticket and we'll add you).
- You?
### Running example app
- Install [Flutter](https://flutter.io/get-started/) and validate its installation with `flutter doctor`
- Clone this repository with `git clone git@github.com:mapbox/flutter-mapbox-gl.git`
- Run the app with `cd flutter_mapbox/example && flutter run`
#### Mapbox Access Token
This project uses Mapbox vector tiles, which requires a Mapbox account and a Mapbox access token. Obtain a free access token on [your Mapbox account page](https://www.mapbox.com/account/access-tokens/).
> **Even if you do not use Mapbox vector tiles but vector tiles from a different source (like self-hosted tiles) with this plugin, you will need to specify any non-empty string as Access Token as explained below!**
##### Android
Add Mapbox read token value in the application manifest ```android/app/src/main/AndroidManifest.xml:```
```
```
#### iOS
Add these lines to your Info.plist
```plist
io.flutter.embedded_views_preview
MGLMapboxAccessToken
YOUR_TOKEN_HERE
```
## Supported API
| Feature | Android | iOS |
| ------ | ------ | ----- |
| Style | :white_check_mark: | :white_check_mark: |
| Camera | :white_check_mark: | :white_check_mark: |
| Gesture | :white_check_mark: | :white_check_mark: |
| User Location | :white_check_mark: | :white_check_mark: |
| Symbol | :white_check_mark: | :white_check_mark: |
| Circle | :white_check_mark: | :white_check_mark: |
| Line | :white_check_mark: | :white_check_mark: |
| Fill | | |
## Offline Sideloading
Support for offline maps is available by *"side loading"* the required map tiles and including them in your `assets` folder.
* Create your tiles package by following the guide available [here](https://docs.mapbox.com/ios/maps/overview/offline/).
* Place the tiles.db file generated in step one in your assets directory and add a reference to it in your `pubspec.yml` file.
```
assets:
- assets/cache.db
```
* Call `installOfflineMapTiles` when your application starts to copy your tiles into the location where Mapbox can access them. **NOTE:** This method should be called **before** the Map widget is loaded to prevent collisions when copying the files into place.
```
try {
await installOfflineMapTiles(join("assets", "cache.db"));
} catch (err) {
print(err);
}
```
## Documentation
This README file currently houses all of the documentation for this Flutter project. Please visit [mapbox.com/android-docs](https://www.mapbox.com/android-docs/) if you'd like more information about the Mapbox Maps SDK for Android and [mapbox.com/ios-sdk](https://www.mapbox.com/ios-sdk/) for more information about the Mapbox Maps SDK for iOS.
## Getting Help
- **Need help with your code?**: Look for previous questions on the [#mapbox tag](https://stackoverflow.com/questions/tagged/mapbox+flutter) — or [ask a new question](https://stackoverflow.com/questions/tagged/mapbox+android).
- **Have a bug to report?** [Open an issue](https://github.com/tobrun/flutter-mapbox-gl/issues/new). If possible, include a full log and information which shows the issue.
- **Have a feature request?** [Open an issue](https://github.com/tobrun/flutter-mapbox-gl/issues/new). Tell us what the feature should do and why you want the feature.
## Sample code
[This repository's example library](https://github.com/tobrun/flutter-mapbox-gl/tree/master/example/lib) is currently the best place for you to find reference code for this project.
## Contributing
We welcome contributions to this repository!
If you're interested in helping build this Mapbox/Flutter integration, please read [the contribution guide](https://github.com/tobrun/flutter-mapbox-gl/blob/master/CONTRIBUTING.md) to learn how to get started.