Skip to content

Commit f129e86

Browse files
authored
chore: 0.1.2 release preparation (#134)
- [x] bump version - [x] update changelog - [x] update docs
1 parent 49c1f26 commit f129e86

File tree

4 files changed

+210
-1
lines changed

4 files changed

+210
-1
lines changed

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
## 0.1.2
2+
3+
This release adds the last missing features for Android and Web, that are were
4+
planned for now. The package will continue its ongoing efforts for stability
5+
before iOS gets added as a supported platform.
6+
7+
### New Features
8+
9+
- Add `OfflineManager` for offline maps, cache management and bulk downloading.
10+
- Add `PermissionsManager` to check and request location permissions.
11+
- Add `WidgetLayer` to support widgets as Markers on the map.
12+
- Add alternative Flutter platform view options for Texture Layer Hybrid
13+
Composition, Hybrid Composition, Virtual Display.
14+
- Bump MapLibre Native on Android to version `11.6.+`.
15+
- Add web-only controller functions `toScreenLocationSync()`,
16+
`toLngLatSync()`, `toScreenLocationsSync()`, `toLngLatsSync()`,
17+
`getMetersPerPixelAtLatitudeSync()` and `getVisibleRegionSync()`.
18+
- Add `MapOptions.of(context)` and `MapOptions.maybeOf(context)`.
19+
- Add `padding` and `alignment` parameters to the `MapScalebar` widget.
20+
21+
## Bug Fixes
22+
23+
- Fix WebAssembly builds.
24+
- Remove unused `flutter_markdown` package.
25+
26+
## Misc
27+
28+
- Add unit tests, add Android integration tests.
29+
- Use [codecov](https://app.codecov.io/gh/josxha/flutter-maplibre) to monitor
30+
test coverage.
31+
- Improve file structure by using a `/platform` directory.
32+
33+
Full
34+
Changelog: [v0.1.1...v0.1.2](https://github.com/josxha/flutter-maplibre/compare/v0.1.1...v0.1.2)
35+
136
## 0.1.1
237

338
### New Features

docs/docs/offline.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
sidebar_position: 45
3+
---
4+
5+
# Offline
6+
7+
The `OfflineManager` provides a set of tools to manage the cache and handle
8+
offline maps. It enables users to download and interact with map data in areas
9+
with limited or no internet access. Here, we’ll cover key features, usage
10+
concepts, and API details for `OfflineManager`.
11+
12+
The download manager needs to be created asynchronous by
13+
using `OfflineManager.createInstance()`. You can store the instance for later
14+
use.
15+
16+
```dart
17+
Future<OfflineManager> futureManager = OfflineManager.createInstance();
18+
```
19+
20+
Don't forget to call `manager.dispose()` when you no longer need it. You
21+
can do this for example in the `dispose` override of a flutter widget:
22+
23+
```dart
24+
@override
25+
void dispose() {
26+
// highlight-next-line
27+
manager.dispose();
28+
super.dispose();
29+
}
30+
```
31+
32+
## Downloading Map Regions
33+
34+
Using OfflineManager, you can bulk-download specific map regions for offline
35+
access.
36+
37+
```dart
38+
Future<void> downloadMyMap() async {
39+
final stream = await manager.downloadRegion(
40+
minZoom: 10,
41+
maxZoom: 14,
42+
bounds: LngLatBounds(/* ... */),
43+
mapStyleUrl: '...',
44+
pixelDensity: 1,
45+
);
46+
await for (final update in stream) {
47+
if (update.downloadCompleted) {
48+
print('region downloaded: ${update.region}');
49+
} else {
50+
print(
51+
'${update.loadedTiles} / ${update.totalTiles} '
52+
'(${((update.progress ?? 0) * 100).toStringAsFixed(0)}%)',
53+
);
54+
}
55+
}
56+
}
57+
```
58+
59+
## Managing Offline Regions
60+
61+
After regions are downloaded, they can be managed using methods to list, merge,
62+
or retrieve specific region details:
63+
64+
### Listing Offline Regions
65+
66+
Get a list of all downloaded regions for management or display purposes by
67+
using `manager.listOfflineRegions()`.
68+
69+
### Retrieving a Specific Region
70+
71+
Fetch a region’s details with `manager.getOfflineRegion(regionId: 1)`, which is
72+
useful for managing or displaying region-specific data.
73+
74+
### Merging Regions
75+
76+
Merge an offline region from an MBTiles database into the MapLibre tile cache by
77+
using `manager.mergeOfflineRegions(path: 'path/to/mbtiles')`. Ensure that the
78+
app has permission to read the directory.
79+
80+
### Cache Management
81+
82+
There are mutliple methods to manage and control the cache, ensuring efficient
83+
use of storage. Head over to
84+
the [API docs](https://pub.dev/documentation/maplibre/latest/maplibre/OfflineManager-class.html)
85+
to learn more.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
sidebar_position: 45
3+
---
4+
5+
# Offline
6+
7+
The `OfflineManager` provides a set of tools to manage the cache and handle
8+
offline maps. It enables users to download and interact with map data in areas
9+
with limited or no internet access. Here, we’ll cover key features, usage
10+
concepts, and API details for `OfflineManager`.
11+
12+
:::info
13+
The features described on this site have been added in version `0.1.2`.
14+
:::
15+
16+
The download manager needs to be created asynchronous by
17+
using `OfflineManager.createInstance()`. You can store the instance for later
18+
use.
19+
20+
```dart
21+
Future<OfflineManager> futureManager = OfflineManager.createInstance();
22+
```
23+
24+
Don't forget to call `manager.dispose()` when you no longer need it. You
25+
can do this for example in the `dispose` override of a flutter widget:
26+
27+
```dart
28+
@override
29+
void dispose() {
30+
// highlight-next-line
31+
manager.dispose();
32+
super.dispose();
33+
}
34+
```
35+
36+
## Downloading Map Regions
37+
38+
Using OfflineManager, you can bulk-download specific map regions for offline
39+
access.
40+
41+
```dart
42+
Future<void> downloadMyMap() async {
43+
final stream = await manager.downloadRegion(
44+
minZoom: 10,
45+
maxZoom: 14,
46+
bounds: LngLatBounds(/* ... */),
47+
mapStyleUrl: '...',
48+
pixelDensity: 1,
49+
);
50+
await for (final update in stream) {
51+
if (update.downloadCompleted) {
52+
print('region downloaded: ${update.region}');
53+
} else {
54+
print(
55+
'${update.loadedTiles} / ${update.totalTiles} '
56+
'(${((update.progress ?? 0) * 100).toStringAsFixed(0)}%)',
57+
);
58+
}
59+
}
60+
}
61+
```
62+
63+
## Managing Offline Regions
64+
65+
After regions are downloaded, they can be managed using methods to list, merge,
66+
or retrieve specific region details:
67+
68+
### Listing Offline Regions
69+
70+
Get a list of all downloaded regions for management or display purposes by
71+
using `manager.listOfflineRegions()`.
72+
73+
### Retrieving a Specific Region
74+
75+
Fetch a region’s details with `manager.getOfflineRegion(regionId: 1)`, which is
76+
useful for managing or displaying region-specific data.
77+
78+
### Merging Regions
79+
80+
Merge an offline region from an MBTiles database into the MapLibre tile cache by
81+
using `manager.mergeOfflineRegions(path: 'path/to/mbtiles')`. Ensure that the
82+
app has permission to read the directory.
83+
84+
### Cache Management
85+
86+
There are mutliple methods to manage and control the cache, ensuring efficient
87+
use of storage. Head over to
88+
the [API docs](https://pub.dev/documentation/maplibre/latest/maplibre/OfflineManager-class.html)
89+
to learn more.

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: maplibre
22
description: "Permissive and performant mapping library that supports Mapbox Vector Tiles (MVT) powered by MapLibre SDKs."
3-
version: 0.1.1
3+
version: 0.1.2
44
repository: https://github.com/josxha/flutter-maplibre
55
issue_tracker: https://github.com/josxha/flutter-maplibre/issues
66
homepage: https://flutter-maplibre.pages.dev

0 commit comments

Comments
 (0)