Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0acd07a
Prepare for v8.2.0
JaffaKetchup Mar 23, 2025
7821edc
Rewritten README
JaffaKetchup Mar 24, 2025
392f1b9
Fixed README
JaffaKetchup Mar 24, 2025
1e298f3
Update funding link in pubspec
JaffaKetchup Mar 26, 2025
bd3c495
Updated project description
JaffaKetchup Mar 26, 2025
b2e85e0
Updated description
JaffaKetchup Mar 27, 2025
78add21
Updated changelog to include #2066
JaffaKetchup Mar 27, 2025
008a310
Restore tile layer warning when using OSM tile server with subdomains…
JaffaKetchup Apr 3, 2025
97759e6
Updated example app dependencies
JaffaKetchup Apr 6, 2025
f7397f9
Merge branch 'master' into prep-v8.2.0
JaffaKetchup Apr 6, 2025
720ec2c
Updated example app dependencies
JaffaKetchup Apr 6, 2025
c2c6af1
Updated CHANGELOG
JaffaKetchup Apr 7, 2025
4cab265
Remove HTML/CanvasKit warning
JaffaKetchup Apr 8, 2025
d5c2180
Fix linting issue
JaffaKetchup Apr 8, 2025
2a89523
Updated CHANGELOG
JaffaKetchup May 16, 2025
5761dfa
Merge branch 'master' into prep-v8.2.0
JaffaKetchup May 16, 2025
0f70516
Minor improvements to commit SHA display in example app
JaffaKetchup May 16, 2025
cc6f0ab
Fix documentation bug (fixes #2098)
JaffaKetchup May 28, 2025
3844f2e
Updated CHANGELOG
JaffaKetchup Jun 8, 2025
79421f7
Merge branch 'master' into prep-v8.2.0
JaffaKetchup Jul 8, 2025
33e6783
Updated CHANGELOG
JaffaKetchup Jul 9, 2025
02b010a
Merge branch 'master' into prep-v8.2.0
JaffaKetchup Jul 9, 2025
92f2f51
Merge branch 'master' into prep-v8.2.0
JaffaKetchup Jul 10, 2025
3a5db30
Update CHANGELOG
JaffaKetchup Jul 10, 2025
a05af29
Move `TileLayer` warning logs out of constructor
JaffaKetchup Jul 10, 2025
894f636
Remove faulty retina mode warning
JaffaKetchup Jul 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
custom: "https://docs.fleaflet.dev/supporters#support-us"
github: fleaflet
6 changes: 3 additions & 3 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
channel: "stable"
cache: true
- name: Build Android Application
run: flutter build apk --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
run: flutter build apk --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
- name: Archive Artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -105,7 +105,7 @@ jobs:
channel: "stable"
cache: true
- name: Build Windows Application
run: flutter build windows --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
run: flutter build windows --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
- name: Create Windows Application Installer
run: iscc "windowsApplicationInstallerSetup.iss"
working-directory: .
Expand All @@ -131,7 +131,7 @@ jobs:
channel: "stable"
cache: true
- name: Build Web Application
run: flutter build web --wasm --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
run: flutter build web --wasm --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
- name: Archive Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
channel: "stable"
cache: true
- name: Build Android Application
run: flutter build apk --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
run: flutter build apk --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
- name: Archive Artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -76,7 +76,7 @@ jobs:
channel: "stable"
cache: true
- name: Build Windows Application
run: flutter build windows --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
run: flutter build windows --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
- name: Create Windows Application Installer
run: iscc "windowsApplicationInstallerSetup.iss"
working-directory: .
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
channel: "stable"
cache: true
- name: Build Web Application
run: flutter build web --wasm --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
run: flutter build web --wasm --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
- name: Archive Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
47 changes: 46 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,52 @@
# Changelog

Please consider [donating](https://docs.fleaflet.dev/supporters#support-us) or [contributing](https://docs.fleaflet.dev/credits#contributing) if you're a fan of what we're doing and you'd like to support future releases!
Please consider [donating](https://github.com/sponsors/fleaflet) or [contributing](https://github.com/fleaflet/flutter_map/blob/master/CONTRIBUTING.md) if you're a fan of what we're doing and you'd like to support future releases!

This CHANGELOG does not include every commit and/or PR - it is a hand picked selection of the ones that have an effect on you. For a full list of changes, please check the GitHub repository releases/tags.

## [8.2.0] - 2025/07/10

Contains the following user-affecting changes:

- Added inverted fill option to `PolygonLayer` - [#2046 (💰)](https://github.com/fleaflet/flutter_map/pull/2046) for [#2034](https://github.com/fleaflet/flutter_map/issues/2034)
- Added `Polyline/gonLayer.oneWorld` parameter - [#2069](https://github.com/fleaflet/flutter_map/pull/2069) for [#2067](https://github.com/fleaflet/flutter_map/issues/2067)
- Added `ContainCameraLatitude` camera constraint - [#2073](https://github.com/fleaflet/flutter_map/pull/2073) for [#2071](https://github.com/fleaflet/flutter_map/issues/2071)
- Added options to customize double-tap (drag) zoom gestures - [#2070](https://github.com/fleaflet/flutter_map/pull/2070)
- Added warning on usage of OpenStreetMap public tile servers with `TileLayer` - [#2074](https://github.com/fleaflet/flutter_map/pull/2074) and [#2109](https://github.com/fleaflet/flutter_map/pull/2109)
- Added `PolygonLayer.painterFillMethod` parameter & changed default fill methods - [#2081](https://github.com/fleaflet/flutter_map/pull/2081)
- Added simple built-in (but extensible) caching to `NetworkTileProvider` - [#2082](https://github.com/fleaflet/flutter_map/pull/2082)
- Added aborting of obsolete in-flight HTTP requests to `NetworkTileProvider` - [#2082](https://github.com/fleaflet/flutter_map/pull/2082)
- Added `CircleLayer.optimizeRadiusInMeters` option to improve performance in some cases - [#2101](https://github.com/fleaflet/flutter_map/pull/2101)
- Replace (with deprecation) `Polygon.labelPlacement` with more flexible and extensible `Polygon.labelPlacementCalculator`/`PolygonLabelPlacementCalculator` system - [#2102](https://github.com/fleaflet/flutter_map/pull/2102)
- Added new 'signed area centroid' algorithm, and switch polylabel label placement implementation to use new external library - [#2102](https://github.com/fleaflet/flutter_map/pull/2102)

Contains the following user-affecting bug fixes:

- Consider `zoomOffset` & emulated retina mode when generating tile coordinates - [#2060](https://github.com/fleaflet/flutter_map/pull/2060) for [#2042](https://github.com/fleaflet/flutter_map/issues/2042)
- Raise attribution widgets above screen insets - [#2058](https://github.com/fleaflet/flutter_map/pull/2058)
- Stop ongoing fling and zoom animations when scroll zooming - [#2066](https://github.com/fleaflet/flutter_map/pull/2066) for [#1767](https://github.com/fleaflet/flutter_map/issues/1767)
- Calculate `LayerHitResult.coordinate` correctly - [#2093](https://github.com/fleaflet/flutter_map/pull/2093) for [#2092](https://github.com/fleaflet/flutter_map/issues/2092)
- Consider that the camera may be over the anti-meridian when creating `LatLngBounds` in `MapCamera.visibleBounds` for polygon culling - [#2091](https://github.com/fleaflet/flutter_map/pull/2091) for [#2080](https://github.com/fleaflet/flutter_map/issues/2080)
- Adjust infinite loop protection in internals which allow multi-world functionality to improve performance and add more debug info on error - [#2113](https://github.com/fleaflet/flutter_map/pull/2113)
- Minor API docs fix on `TileDisplay.fadeIn` arguments - [#2114](https://github.com/fleaflet/flutter_map/pull/2114) for [#2098](https://github.com/fleaflet/flutter_map/issues/2098)

Contains the following meta changes to the package:

- Reduced final package size to ~900KB from >3MB - [#2056](https://github.com/fleaflet/flutter_map/pull/2056)
- Improved build & publish integrity: publishing to pub.dev now occurs directly from the GitHub repo - [#2059](https://github.com/fleaflet/flutter_map/pull/2059)

Many thanks to these contributors (in no particular order):

- @monsieurtanuki
- @Quirille
- @freekvandeven
- @mbenoukaiss
- @ReinisSprogis
Comment thread
JaffaKetchup marked this conversation as resolved.
- @tidu090
- ... and all the maintainers

And an additional special thanks to @monsieurtanuki for investing so much of their time into this project recently - we appreciate it!

## [8.1.1] - 2025/03/08

Contains the following user-affecting bug fixes:
Expand All @@ -13,6 +56,7 @@ Contains the following user-affecting bug fixes:
Many thanks to these contributors (in no particular order):

- @monsieurtanuki
- ... and all the maintainers

## [8.1.0] - 2025/02/25

Expand All @@ -29,6 +73,7 @@ Many thanks to these contributors (in no particular order):

- @tlserver
- @monsieurtanuki
- ... and all the maintainers

## [8.0.0] - 2025/02/02

Expand Down
34 changes: 8 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,15 @@
# flutter_map
# flutter_map    [![pub.dev](https://img.shields.io/pub/v/flutter_map.svg?label=&style=for-the-badge)](https://pub.dev/packages/flutter_map)

A versatile mapping package for Flutter. Simple and easy to learn, yet completely customizable and configurable, it's the best choice for mapping in your Flutter app.
Flutter's №1 non-commercially aimed map client: it's easy-to-use, versatile, vendor-free, fully cross-platform, and 100% pure-Flutter

[![pub.dev](https://img.shields.io/pub/v/flutter_map.svg?label=Latest+Version)](https://pub.dev/packages/flutter_map)
[![stars](https://badgen.net/github/stars/fleaflet/flutter_map?label=stars&color=green&icon=github)](https://github.com/fleaflet/flutter_map/stargazers)
[![likes](https://img.shields.io/pub/likes/flutter_map?logo=flutter)](https://pub.dev/packages/flutter_map/score)
      
[![codecov](https://codecov.io/gh/fleaflet/flutter_map/graph/badge.svg?token=LgYgZQ0Yjj)](https://codecov.io/gh/fleaflet/flutter_map)
[![Open Issues](https://badgen.net/github/open-issues/fleaflet/flutter_map?label=Open+Issues&color=green)](https://github.com/fleaflet/flutter_map/issues)
[![Open PRs](https://badgen.net/github/open-prs/fleaflet/flutter_map?label=Open+PRs&color=green)](https://github.com/fleaflet/flutter_map/pulls)
* ### [📖 **Read the docs**](https://docs.fleaflet.dev/)

## [Donate](https://docs.fleaflet.dev/supporters#support-us)
* ### [🚀 **Launch the web demo**](https://demo.fleaflet.dev/)

We now accept one-time donations via Stripe! We're extremely grateful for anything you can spare. We'll donate 15% of what we receive to the OpenStreetMap Foundation, as a thanks for their excellent work.
For more information, details about benefits, and the link to donate, please see [Donate](https://docs.fleaflet.dev/supporters#support-us).
* ### [✍️ **Visit the GitHub source**](https://github.com/fleaflet/flutter_map)

## [Documentation](https://docs.fleaflet.dev/)
* ### [📦 **Visit the pub.dev package**](https://pub.dev/packages/flutter_map)

Visit our [documentation website](https://docs.fleaflet.dev/), for all information about how to use this library.
Additional documentation can be found in-code/whilst you type and over at the [pub.dev package](https://pub.dev/documentation/flutter_map/latest/flutter_map/flutter_map-library.html).
* ### [💬 **Join our Discord server**](https://discord.gg/BwpEsjqMAH)

## [Live Web Demo](https://demo.fleaflet.dev/)

> Please don't abuse the web demo! It runs on limited bandwidth and won't hold up to thousands of loads.
If you're going to be straining the application, please see the [Examples page in the docs](https://docs.fleaflet.dev/getting-started/examples), for information about building/using the application locally.

Want to see how flutter_map looks and works quickly? Just visit our [demo site](https://demo.fleaflet.dev/) that gets updated automatically with every new commit to 'master'!

## [Get Help](https://docs.fleaflet.dev/#get-help)

Not sure about how to do something, or just want to chat? Pop over to our [Discord server](https://discord.gg/BwpEsjqMAH) to get support quickly, and to get notified about new releases!
Think you've found a bug, or would like to see a new feature? We'd love to hear about it! Please see the [Get Help section of our docs](https://docs.fleaflet.dev/#get-help) for information about what to do.
* ### [💝 **Support us**](https://github.com/sponsors/fleaflet)
48 changes: 48 additions & 0 deletions example/lib/widgets/drawer/menu_drawer.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import 'dart:math';

import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map_example/pages/abort_obsolete_requests.dart';
import 'package:flutter_map_example/pages/animated_map_controller.dart';
Expand Down Expand Up @@ -34,8 +37,10 @@ import 'package:flutter_map_example/pages/tile_builder.dart';
import 'package:flutter_map_example/pages/tile_loading_error_handle.dart';
import 'package:flutter_map_example/pages/wms_tile_layer.dart';
import 'package:flutter_map_example/widgets/drawer/menu_item.dart';
import 'package:url_launcher/url_launcher.dart';

const _isWASM = bool.fromEnvironment('dart.tool.dart2wasm');
const _commitSHA = String.fromEnvironment('COMMIT_SHA');

class MenuDrawer extends StatelessWidget {
final String currentRoute;
Expand Down Expand Up @@ -78,6 +83,45 @@ class MenuDrawer extends StatelessWidget {
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodySmall,
),
if (_commitSHA != '')
SelectableText.rich(
TextSpan(
style: DefaultTextStyle.of(context).style,
children: [
const TextSpan(text: 'Built from: '),
TextSpan(
children: [
TextSpan(
text: '${_commitSHA.substring(
0,
min(_commitSHA.length, 7),
)} ',
recognizer: TapGestureRecognizer()
..onTap = _openCommit,
),
WidgetSpan(
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: _openCommit,
child: const Icon(
Icons.open_in_new,
size: 14,
color: Colors.blue,
),
),
),
),
],
style: const TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline,
decorationColor: Colors.blue,
),
),
],
),
),
],
),
),
Expand Down Expand Up @@ -261,4 +305,8 @@ class MenuDrawer extends StatelessWidget {
),
);
}

void _openCommit() => launchUrl(
Uri.parse('https://github.com/fleaflet/flutter_map/commit/$_commitSHA'),
);
}
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ packages:
path: ".."
relative: true
source: path
version: "8.1.1"
version: "8.2.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_map_example
description: Example application for 'flutter_map' package
publish_to: "none"
version: 8.1.1
version: 8.2.0

environment:
sdk: ">=3.6.0 <4.0.0"
Expand All @@ -13,10 +13,10 @@ dependencies:
flutter_map:
flutter_web_plugins:
sdk: flutter
http: ^1.2.2
http: ^1.3.0
latlong2: ^0.9.1
proj4dart: ^2.1.0
shared_preferences: ^2.3.4
shared_preferences: ^2.5.3
url_launcher: ^6.3.1

dependency_overrides:
Expand Down
14 changes: 8 additions & 6 deletions lib/src/layer/tile_layer/tile_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ sealed class TileDisplay {
/// Duration of the fade. Defaults to 100ms.
Duration duration,

/// Opacity start value when a tile is faded in, default 0.0. The allowed
/// range is (0.0 - 1.0).
/// Opacity start value when a tile is faded in.
///
/// Defaults to 0. Must be in the range (inclusive) 0 - 1.
double startOpacity,

/// Opacity start value when a tile is reloaded, default 0.0. Valid range is
/// (0.0 - 1.0).
/// Opacity start value when a tile is reloaded.
///
/// Defaults to 0. Must be in the range (inclusive) 0 - 1.
double reloadStartOpacity,
}) = FadeInTileDisplay._;

Expand All @@ -56,7 +58,7 @@ sealed class TileDisplay {
}
}

/// Display the tile instantaneous.
/// Displays a tile instantaneously
@immutable
class InstantaneousTileDisplay extends TileDisplay {
/// The optional opacity of the tile.
Expand All @@ -80,7 +82,7 @@ class InstantaneousTileDisplay extends TileDisplay {
int get hashCode => opacity.hashCode;
}

/// A [TileDisplay] that should get faded in.
/// Displays a tile with a fade-in animation
@immutable
class FadeInTileDisplay extends TileDisplay {
/// The duration of the fade in animation.
Expand Down
42 changes: 16 additions & 26 deletions lib/src/layer/tile_layer/tile_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -278,32 +278,9 @@ class TileLayer extends StatefulWidget {
tileProvider = tileProvider ?? NetworkTileProvider(),
tileUpdateTransformer =
tileUpdateTransformer ?? TileUpdateTransformers.ignoreTapEvents {
if (kDebugMode &&
retinaMode == null &&
urlTemplate != null &&
urlTemplate!.contains('{r}')) {
Logger(printer: PrettyPrinter(methodCount: 0)).i(
'\x1B[1m\x1B[3mflutter_map\x1B[0m\nThe URL template includes a retina '
"mode placeholder ('{r}') to retrieve native high-resolution\ntiles, "
'which improve appearance especially on high-density displays.\n'
'However, `TileLayer.retinaMode` was left unset, meaning flutter_map '
'will never retrieve these tiles.\nConsider using '
'`RetinaMode.isHighDensity` to toggle this property automatically, '
'otherwise ensure\nit is set appropriately.\n'
'See https://docs.fleaflet.dev/layers/tile-layer for more info.',
);
}
if (kDebugMode && kIsWeb && tileProvider is NetworkTileProvider?) {
Logger(printer: PrettyPrinter(methodCount: 0)).i(
'\x1B[1m\x1B[3mflutter_map\x1B[0m\nConsider installing the official '
"'flutter_map_cancellable_tile_provider' plugin for improved\n"
'performance on the web.\nSee '
'https://pub.dev/packages/flutter_map_cancellable_tile_provider for '
'more info.',
);
}

// Tile Provider Setup
// If the tile provider doesn't define a User-Agent, we define it here.
// This is so there's a convienient way for users to specifiy the agent
// without always having to manually specify a tile provider and headers.
if (!kIsWeb) {
this.tileProvider.headers.putIfAbsent(
'User-Agent', () => 'flutter_map ($userAgentPackageName)');
Expand Down Expand Up @@ -419,6 +396,19 @@ See:
_resetSub = widget.reset?.listen(_resetStreamHandler);
_tileRangeCalculator = TileRangeCalculator(tileDimension: _tileDimension);
_warnOpenStreetMapUrl();

// These log strong hints in debug mode, which is more visible to users than
// just documentation - they should only be used where there is a specific
// and large risk of the user doing something wrong.
if (kDebugMode &&
widget.urlTemplate != null &&
widget.urlTemplate!.contains('{s}.tile.openstreetmap.org')) {
Logger(printer: PrettyPrinter(methodCount: 0)).w(
'\x1B[1m\x1B[3mflutter_map\x1B[0m\nAvoid using subdomains with OSM\'s tile '
'server. Support may be become slow or be removed in future.\nSee '
'https://github.com/openstreetmap/operations/issues/737 for more info.',
);
}
}

// This is called on every map movement so we should avoid expensive logic
Expand Down
11 changes: 0 additions & 11 deletions lib/src/map/widget.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/src/gestures/map_interactive_viewer.dart';
import 'package:flutter_map/src/map/inherited_model.dart';
import 'package:logger/logger.dart';

/// An interactive geographical map
///
Expand Down Expand Up @@ -60,15 +58,6 @@ class _FlutterMapStateContainer extends State<FlutterMap>

WidgetsBinding.instance
.addPostFrameCallback((_) => widget.options.onMapReady?.call());

if (kDebugMode && kIsWeb && !isCanvasKit) {
Logger(printer: PrettyPrinter(methodCount: 0)).w(
'\x1B[1m\x1B[3mflutter_map\x1B[0m\nAvoid using HTML rendering on the web '
'platform. Prefer CanvasKit.\nSee '
'https://docs.fleaflet.dev/getting-started/installation#web for more '
'info.',
);
}
}

@override
Expand Down
Loading