mapbox_ext 0.0.2 mapbox_ext: ^0.0.2 copied to clipboard
Extended features for MapboxMap plugin, enabling users to cache locations and use custom markers
mapbox_ext #
Flutter package which out of the box offers extended features and helper utilities when dealing with Mapbox maps on Flutter.
Usage #
Repository is currently showing work in progress, so expect future breaking changes. The plugin is operating with user location and therefore certain permissions are required.
On Android, inside AndroidManifest.xml
add the following
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
on iOS, inside Info.plist
add the following
<key>NSLocationWhenInUseUsageDescription</key>
<string>Shows your location on the map and helps improve the map</string>
Additional configuration on Android requires you to change the minSdkVersion
inside app/build.gradle
to at least SDK version 20.
Custom marker symbol #
Library assumes you're providing it with an image representing a custom marker, which should be PNG or JPEG image, because as you might know Flutter still doesn't have a native support for SVGs. That being said, it is recommended to export assets, such as SVG icons into PNG files, which are then added to assets
directory in your project, and mentioned in the pubspec.yaml
file.
For more information, check the example project.
MapboxExt
widget #
The main widget of the library is MapboxExt
, which is the entry point to all of the extended functionalities which operate under the hood. From the example project, here's how to instantiate it:
MapboxExt(
// Use one of the three options for initial point,
// or provide your own in form of a Pair object
initialPoint: MapboxExt.INIT_LOCATION_EUROPE,
// Your access token
accessToken: 'XXX',
// Human-readable marker name
markerResourceName: 'place',
// Path to the marker image
markerResourcePath: 'assets/place.png',
// (Optional) URL to the custom style
styleURL: 'XXX',
)
License #
Project is licensed under MIT license.