An open API service indexing awesome lists of open source software.

https://github.com/Xennis/flutter_map_location

flutter_map plugin to request and display the users location and heading on the map
https://github.com/Xennis/flutter_map_location

flutter flutter-map location open-street-map

Last synced: 3 months ago
JSON representation

flutter_map plugin to request and display the users location and heading on the map

Awesome Lists containing this project

README

        

**The plugin is discontinued.** Feel free to fork it or checkout [similar plugins](https://flutter-map.vercel.app/plugins/list).

# Flutter Map – Location plugin

[![Flutter](https://github.com/Xennis/flutter_map_location/workflows/Flutter/badge.svg?branch=main&event=push)](https://github.com/Xennis/flutter_map_location/actions?query=workflow%3A%22Flutter%22+event%3Apush+branch%3Amain) [![Pub](https://img.shields.io/pub/v/flutter_map_location.svg)](https://pub.dev/packages/flutter_map_location)

A [flutter_map](https://pub.dev/packages/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).

## 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](https://github.com/hemanthrajv/flutter_compass/pull/38) for that.

## Installation

Add flutter_map to your pubspec:

```yaml
dependencies:
flutter_map_location: any # or the latest version on Pub
```

### Android

Ensure the following permissions are present in `/android/app/src/main/AndroidManifest.xml`:

```xml

```

See [reference example code](https://github.com/Xennis/flutter_map_location/blob/f864b737cfe6371a297cee3be076b6bc117f572c/example/android/app/src/main/AndroidManifest.xml#L4-L5)

### iOS

Ensure the following permission is present in `/ios/Runner/Info.plist`:

```xml
NSLocationWhenInUseUsageDescription
App needs access to location and direction when open.
```

See [reference example code](https://github.com/Xennis/flutter_map_location/blob/f864b737cfe6371a297cee3be076b6bc117f572c/example/ios/Runner/Info.plist#L5-L6)

## Usage

Look at the [default example](https://github.com/Xennis/flutter_map_location/blob/main/example/lib/pages/default.dart) 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:

![Default example](https://raw.githubusercontent.com/Xennis/flutter_map_location/main/example/default.png)

... and one with customized button and marker:

![Custom example](https://raw.githubusercontent.com/Xennis/flutter_map_location/main/example/custom.png)

(Map attribution: © [OpenStreetMap](https://www.openstreetmap.org/copyright) contributors)

## Credits

The plugin is inspired by [user_location_plugin](https://github.com/igaurab/user_location_plugin) by [igaurab](https://github.com/igaurab).