-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
344 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
sidebar_position: 5 | ||
--- | ||
|
||
# FAQ | ||
|
||
### Loading .mbtiles tile files or sprites/glyphs from the assets shipped with the app | ||
|
||
One approach that has been used successfully to do that is to copy the files | ||
from the app's assets directory to another directory, e.g. the app's cache | ||
directory, and then reference that location. | ||
See e.g. issues https://github.com/maplibre/flutter-maplibre-gl/issues/338 | ||
and https://github.com/maplibre/flutter-maplibre-gl/issues/318 | ||
|
||
### Avoid Android UnsatisfiedLinkError | ||
|
||
Update buildTypes in `android\app\build.gradle` | ||
|
||
```gradle title="android\app\build.gradle" | ||
buildTypes { | ||
release { | ||
// other configs | ||
ndk { | ||
abiFilters 'armeabi-v7a','arm64-v8a','x86_64', 'x86' | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Layer is not displayed on IOS, but no error | ||
|
||
Have a look in your `LayerProperties` object, if you supply a `lineColor` | ||
argument, (or any color argument) the issue might come from here. | ||
Android supports the following format : `'rgba(192, 192, 255, 1.0)'`, but on | ||
iOS, this doesn't work! | ||
|
||
You have to have the color in the following format : `#C0C0FF` | ||
|
||
### iOS crashes with error: `'NSInvalidArgumentException', reason: 'Invalid filter value: filter property must be a string'` | ||
|
||
Check if one of your expression is : `["!has", "value"]`. Android support this | ||
format, but iOS does not. | ||
You can replace your expression with : `["!",["has", "value"] ]` which works | ||
both in Android and iOS. | ||
|
||
Note : iOS will display the | ||
error : `NSPredicate: Use of 'mgl_does:have:' as an NSExpression function is forbidden`, | ||
but it seems like the expression still works well. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "Features", | ||
"position": 4, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "Dive in to the features MapLibre GL for Flutter provides." | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
docs/versioned_docs/version-0.20.0/features/supported-features.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Supported Features | ||
|
||
| Feature | Android | iOS | Web | Windows | MacOS | Linux | | ||
|----------------|:-------:|:---:|:---:|:-------:|:-----:|:-----:| | ||
| Style | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | ||
| Camera | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | ||
| Gesture | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | ||
| User Location | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | ||
| Symbol | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | ||
| Circle | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | ||
| Line | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | ||
| Fill | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | ||
| Fill Extrusion | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | | ||
| Heatmap Layer | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | |
8 changes: 8 additions & 0 deletions
8
docs/versioned_docs/version-0.20.0/getting-started/_category_.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "Getting Started", | ||
"position": 2, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "Quick start guide" | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
docs/versioned_docs/version-0.20.0/getting-started/add-dependency.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Add Dependency | ||
|
||
Add `maplibre_gl` to your project by running this command: | ||
|
||
```bash | ||
flutter pub add maplibre_gl | ||
``` | ||
|
||
or add it directly as a dependency to your `pubspec.yaml` file and run | ||
`flutter pub get`: | ||
|
||
```yaml title="pubspec.yaml" | ||
dependencies: | ||
maplibre_gl: ^0.20.0 # use the latest version found on pub.dev | ||
``` | ||
You can find the latest version of the package on | ||
[pub.dev](https://pub.dev/packages/maplibre_gl) or here: | ||
[](https://pub.dev/packages/maplibre_gl) |
72 changes: 72 additions & 0 deletions
72
docs/versioned_docs/version-0.20.0/getting-started/setup-android.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
sidebar_position: 3 | ||
--- | ||
|
||
# Setup Android | ||
|
||
## Use a compatible Kotlin version | ||
|
||
Ensure that you are using Kotlin version | ||
**1.9.0** or newer. You can check the most recent Kotlin version on | ||
[kotlinlang.org](https://kotlinlang.org/docs/releases.html#release-details). | ||
|
||
#### (new) Gradle with a declarative plugins block | ||
|
||
Open `android/settings.gradle` and set the Kotlin version like this: | ||
|
||
```gradle title="android/settings.gradle" | ||
plugins { | ||
// ... | ||
id "org.jetbrains.kotlin.android" version "1.9.0" apply false | ||
} | ||
``` | ||
|
||
In case you can't find the `plugins {}` block your app still uses the old apply | ||
script method. | ||
|
||
#### (old) In a legacy apply script gradle file: | ||
|
||
Open `android/app/build.gradle` and set the Kotlin version like this: | ||
|
||
```gradle title="android/app/build.gradle" | ||
buildscript { | ||
ext.kotlin_version = '1.9.0' | ||
// ... | ||
} | ||
``` | ||
|
||
## Minimum SDK version | ||
|
||
If you are using a flutter version below 3.22, you need to set the minimum SDK | ||
version to 21 or higher in `android/app/build.gradle`. | ||
|
||
```gradle title="android/app/build.gradle" | ||
defaultConfig { | ||
minSdk = 21 // previously flutter.minSdkVersion | ||
// ... | ||
} | ||
``` | ||
|
||
If you are using the old apply script method in gradle, `minSdk` is named | ||
`minSdkVersion`. | ||
|
||
Starting from flutter 3.22, the minimum SDK version is set to 21 by default | ||
and you can keep `flutter.minSdkVersion`. | ||
|
||
## Use the location feature | ||
|
||
If you want to show the user's location on the map you need to add | ||
the `ACCESS_COARSE_LOCATION` or `ACCESS_FINE_LOCATION` permission in the | ||
application manifest `android/app/src/main/AndroidManifest.xml`. | ||
|
||
```xml title="android/app/src/main/AndroidManifest.xml" | ||
|
||
<manifest> | ||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | ||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> | ||
</manifest> | ||
``` | ||
|
||
Starting from Android API level 23 you also need to request it at runtime. This | ||
plugin does not handle this for you. Our example app uses the | ||
[flutter plugin "location"](https://pub.dev/packages/location) for this. |
41 changes: 41 additions & 0 deletions
41
docs/versioned_docs/version-0.20.0/getting-started/setup-ios.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Setup iOS | ||
|
||
There is no longer any specific setup needed to include the package on iOS. | ||
|
||
## Use the location feature | ||
|
||
If you access your users' location, you should also add the following key | ||
to `ios/Runner/Info.plist` to explain why you need access to their location | ||
data: | ||
|
||
```xml title="ios/Runner/Info.plist" | ||
<dict> | ||
<key>NSLocationWhenInUseUsageDescription</key> | ||
<string>[Your explanation here]</string> | ||
</dict> | ||
``` | ||
|
||
A possible explanation could be: "Shows your location on the map". | ||
|
||
## Upgrading from a previous version | ||
|
||
Previous versions of the package required you to add the following lines to | ||
your `ios/Podfile`. You'll have to remove these lines from your `ios/Podfile` | ||
or your project won't build. | ||
|
||
<details> | ||
<summary>View obsolete code</summary> | ||
|
||
```ruby title="ios/Podfile" | ||
source 'https://cdn.cocoapods.org/' | ||
source 'https://github.com/m0nac0/flutter-maplibre-podspecs.git' | ||
|
||
pod 'MapLibre' | ||
pod 'MapLibreAnnotationExtension' | ||
``` | ||
|
||
</details> |
26 changes: 26 additions & 0 deletions
26
docs/versioned_docs/version-0.20.0/getting-started/setup-web.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
|
||
# Setup Web | ||
|
||
Include the following JavaScript and CSS files in the `<head>` tag of | ||
your `web/index.html` file: | ||
|
||
```html title="web/index.html" | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<!-- other html --> | ||
|
||
<!-- MapLibre --> | ||
<script src='https://unpkg.com/maplibre-gl@^4.3/dist/maplibre-gl.js'></script> | ||
<link href='https://unpkg.com/maplibre-gl@^4.3/dist/maplibre-gl.css' | ||
rel='stylesheet'/> | ||
</head> | ||
</html> | ||
``` | ||
|
||
`^4.3` ensures that your app will always use the latest version of | ||
[maplibre-gl-js](https://github.com/maplibre/maplibre-gl-js) v4 but not suddenly | ||
use an incompatible version. |
45 changes: 45 additions & 0 deletions
45
docs/versioned_docs/version-0.20.0/getting-started/use-widget.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
|
||
# Display your first map | ||
|
||
Import the maplibre_gl package and use the `MapLibreMap` widget to display a | ||
map. | ||
|
||
```dart | ||
import 'package:flutter/material.dart'; | ||
import 'package:maplibre_gl/maplibre_gl.dart'; | ||
class MapScreen extends StatefulWidget { | ||
const MapScreen({super.key}); | ||
@override | ||
State createState() => FullMapState(); | ||
} | ||
class MapScreenState extends State<MapScreen> { | ||
MapLibreMapController? _mapController; | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: MapLibreMap( | ||
onMapCreated: (controller) { | ||
// Don't add additional annotations here, | ||
// wait for the onStyleLoadedCallback. | ||
_mapController = controller; | ||
}, | ||
initialCameraPosition: const CameraPosition(target: LatLng(0.0, 0.0)), | ||
onStyleLoadedCallback: () { | ||
debugPrint('Map loaded 😎'); | ||
}, | ||
), | ||
); | ||
} | ||
} | ||
``` | ||
|
||
The result should look something like this: | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
|
||
# Overview | ||
|
||
This is the official documentation for Flutter MapLibre GL. | ||
|
||
flutter-maplibre-gl is a fork from flutter-mapbox-gl and provides a bindings to | ||
MapLibre SDKs for iOS, Android and Web. | ||
|
||
- [Getting started](getting-started/add-dependency) | ||
- [Getting started](map-styles) | ||
- [Features](category/features) | ||
- [FAQ](faq) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
sidebar_position: 3 | ||
--- | ||
|
||
# Map Styles | ||
|
||
Map styles can be supplied by setting the `styleString` in the `MapLibreMap` | ||
constructor. The following formats are supported: | ||
|
||
1. Passing the URL of the map style. This should be a custom map style served | ||
remotely using a URL that start with `http(s)://` | ||
2. Passing the style as a local asset. Create a JSON file in the `assets` and | ||
add a reference in `pubspec.yml`. Set the style string to the relative path | ||
for this asset in order to load it into the map. | ||
3. Passing the style as a local file. create an JSON file in app directory (e.g. | ||
ApplicationDocumentsDirectory). Set the style string to the absolute path of | ||
this JSON file. | ||
4. Passing the raw JSON of the map style. This is only supported on Android. | ||
|
||
## Tile sources that require an API key | ||
|
||
If your tile source requires an API key, we recommend directly specifying a | ||
source url with the API key included. | ||
For example: | ||
|
||
```url | ||
https://tiles.example.com/{z}/{x}/{y}.vector.pbf?api_key={your_key} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"docsSidebar": [ | ||
{ | ||
"type": "autogenerated", | ||
"dirName": "." | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
"0.20.0" | ||
] |