flutter_locations
is an easy to use userstory that provides a map where locations are shown with a marker and a card showing more information about all the markers in view.
Through the configuration of the userstory most things can be customized to your liking. The map is using platform_maps_flutter to show a map that is based on the platform that is running the app. This means that on iOS it will show Apple Maps and on Android/Web it will show Google Maps. For use on desktop and during development there is an option to use OpenStreetMaps variant.
The example app that is in the example folder is a good starting point to see how the userstory can be used. To use the userstory in your own app you can add the following to your pubspec.yaml file:
dependencies:
flutter_locations:
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: `^latest_version`
For the example the platform files need to be generated. This can be done by running the following commands in the example folder:
flutter create .
In the LocationMapOptions class you can enable/disable the google maps implementation that is displayed in the app. In this example it is set to true so that open maps is used instead of google maps because it does not require an API key. So before setting it to false you need to provide a google maps API key in the AndroidManifest.xml file. For apple it will automatically switch to apple maps.
LocationMapOptions(
enableOpenMapsTileLayer: true,
tileProvider: CancellableNetworkTileProvider(),
)
When using the openmaps tilelayer from the flutter_maps package it is recommended to use the CancellableNetworkTileProvider especially on Web where performance is drastically improved. Because flutter_locations shouldn't depend on flutter_map_cancellable_tile_provider it is not included in the dependencies. You can add it to your pubspec.yaml file like this:
dependencies:
flutter_map_cancellable_tile_provider: ^latest_version
For the features of this userstory permissions are required for each platform.
Android
```xml ```iOS
```xml ```macos
```xml For macos you need to add the following entitlements to the macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements files:<key>com.apple.security.network.client</key>
<true/>
Web
```xml ```Windows
```xml ```Linux
```xml ```See Geolocator permissions for more information about the permissions that are required for the geolocator package that is used. See Flutter maps documentation for more information about the underlying flutter_map package that is used.
You can add the userstory to your app by adding the following code to your widget tree:
LocationsUserStory(
options: LocationsOptions(
respositoryInterface: LocationsLocalRepository(density: 7),
mapOptions: const LocationsMapOptions(
zoom: 7,
initialLocation: Location(
latitude: 52.2056435,
longitude: 5.2,
),
),
),
),
A full example is in the example folder.
Please file any issues, bugs or feature request as an issue on our GitHub page. Commercial support is available if you need help with integration with your app or services. You can contact us at support@iconica.nl.
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.
This flutter_locations
for Flutter is developed by Iconica. You can contact us at support@iconica.nl