flutter map – location plugin
a flutter_map plugin to request and display the users location and heading on the map. the core features of the plugin are:
- customization: the location button and marker can be completly customized.
- energy efficiency: the location service is turned off if the app runs in the background.
- usability: developers are empowered to ensure a good user experience.
user experience
status
- [x] the location button can be changed dependening on the location services status. for example also google maps shows a different icon if the location service is off.
- [x] the marker icon can be changed depending on the location accuracy.
- [x] it’s possible to show the information (e.g. in form of a snackbar) to the user that the user location is outside of the map bounds.
- [x] the location heading is also shown for devices without an gyroscope. we patched flutter_compass for that.
installation
add flutter_map to your pubspec:
dependencies:
flutter_map_location: any # or the latest version on pub
android
ensure the following permissions are present in <project-root>/android/app/src/main/androidmanifest.xml
:
<uses-permission android:name="android.permission.internet"/>
<uses-permission android:name="android.permission.access_fine_location" />
ios
ensure the following permission is present in <project-root>/ios/runner/info.plist
:
<key>nslocationwheninuseusagedescription</key>
<string>app needs access to location and direction when open.</string>
usage
look at the default example and the notes inside the code. that’s a working example.
demo / example
a working example can be found in the example/
directory. it contains a page with the default settings:
… and one with customized button and marker:
Comments are closed.