Skip to content

Commit

Permalink
GitBook: [#3] Added Migration & Attribution Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JaffaKetchup authored and gitbook-bot committed Jun 22, 2022
1 parent 1cf216a commit 32e3fc1
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 9 deletions.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,45 @@ layout: landing

## Source Code

All source code is open-source available on GitHub. Take a peek using the link on the navbar.
{% embed url="https://github.com/fleaflet/flutter_map" %}
Visit the GitHub repository
{% endembed %}

{% embed url="https://pub.dev/packages/flutter_map" %}
Visit the pub.dev package listing
{% endembed %}

## Feature Highlights

<details>

<summary>Supports Any* Map Style</summary>

Through the `templateUrl` argument, you can add any raster tile server that supports WMTS. So you're not just limited to Google Maps or Mapbox anymore. And through `WMSOptions`, you can also use any WMS raster tile server, with similar setup.

Vector tile support is not built in, but it is supported in beta by a plugin!

</details>

<details>

<summary>Simple Setup</summary>

No need for API keys or excessive platform specific setup. Just depend on it and set it up in less than 5 minutes.

After that, you can add a map controller to programmatically control your map, such as position, zoom, and more!

</details>

<details>

<summary>Wide Ecosystem Of Plugins</summary>

Can't find what you need built in? There's probably a plugin for that!

From tracking the user's location to caching tiles for offline use, this is all supported by 3rd party plugins!

</details>

## Support & Contact

Expand Down
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* [Polygon Layer](usage/layers/polygon-layer.md)
* [Polyline Layer](usage/layers/polyline-layer.md)
* [Circle Layer](usage/layers/circle-layer.md)
* [Attribution Layer](usage/layers/attribution-layer.md)
* [WMS Usage](usage/layers/wms-usage.md)
* [Controller](usage/controller.md)
* [Common Issues](usage/common-issues.md)
Expand Down
1 change: 1 addition & 0 deletions migration/to-v1.1.0.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# To v1.1.0

The old method of adding attribution has been deprecated. You should now use [`AttributionWidget`](../usage/layers/attribution-layer.md).
2 changes: 1 addition & 1 deletion usage/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The main widget for the map is easy to remember. It's just:
FlutterMap(
controller: ...
options: MapOptions(),
layers: [
children: [
],
),
Expand Down
10 changes: 5 additions & 5 deletions usage/layers/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Layers

The `layers` property takes a list of 'options' that should be extensions of `LayerOptions`. The actual visual part of the map comes from layers. Multiple layers can be stacked on top of each other, to add other functionality on top of the basic map view.
The `children` property takes a list of widgets, usually provided by this library, called 'layers'. The following pages detail how to use these layers. Multiple layers can be stacked on top of each other, to add other functionality on top of the basic map view.

Layers are either tile layers (with tile providers), polygons, polylines, markers or any other custom layer or layer added by a supported plugin. However, if you wanted to show a widget that didn't need to interact with the map on top of the map (such as a compass), it would be recommended to place the `FlutterMap()` inside a `Stack()`, and then display that widget over the map in the stack.
Each layer is in the format `...LayerWidget`, and takes an `options` argument which must be a `...LayerOptions`.

The following sub-pages detail layers that you're likely to use on the map.
This widget format is useful, as other widgets can be wrapped around each layer, such as `FutureBuilder` or `StreamBuilder`, which are especially useful in non-tile layers.

{% hint style="info" %}
The recommended way to add layers now is using the `children` property instead of `layers`. There are few differences, and this documentation will use the older `layers` property.
Many of the subpages omit the `LayerWidget` and just demonstrate the `LayerOptions` inside a `layers` parameter.

To use the `children` property instead, place any `LayerOptions` inside a `LayerWidget`'s `options` property. For example, `TileLayerWidget(options: TileLayerOptions(...),),`.
This used to be the recommended way of adding layers, and can still be used (will not be deprecated).
{% endhint %}
29 changes: 29 additions & 0 deletions usage/layers/attribution-layer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Attribution Layer

Before publishing your app to users, you should credit the tile server you use, this library, and potentially and plugins you use.

```dart
FlutterMap(
options: MapOptions(),
nonRotatedChildren: [
AttributionWidget.defaultWidget(
source: 'OpenStreetMap contributors',
onSourceTapped: () {},
),
],
),
```

{% hint style="success" %}
Please credit flutter\_map, it helps us to gain more developers that we can help!

You should also credit your tile server if it says to in the server's terms of service. You must credit OpenStreetMap if using it.
{% endhint %}

## Default Builder

The default builder, as shown above, can be used to get a classic attribution box appearance quickly without much setup. Just add a source and a function (if you want a clickable link to appear), and 'flutter\_map' automatically gets credited.

## Custom Builder

Alternatively, create your own box from scratch by omitting the `defaultWidget` constructor from the widget.
6 changes: 4 additions & 2 deletions usage/layers/tile-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ These are the available sub-subdomains for Open Street Maps' tile server, and on

If you are not sure of the correct values for your server, don't specify anything. For example, the `urlTemplate` used in the example above will work without the '{s}' part.

:::info Backwards Compatibility There were two main reasons this option is provided:
{% hint style="info" %}
There were two main reasons this option is provided:

* Leaflet.js relied on this to get around browser limitations on HTTP connections ([source - second paragraph](https://wiki.openstreetmap.org/wiki/Slippy\_map\_tilenames#Tile\_servers)), and because 'flutter\_map' is a close port of 'leaflet.js', it retains this feature.
* Large servers used to rely on this technique to load-balance, and some small or private servers still do. :::
* Large servers used to rely on this technique to load-balance, and some small or private servers still do.
{% endhint %}

## Tile Bounds (`tileBounds:`)

Expand Down

0 comments on commit 32e3fc1

Please sign in to comment.