diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 2c9cff271..f827d932a 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: "https://docs.fleaflet.dev/supporters#support-us" \ No newline at end of file +github: fleaflet diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 98c888924..adca2ba15 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -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: @@ -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: . @@ -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: diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 64541cb62..328a4cafe 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -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: @@ -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: . @@ -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: diff --git a/CHANGELOG.md b/CHANGELOG.md index cb50845bf..1920dc381 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 +- @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: @@ -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 @@ -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 diff --git a/README.md b/README.md index 8367f981a..45169a422 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/example/lib/widgets/drawer/menu_drawer.dart b/example/lib/widgets/drawer/menu_drawer.dart index b150476e9..99cdaab54 100644 --- a/example/lib/widgets/drawer/menu_drawer.dart +++ b/example/lib/widgets/drawer/menu_drawer.dart @@ -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'; @@ -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; @@ -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, + ), + ), + ], + ), + ), ], ), ), @@ -261,4 +305,8 @@ class MenuDrawer extends StatelessWidget { ), ); } + + void _openCommit() => launchUrl( + Uri.parse('https://github.com/fleaflet/flutter_map/commit/$_commitSHA'), + ); } diff --git a/example/pubspec.lock b/example/pubspec.lock index edee147f7..fe6e41420 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -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 diff --git a/example/pubspec.yaml b/example/pubspec.yaml index a8011e6b1..f27cab7b9 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -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" @@ -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: diff --git a/lib/src/layer/tile_layer/tile_display.dart b/lib/src/layer/tile_layer/tile_display.dart index e7768f0cb..07ff04562 100644 --- a/lib/src/layer/tile_layer/tile_display.dart +++ b/lib/src/layer/tile_layer/tile_display.dart @@ -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._; @@ -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. @@ -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. diff --git a/lib/src/layer/tile_layer/tile_layer.dart b/lib/src/layer/tile_layer/tile_layer.dart index 03b708d1d..3dcba4c0f 100644 --- a/lib/src/layer/tile_layer/tile_layer.dart +++ b/lib/src/layer/tile_layer/tile_layer.dart @@ -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)'); @@ -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 diff --git a/lib/src/map/widget.dart b/lib/src/map/widget.dart index 14a09ed17..bdab77d8b 100644 --- a/lib/src/map/widget.dart +++ b/lib/src/map/widget.dart @@ -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 /// @@ -60,15 +58,6 @@ class _FlutterMapStateContainer extends State 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 diff --git a/pubspec.yaml b/pubspec.yaml index fc070f54c..6f049f94a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,13 +1,13 @@ name: flutter_map -description: A versatile mapping package for Flutter, that's simple and easy to learn, yet completely customizable and configurable -version: 8.1.1 +description: "Flutter's №1 non-commercially aimed map client: it's easy-to-use, versatile, vendor-free, fully cross-platform, and 100% pure-Flutter" +version: 8.2.0 repository: https://github.com/fleaflet/flutter_map issue_tracker: https://github.com/fleaflet/flutter_map/issues documentation: https://docs.fleaflet.dev funding: - - https://docs.fleaflet.dev/supporters#support-us + - https://github.com/sponsors/fleaflet topics: - flutter-map diff --git a/windowsApplicationInstallerSetup.iss b/windowsApplicationInstallerSetup.iss index 2ddb822ed..c493974f7 100644 --- a/windowsApplicationInstallerSetup.iss +++ b/windowsApplicationInstallerSetup.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "flutter_map Demo" -#define MyAppVersion "for 8.1.1" +#define MyAppVersion "for 8.2.0" #define MyAppPublisher "fleaflet" #define MyAppURL "https://github.com/fleaflet/flutter_map" #define MyAppSupportURL "https://github.com/fleaflet/flutter_map/issues"