Skip to content

Commit

Permalink
chore: 0.1.2 release preparation (#134)
Browse files Browse the repository at this point in the history
- [x] bump version
- [x] update changelog
- [x] update docs
  • Loading branch information
josxha authored Nov 9, 2024
1 parent 49c1f26 commit f129e86
Show file tree
Hide file tree
Showing 4 changed files with 210 additions and 1 deletion.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
## 0.1.2

This release adds the last missing features for Android and Web, that are were
planned for now. The package will continue its ongoing efforts for stability
before iOS gets added as a supported platform.

### New Features

- Add `OfflineManager` for offline maps, cache management and bulk downloading.
- Add `PermissionsManager` to check and request location permissions.
- Add `WidgetLayer` to support widgets as Markers on the map.
- Add alternative Flutter platform view options for Texture Layer Hybrid
Composition, Hybrid Composition, Virtual Display.
- Bump MapLibre Native on Android to version `11.6.+`.
- Add web-only controller functions `toScreenLocationSync()`,
`toLngLatSync()`, `toScreenLocationsSync()`, `toLngLatsSync()`,
`getMetersPerPixelAtLatitudeSync()` and `getVisibleRegionSync()`.
- Add `MapOptions.of(context)` and `MapOptions.maybeOf(context)`.
- Add `padding` and `alignment` parameters to the `MapScalebar` widget.

## Bug Fixes

- Fix WebAssembly builds.
- Remove unused `flutter_markdown` package.

## Misc

- Add unit tests, add Android integration tests.
- Use [codecov](https://app.codecov.io/gh/josxha/flutter-maplibre) to monitor
test coverage.
- Improve file structure by using a `/platform` directory.

Full
Changelog: [v0.1.1...v0.1.2](https://github.com/josxha/flutter-maplibre/compare/v0.1.1...v0.1.2)

## 0.1.1

### New Features
Expand Down
85 changes: 85 additions & 0 deletions docs/docs/offline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
sidebar_position: 45
---

# Offline

The `OfflineManager` provides a set of tools to manage the cache and handle
offline maps. It enables users to download and interact with map data in areas
with limited or no internet access. Here, we’ll cover key features, usage
concepts, and API details for `OfflineManager`.

The download manager needs to be created asynchronous by
using `OfflineManager.createInstance()`. You can store the instance for later
use.

```dart
Future<OfflineManager> futureManager = OfflineManager.createInstance();
```

Don't forget to call `manager.dispose()` when you no longer need it. You
can do this for example in the `dispose` override of a flutter widget:

```dart
@override
void dispose() {
// highlight-next-line
manager.dispose();
super.dispose();
}
```

## Downloading Map Regions

Using OfflineManager, you can bulk-download specific map regions for offline
access.

```dart
Future<void> downloadMyMap() async {
final stream = await manager.downloadRegion(
minZoom: 10,
maxZoom: 14,
bounds: LngLatBounds(/* ... */),
mapStyleUrl: '...',
pixelDensity: 1,
);
await for (final update in stream) {
if (update.downloadCompleted) {
print('region downloaded: ${update.region}');
} else {
print(
'${update.loadedTiles} / ${update.totalTiles} '
'(${((update.progress ?? 0) * 100).toStringAsFixed(0)}%)',
);
}
}
}
```

## Managing Offline Regions

After regions are downloaded, they can be managed using methods to list, merge,
or retrieve specific region details:

### Listing Offline Regions

Get a list of all downloaded regions for management or display purposes by
using `manager.listOfflineRegions()`.

### Retrieving a Specific Region

Fetch a region’s details with `manager.getOfflineRegion(regionId: 1)`, which is
useful for managing or displaying region-specific data.

### Merging Regions

Merge an offline region from an MBTiles database into the MapLibre tile cache by
using `manager.mergeOfflineRegions(path: 'path/to/mbtiles')`. Ensure that the
app has permission to read the directory.

### Cache Management

There are mutliple methods to manage and control the cache, ensuring efficient
use of storage. Head over to
the [API docs](https://pub.dev/documentation/maplibre/latest/maplibre/OfflineManager-class.html)
to learn more.
89 changes: 89 additions & 0 deletions docs/versioned_docs/version-0.1.x/offline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
sidebar_position: 45
---

# Offline

The `OfflineManager` provides a set of tools to manage the cache and handle
offline maps. It enables users to download and interact with map data in areas
with limited or no internet access. Here, we’ll cover key features, usage
concepts, and API details for `OfflineManager`.

:::info
The features described on this site have been added in version `0.1.2`.
:::

The download manager needs to be created asynchronous by
using `OfflineManager.createInstance()`. You can store the instance for later
use.

```dart
Future<OfflineManager> futureManager = OfflineManager.createInstance();
```

Don't forget to call `manager.dispose()` when you no longer need it. You
can do this for example in the `dispose` override of a flutter widget:

```dart
@override
void dispose() {
// highlight-next-line
manager.dispose();
super.dispose();
}
```

## Downloading Map Regions

Using OfflineManager, you can bulk-download specific map regions for offline
access.

```dart
Future<void> downloadMyMap() async {
final stream = await manager.downloadRegion(
minZoom: 10,
maxZoom: 14,
bounds: LngLatBounds(/* ... */),
mapStyleUrl: '...',
pixelDensity: 1,
);
await for (final update in stream) {
if (update.downloadCompleted) {
print('region downloaded: ${update.region}');
} else {
print(
'${update.loadedTiles} / ${update.totalTiles} '
'(${((update.progress ?? 0) * 100).toStringAsFixed(0)}%)',
);
}
}
}
```

## Managing Offline Regions

After regions are downloaded, they can be managed using methods to list, merge,
or retrieve specific region details:

### Listing Offline Regions

Get a list of all downloaded regions for management or display purposes by
using `manager.listOfflineRegions()`.

### Retrieving a Specific Region

Fetch a region’s details with `manager.getOfflineRegion(regionId: 1)`, which is
useful for managing or displaying region-specific data.

### Merging Regions

Merge an offline region from an MBTiles database into the MapLibre tile cache by
using `manager.mergeOfflineRegions(path: 'path/to/mbtiles')`. Ensure that the
app has permission to read the directory.

### Cache Management

There are mutliple methods to manage and control the cache, ensuring efficient
use of storage. Head over to
the [API docs](https://pub.dev/documentation/maplibre/latest/maplibre/OfflineManager-class.html)
to learn more.
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: maplibre
description: "Permissive and performant mapping library that supports Mapbox Vector Tiles (MVT) powered by MapLibre SDKs."
version: 0.1.1
version: 0.1.2
repository: https://github.com/josxha/flutter-maplibre
issue_tracker: https://github.com/josxha/flutter-maplibre/issues
homepage: https://flutter-maplibre.pages.dev
Expand Down

0 comments on commit f129e86

Please sign in to comment.