diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml index aed302ba1..df2d292d8 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -1,7 +1,7 @@ name: Bug Report -description: Create a bug report to help us improve -title: "[BUG] " -labels: ["bug", "needs triage"] +description: Let us know about something that isn't working +labels: ["needs triage"] +type: Bug body: - type: markdown attributes: @@ -9,29 +9,27 @@ body: # Bug Report Thanks for taking the time to fill out this bug report! To help us verify the issue quicker, please include as much information as you can. - - + + --- - - + + Before reporting a bug, please: * Check if there is already an open or closed issue that is similar to yours - - * Ensure that you have fully read the documentation (both the website and API docs) that pertains to the function you're having problems with - * Ensure that your Flutter environment is correctly installed & set-up + * Ensure that you have fully read the documentation (both the website and API docs) that relates to the feature(s) you're having problems with * Remember that we're volunteers trying our best to help, so please be polite - - + + --- " - type: textarea id: details attributes: label: What is the bug? - description: What were you implementing when you found this issue? What happens when the bug triggers? What do you think should have happened instead? Please include as much detail as possible, including screenshots and screen-recordings if you can. + description: What were you implementing when you found this issue? What happens when the bug triggers? What do you think should have happened instead? Does it only occur on a specific platform? Please include as much detail as possible, including screenshots and screen-recordings if you can. validations: required: true - type: textarea @@ -47,27 +45,4 @@ body: id: solution attributes: label: Do you have a potential solution? - description: "If so, please detail it: it will make it quicker for us to fix the issue." - - type: markdown - attributes: - value: --- - - type: input - id: platform - attributes: - label: Platforms - description: Please detail the devices and operating systems you can reproduce this bug on, separated by commas. - placeholder: eg. Android 13 (Samsung Galaxy S99), Windows 11 (x64) - validations: - required: true - - type: dropdown - id: severity - attributes: - label: Severity - description: How much of a problem is this issue, when it does occur? - options: - - "Minimum: Allows normal functioning" - - "Obtrusive: Prevents normal functioning but causes no errors in the console" - - "Erroneous: Prevents normal functioning and causes errors in the console" - - "Fatal: Causes the application to crash" - validations: - required: true + description: "If so, please detail it: it will make it quicker for us to fix the issue. We also hugely appriciate PRs!" diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index dadb08ecd..0000c2025 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,11 @@ blank_issues_enabled: false contact_links: - - name: Get Help + - name: Get help url: https://discord.gg/BwpEsjqMAH about: Don't quite understand how to implement something, or just want to talk? Join the Discord server! - - name: Frequently Asked Questions - url: https://docs.fleaflet.dev/frequently-asked-questions + - name: Check the FAQs + url: https://docs.fleaflet.dev/#faqs about: Before posting an issue or asking for help, please check whether your question has already been answered! - - name: Documentation + - name: Read the documentation url: https://docs.fleaflet.dev/ about: Before posting an issue or asking for help, please ensure you read the documentation thoroughly diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml index 5fa489bd0..f629ff350 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yaml +++ b/.github/ISSUE_TEMPLATE/feature-request.yaml @@ -1,29 +1,29 @@ name: Feature Request description: Suggest functionality that you'd like to see -title: "[FEATURE] <title>" -labels: ["feature", "P3 (low)"] +labels: ["P3 (low)"] +type: Feature body: - type: markdown attributes: value: " # Feature Request - Thanks for taking the time to let us know what you want to see! + Thanks for taking the time to let us know what you want to see in flutter_map! Unfortunately, response times for feature requests are longer than bug reports, as they are lower priority. If you want this functionality implemented quickly, please make a Pull Request to go alongside this feature request. - - + + --- - - + + Before requesting a feature, please: * Check if there is already an open or closed issue that is similar to yours - + * Ensure that you're using the latest version of flutter_map - + * Ensure that you've read the documentation (both the website and API docs) thoroughly - - + + --- " - type: textarea @@ -46,14 +46,3 @@ body: attributes: label: Can you provide any other information? description: Is there anything else you'd like to say? - - type: dropdown - id: severity - attributes: - label: Severity - description: How much of a problem is the lack of functionality for you? - options: - - "Minimum: Not required for my use" - - "Annoying: Currently have to use workarounds" - - "Obtrusive: No workarounds are available, and this is essential to me" - validations: - required: true diff --git a/.gitignore b/.gitignore index bd908840f..c038450ab 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ .pub-cache/ .pub/ build/ -# TODO: document why we don't want this file pubspec.lock # Android related @@ -41,6 +40,7 @@ pubspec.lock **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java +**/android/app/.cxx # iOS/XCode related **/ios/**/*.mode1v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index e06a2f0b4..cc0cfdf6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,21 +2,44 @@ 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! -This CHANGELOG does not include every commit and/or PR - it is a hand picked selection of the most important ones. For a full list of changes, please check the GitHub repository releases/tags. +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.0.0] - 2024/07/02 +## [8.0.0] - 2025/XX/XX -Migration from `Point` class internally, but this also affects the external API. +**"Infinite Worlds** -Migration Guide: -- any methods that previously required `Point<double>` now require `Offset`, `Size`, or `Rect` as return values and parameters -- `pointToLatLng` -> `offsetToLatLng` -- `PointExtension` and `OffsetToPointExtension` marked as internal -- `MapController.rotateAroundPoint` now only accepts an Offset +Contains the following user-affecting changes: +- 🟢 Added unbounded horizontal scroll (with the default projection) and support for layers to cross anti-meridian - [#1948 (💰)](https://github.com/fleaflet/flutter_map/pull/1948), [#1969](https://github.com/fleaflet/flutter_map/pull/1969), [#1978](https://github.com/fleaflet/flutter_map/pull/1978), [#2000](https://github.com/fleaflet/flutter_map/pull/2000), [#2018](https://github.com/fleaflet/flutter_map/pull/2018), [#2025](https://github.com/fleaflet/flutter_map/pull/2025) for [#1582](https://github.com/fleaflet/flutter_map/issues/1582) +- 🟢 Added animated keyboard controls for gestures - [#1987](https://github.com/fleaflet/flutter_map/pull/1987) +- 🟢 Added `filterQuality` parameter to `(Base)OverlayImage` - [#1989](https://github.com/fleaflet/flutter_map/pull/1989) +- 🟢 Exposed `BaseOverlayImage` for external implementation/extension - [#1990](https://github.com/fleaflet/flutter_map/pull/1990) +- 🟡 Changed the majority of references to `Point` to `Offset`, and method names accordingly - [#1996](https://github.com/fleaflet/flutter_map/pull/1996) +- 🟡 Added integer `tileDimension` & deprecated `TileLayer.tileSize` - [#1940](https://github.com/fleaflet/flutter_map/pull/1940) Contains the following user-affecting bug fixes: +- Fixed polygon hit detection when map rotated - [#1942](https://github.com/fleaflet/flutter_map/pull/1942) for [#1934](https://github.com/fleaflet/flutter_map/issues/1934) +- Fixed polygon hit detection when polygon invalid - [#1964](https://github.com/fleaflet/flutter_map/pull/1964) for [#1933](https://github.com/fleaflet/flutter_map/issues/1933) +- Eagerly listen to `TileLayer.reset` stream internally to ensure handler is fired - [#1943](https://github.com/fleaflet/flutter_map/pull/1943) for [#1808](https://github.com/fleaflet/flutter_map/issues/1808) +- Fixed some tile loading/pruning state issues - [#2007](https://github.com/fleaflet/flutter_map/pull/2007) for partially [#1837](https://github.com/fleaflet/flutter_map/issues/1837) +- Use `Client` instead of `BaseClient` in network tile/image provider - [#2011](https://github.com/fleaflet/flutter_map/pull/2011) for [#2010](https://github.com/fleaflet/flutter_map/issues/2010) +- Avoid closing externally created `http.Client` in `NetworkTileProvider` - [#2012](https://github.com/fleaflet/flutter_map/pull/2012) for [#2009](https://github.com/fleaflet/flutter_map/issues/2009) + +Contains the following user-affecting performance improvements: + +- Fixed performance-related bug where `Polyline.renderHashCode` included `hashCode` unnecessarily causing internal draw batching to fail - [#1967](https://github.com/fleaflet/flutter_map/pull/1967) +- Fixed massive performance-related bug where the simplification cache for the `Polyline/gonLayer`s was incorrectly used - [#1991](https://github.com/fleaflet/flutter_map/pull/1991) +- Perform bounding-box culling prior to aggressive culling for `Polyline`s - [#1993](https://github.com/fleaflet/flutter_map/pull/1993) + +Many thanks to these contributors (in no particular order): + +- @monsieurtanuki +- @alestiago +- @RBT22 +- @TechnicJelle +- @slightfoot +- ... and all the maintainers ## [7.0.2] - 2024/07/02 @@ -90,7 +113,7 @@ Many thanks to these contributors (in no particular order): ## [6.2.1] - 2024/05/27 > If possible, prefer to update directly to v7. This version is provided only to enable Flutter 3.22 compatibility without requiring a breaking change. - +> > v6.2.0 was retracted from pub.dev due to a mistake in the release preparation. For more information, see [this comment](https://github.com/fleaflet/flutter_map/pull/1891#issuecomment-2134069848). v6.2.1 is the replacement without the issues. Contains the following user-affecting changes: diff --git a/analysis_options.yaml b/analysis_options.yaml index 38408115d..a14a0dd10 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -17,7 +17,6 @@ linter: cancel_subscriptions: true close_sinks: true directives_ordering: true - package_api_docs: true prefer_constructors_over_static_methods: true prefer_final_in_for_each: true prefer_final_locals: true diff --git a/example/.metadata b/example/.metadata index fff87d5d9..b8041ab28 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: "7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30" + revision: "53c27e519d33b4e13b01a8710b38a3591d6ca6f1" channel: "beta" project_type: app @@ -13,11 +13,11 @@ project_type: app migration: platforms: - platform: root - create_revision: 7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30 - base_revision: 7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30 - - platform: web - create_revision: 7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30 - base_revision: 7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30 + create_revision: 53c27e519d33b4e13b01a8710b38a3591d6ca6f1 + base_revision: 53c27e519d33b4e13b01a8710b38a3591d6ca6f1 + - platform: windows + create_revision: 53c27e519d33b4e13b01a8710b38a3591d6ca6f1 + base_revision: 53c27e519d33b4e13b01a8710b38a3591d6ca6f1 # User provided section diff --git a/example/README.md b/example/README.md index d0fcd0104..70d350285 100644 --- a/example/README.md +++ b/example/README.md @@ -1,4 +1,4 @@ -# Example Application For '[flutter_map](https://github.com/fleaflet/flutter_map)' +# Demo app for '[flutter_map](https://github.com/fleaflet/flutter_map)' Showcases functionality of the library in a neat and useful format that can be used for further API references, and just to see if you want this library for your app. diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle.kts similarity index 78% rename from example/android/app/build.gradle rename to example/android/app/build.gradle.kts index 7618b2d82..8048b8392 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id "com.android.application" - id "kotlin-android" + id("com.android.application") + id("kotlin-android") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. - id "dev.flutter.flutter-gradle-plugin" + id("dev.flutter.flutter-gradle-plugin") } android { @@ -17,7 +17,7 @@ android { } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 + jvmTarget = JavaVersion.VERSION_1_8.toString() } defaultConfig { @@ -30,7 +30,7 @@ android { buildTypes { release { - signingConfig = signingConfigs.debug + signingConfig = signingConfigs.getByName("debug") } } } diff --git a/example/android/build.gradle b/example/android/build.gradle deleted file mode 100644 index dd5921632..000000000 --- a/example/android/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = "../build" - -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" - project.evaluationDependsOn(":app") -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} - diff --git a/example/android/build.gradle.kts b/example/android/build.gradle.kts new file mode 100644 index 000000000..89176ef44 --- /dev/null +++ b/example/android/build.gradle.kts @@ -0,0 +1,21 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register<Delete>("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 259717082..f018a6181 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 348c409ea..afa1e8eb0 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle deleted file mode 100644 index ebe6f9c19..000000000 --- a/example/android/settings.gradle +++ /dev/null @@ -1,25 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version '8.7.3' apply false - id "org.jetbrains.kotlin.android" version "1.8.22" apply false -} - -include ":app" diff --git a/example/android/settings.gradle.kts b/example/android/settings.gradle.kts new file mode 100644 index 000000000..a439442c2 --- /dev/null +++ b/example/android/settings.gradle.kts @@ -0,0 +1,25 @@ +pluginManagement { + val flutterSdkPath = run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.7.0" apply false + id("org.jetbrains.kotlin.android") version "1.8.22" apply false +} + +include(":app") diff --git a/example/lib/pages/home.dart b/example/lib/pages/home.dart index a63062ff6..28eec1058 100644 --- a/example/lib/pages/home.dart +++ b/example/lib/pages/home.dart @@ -33,15 +33,9 @@ class _HomePageState extends State<HomePage> { body: Stack( children: [ FlutterMap( - options: MapOptions( - initialCenter: const LatLng(51.5, -0.09), + options: const MapOptions( + initialCenter: LatLng(51.5, -0.09), initialZoom: 5, - cameraConstraint: CameraConstraint.contain( - bounds: LatLngBounds( - const LatLng(-90, -180), - const LatLng(90, 180), - ), - ), ), children: [ openStreetMapTileLayer, diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 1cd95b899..6be048cc3 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: 7.0.1 +version: 8.0.0 environment: sdk: ">=3.6.0 <4.0.0" @@ -25,6 +25,10 @@ dependencies: dependency_overrides: flutter_map: path: ../ + flutter_map_geojson: + git: + url: https://github.com/JaffaKetchup/flutter_map_geojson.git + ref: fm-v8 dev_dependencies: flutter_lints: ">=4.0.0 <6.0.0" diff --git a/example/windows/CMakeLists.txt b/example/windows/CMakeLists.txt index c09389c56..e32eac17c 100644 --- a/example/windows/CMakeLists.txt +++ b/example/windows/CMakeLists.txt @@ -1,10 +1,10 @@ # Project-level configuration. cmake_minimum_required(VERSION 3.14) -project(example LANGUAGES CXX) +project(flutter_map_example LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "example") +set(BINARY_NAME "flutter_map_demo") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. @@ -87,6 +87,12 @@ if(PLUGIN_BUNDLED_LIBRARIES) COMPONENT Runtime) endif() +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") diff --git a/example/windows/runner/Runner.rc b/example/windows/runner/Runner.rc index a6993257d..9fdf07396 100644 --- a/example/windows/runner/Runner.rc +++ b/example/windows/runner/Runner.rc @@ -89,13 +89,13 @@ BEGIN BEGIN BLOCK "040904e4" BEGIN - VALUE "CompanyName", "me.jpryan" "\0" - VALUE "FileDescription", "example" "\0" + VALUE "CompanyName", "dev.fleaflet.flutter_map" "\0" + VALUE "FileDescription", "flutter_map Demo" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "example" "\0" - VALUE "LegalCopyright", "Copyright (C) 2023 me.jpryan. All rights reserved." "\0" - VALUE "OriginalFilename", "example.exe" "\0" - VALUE "ProductName", "example" "\0" + VALUE "InternalName", "flutter_map Demo" "\0" + VALUE "LegalCopyright", "Copyright (C) 2025 dev.fleaflet.flutter_map. All rights reserved." "\0" + VALUE "OriginalFilename", "flutter_map_demo.exe" "\0" + VALUE "ProductName", "flutter_map Demo" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0" END END diff --git a/example/windows/runner/runner.exe.manifest b/example/windows/runner/runner.exe.manifest index a42ea7687..153653e8d 100644 --- a/example/windows/runner/runner.exe.manifest +++ b/example/windows/runner/runner.exe.manifest @@ -9,12 +9,6 @@ <application> <!-- Windows 10 and Windows 11 --> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> - <!-- Windows 8.1 --> - <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> - <!-- Windows 8 --> - <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> - <!-- Windows 7 --> - <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> </application> </compatibility> </assembly> diff --git a/example/windows/runner/utils.cpp b/example/windows/runner/utils.cpp index b2b08734d..3a0b46511 100644 --- a/example/windows/runner/utils.cpp +++ b/example/windows/runner/utils.cpp @@ -45,13 +45,13 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/lib/src/layer/polygon_layer/painter.dart b/lib/src/layer/polygon_layer/painter.dart index dcb3be900..4f261acfd 100644 --- a/lib/src/layer/polygon_layer/painter.dart +++ b/lib/src/layer/polygon_layer/painter.dart @@ -114,68 +114,65 @@ base class _PolygonPainter<R extends Object> final polygon = lastPolygon!; // Draw filled polygon - // ignore: deprecated_member_use_from_same_package - if (polygon.isFilled ?? true) { - if (polygon.color case final color?) { - final paint = Paint() - ..style = PaintingStyle.fill - ..color = color; - - if (trianglePoints.isNotEmpty) { - final points = Float32List(trianglePoints.length * 2); - for (int i = 0; i < trianglePoints.length; ++i) { - points[i * 2] = trianglePoints[i].dx; - points[i * 2 + 1] = trianglePoints[i].dy; - } - final vertices = Vertices.raw(VertexMode.triangles, points); - canvas.drawVertices(vertices, BlendMode.src, paint); - - if (debugAltRenderer) { - for (int i = 0; i < trianglePoints.length; i += 3) { - canvas.drawCircle( - trianglePoints[i], - 5, - Paint()..color = const Color(0x7EFF0000), - ); - canvas.drawCircle( - trianglePoints[i + 1], - 5, - Paint()..color = const Color(0x7E00FF00), - ); - canvas.drawCircle( - trianglePoints[i + 2], - 5, - Paint()..color = const Color(0x7E0000FF), - ); - - final path = Path() - ..addPolygon( - [ - trianglePoints[i], - trianglePoints[i + 1], - trianglePoints[i + 2], - ], - true, - ); - - canvas.drawPath( - path, - Paint() - ..color = const Color(0x7EFFFFFF) - ..style = PaintingStyle.fill, + if (polygon.color case final color?) { + final paint = Paint() + ..style = PaintingStyle.fill + ..color = color; + + if (trianglePoints.isNotEmpty) { + final points = Float32List(trianglePoints.length * 2); + for (int i = 0; i < trianglePoints.length; ++i) { + points[i * 2] = trianglePoints[i].dx; + points[i * 2 + 1] = trianglePoints[i].dy; + } + final vertices = Vertices.raw(VertexMode.triangles, points); + canvas.drawVertices(vertices, BlendMode.src, paint); + + if (debugAltRenderer) { + for (int i = 0; i < trianglePoints.length; i += 3) { + canvas.drawCircle( + trianglePoints[i], + 5, + Paint()..color = const Color(0x7EFF0000), + ); + canvas.drawCircle( + trianglePoints[i + 1], + 5, + Paint()..color = const Color(0x7E00FF00), + ); + canvas.drawCircle( + trianglePoints[i + 2], + 5, + Paint()..color = const Color(0x7E0000FF), + ); + + final path = Path() + ..addPolygon( + [ + trianglePoints[i], + trianglePoints[i + 1], + trianglePoints[i + 2], + ], + true, ); - canvas.drawPath( - path, - Paint() - ..color = const Color(0xFF000000) - ..style = PaintingStyle.stroke, - ); - } + canvas.drawPath( + path, + Paint() + ..color = const Color(0x7EFFFFFF) + ..style = PaintingStyle.fill, + ); + + canvas.drawPath( + path, + Paint() + ..color = const Color(0xFF000000) + ..style = PaintingStyle.stroke, + ); } - } else { - canvas.drawPath(filledPath, paint); } + } else { + canvas.drawPath(filledPath, paint); } } @@ -246,17 +243,14 @@ base class _PolygonPainter<R extends Object> lastHash = hash; // First add fills and borders to path. - // ignore: deprecated_member_use_from_same_package - if (polygon.isFilled ?? true) { - if (polygon.color != null) { - if (polygonTriangles != null) { - final len = polygonTriangles.length; - for (int i = 0; i < len; ++i) { - trianglePoints.add(fillOffsets[polygonTriangles[i]]); - } - } else { - filledPath.addPolygon(fillOffsets, true); + if (polygon.color != null) { + if (polygonTriangles != null) { + final len = polygonTriangles.length; + for (int i = 0; i < len; ++i) { + trianglePoints.add(fillOffsets[polygonTriangles[i]]); } + } else { + filledPath.addPolygon(fillOffsets, true); } } diff --git a/lib/src/layer/polygon_layer/polygon.dart b/lib/src/layer/polygon_layer/polygon.dart index fd48da37f..54cf5b15b 100644 --- a/lib/src/layer/polygon_layer/polygon.dart +++ b/lib/src/layer/polygon_layer/polygon.dart @@ -44,29 +44,6 @@ class Polygon<R extends Object> { /// display it. final StrokePattern pattern; - /// **DEPRECATED** - /// - /// Prefer setting `color` to null to disable filling, or a `Color` to enable - /// filling of that color. - /// - /// This parameter will be removed to simplify the API, as this was a remnant of pre-null-safety. - /// - /// The default of this parameter is now `null` and will use the rules above - - /// the option is retained so as not to break APIs. - /// - /// This feature was deprecated (and the default changed) after v7. - /// - /// --- - /// - /// Set to true if the [Polygon] should be filled with a color. - @Deprecated( - 'Prefer setting `color` to null to disable filling, or a `Color` to enable filling of that color. ' - 'This parameter will be removed to simplify the API, as this was a remnant of pre-null-safety. ' - 'The default of this parameter is now `null` and will use the rules above - the option is retained so as not to break APIs. ' - 'This feature was deprecated (and the default changed) after v7.', - ) - final bool? isFilled; - /// Styles to use for line endings. final StrokeCap strokeCap; @@ -144,13 +121,6 @@ class Polygon<R extends Object> { this.borderColor = const Color(0xFFFFFF00), this.disableHolesBorder = false, this.pattern = const StrokePattern.solid(), - @Deprecated( - 'Prefer setting `color` to null to disable filling, or a `Color` to enable filling of that color. ' - 'This parameter will be removed to simplify the API, as this was a remnant of pre-null-safety. ' - 'The default of this parameter is now `null` and will use the rules above - the option is retained so as not to break APIs. ' - 'This feature was deprecated (and the default changed) after v7.', - ) - this.isFilled, this.strokeCap = StrokeCap.round, this.strokeJoin = StrokeJoin.round, this.label, @@ -158,8 +128,7 @@ class Polygon<R extends Object> { this.labelPlacement = PolygonLabelPlacement.centroid, this.rotateLabel = false, this.hitValue, - }) : _filledAndClockwise = - (isFilled ?? (color != null)) && isClockwise(points); + }) : _filledAndClockwise = color != null && isClockwise(points); /// Checks if the [Polygon] points are ordered clockwise in the list. static bool isClockwise(List<LatLng> points) { @@ -182,8 +151,6 @@ class Polygon<R extends Object> { borderColor == other.borderColor && disableHolesBorder == other.disableHolesBorder && pattern == other.pattern && - // ignore: deprecated_member_use_from_same_package - isFilled == other.isFilled && strokeCap == other.strokeCap && strokeJoin == other.strokeJoin && label == other.label && @@ -207,8 +174,6 @@ class Polygon<R extends Object> { borderColor, disableHolesBorder, pattern, - // ignore: deprecated_member_use_from_same_package - isFilled, strokeCap, strokeJoin, _filledAndClockwise, diff --git a/lib/src/map/options/options.dart b/lib/src/map/options/options.dart index 950fc3ac4..4e96582ca 100644 --- a/lib/src/map/options/options.dart +++ b/lib/src/map/options/options.dart @@ -136,45 +136,6 @@ class MapOptions { /// widget from rebuilding. final bool keepAlive; - /// **DEPRECATED** - /// - /// If necessary, manually wrap layers with `TransulcentPointer` widgets. - /// - /// This parameter will be removed as proper hit detection has now been - /// incorporated into both `PolygonLayer` & `PolylineLayer`, which reduces the - /// need for this workaround, and because it caused issues in some cases. More - /// information about hit detection & interactivity rules can be found in the - /// online documentation. - /// - /// The default of this parameter is now `false` and will use the rules above; - /// the option is retained so as not to break APIs. - /// - /// This feature was deprecated (and the default changed) after v7. - /// - /// --- - /// - /// Whether to apply pointer translucency to all layers automatically - /// - /// This will mean that each layer can handle all the gestures that enter the - /// map themselves. Without this, only the top layer may handle gestures. - /// - /// Note that layers that are visually obscured behind another layer will - /// receive events, if this is enabled. - /// - /// Technically, layers become invisible to the parent `Stack` when hit - /// testing (and thus `Stack` will keep bubbling gestures down all layers), but - /// will still allow their subtree to receive pointer events. - /// - /// If this is `false` (defaults to `false`), then [TranslucentPointer] may be - /// manually applied to individual layers. - @Deprecated( - 'If necessary, manually wrap layers with `TransulcentPointer` widgets. ' - 'This parameter will be removed as proper hit detection has now been incorporated into both `PolygonLayer` & `PolylineLayer`, which reduces the need for this workaround, and because it caused issues in some cases. More information about hit detection & interactivity rules can be found in the online documentation. ' - 'The default of this parameter is now `false` and will use the rules above - the option is retained so as not to break APIs. ' - 'This feature was deprecated (and the default changed) after v7.', - ) - final bool applyPointerTranslucencyToLayers; - /// Gesture and input options for the map widget. final InteractionOptions interactionOptions; @@ -201,13 +162,6 @@ class MapOptions { this.onMapEvent, this.onMapReady, this.keepAlive = false, - @Deprecated( - 'If necessary, manually wrap layers with `TransulcentPointer` widgets. ' - 'This parameter will be removed as proper hit detection has now been incorporated into both `PolygonLayer` & `PolylineLayer`, which reduces the need for this workaround, and because it caused issues in some cases. More information about hit detection & interactivity rules can be found in the online documentation. ' - 'The default of this parameter is now `false` and will use the rules above - the option is retained so as not to break APIs. ' - 'This feature was deprecated (and the default changed) after v7.', - ) - this.applyPointerTranslucencyToLayers = false, }); /// The options of the closest [FlutterMap] ancestor. If this is called from a @@ -245,10 +199,7 @@ class MapOptions { cameraConstraint == other.cameraConstraint && onMapReady == other.onMapReady && keepAlive == other.keepAlive && - interactionOptions == other.interactionOptions && - backgroundColor == other.backgroundColor && - applyPointerTranslucencyToLayers == - other.applyPointerTranslucencyToLayers; + interactionOptions == other.interactionOptions; @override int get hashCode => Object.hashAll([ @@ -274,6 +225,5 @@ class MapOptions { keepAlive, interactionOptions, backgroundColor, - applyPointerTranslucencyToLayers, ]); } diff --git a/lib/src/map/widget.dart b/lib/src/map/widget.dart index b1b5bbd70..14a09ed17 100644 --- a/lib/src/map/widget.dart +++ b/lib/src/map/widget.dart @@ -98,10 +98,7 @@ class _FlutterMapStateContainer extends State<FlutterMap> Positioned.fill( child: ColoredBox(color: widget.options.backgroundColor), ), - // ignore: deprecated_member_use_from_same_package - ...widget.options.applyPointerTranslucencyToLayers - ? widget.children.map((child) => TranslucentPointer(child: child)) - : widget.children, + ...widget.children, ], ), ); diff --git a/pubspec.yaml b/pubspec.yaml index dc1bba10f..7556a8f77 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_map description: A versatile mapping package for Flutter, that's simple and easy to learn, yet completely customizable and configurable -version: 7.0.2 +version: 8.0.0 repository: https://github.com/fleaflet/flutter_map issue_tracker: https://github.com/fleaflet/flutter_map/issues diff --git a/windowsApplicationInstallerSetup.iss b/windowsApplicationInstallerSetup.iss index 0defc7fe3..443bb4446 100644 --- a/windowsApplicationInstallerSetup.iss +++ b/windowsApplicationInstallerSetup.iss @@ -2,11 +2,11 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "flutter_map Demo" -#define MyAppVersion "for 7.0.1" +#define MyAppVersion "for 8.0.0" #define MyAppPublisher "fleaflet" #define MyAppURL "https://github.com/fleaflet/flutter_map" #define MyAppSupportURL "https://github.com/fleaflet/flutter_map/issues" -#define MyAppExeName "example.exe" +#define MyAppExeName "flutter_map_demo.exe" [Setup] ; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. @@ -62,7 +62,7 @@ Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked -; Specify all files within 'build/windows/x64/runner/Release' except 'example.exe' +; Specify all files within 'build/windows/x64/runner/Release' except 'flutter_map_demo.exe' [Files] Source: "example\build\windows\x64\runner\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion Source: "example\build\windows\x64\runner\Release\flutter_windows.dll"; DestDir: "{app}"; Flags: ignoreversion