diff --git a/.github/workflows/flutter_ci.yml b/.github/workflows/flutter_ci.yml
index a84605e0b..b0f6230e6 100644
--- a/.github/workflows/flutter_ci.yml
+++ b/.github/workflows/flutter_ci.yml
@@ -4,7 +4,7 @@ on: [push, pull_request, workflow_dispatch]
env:
FLUTTER_CHANNEL: 'stable'
- FLUTTER_VERSION: '3.7.7'
+ FLUTTER_VERSION: '3.10.5'
jobs:
format:
@@ -19,7 +19,7 @@ jobs:
channel: ${{ env.FLUTTER_CHANNEL }}
cache: true
- name: Lint analysis
- run: flutter format --set-exit-if-changed .
+ run: dart format --set-exit-if-changed .
lint:
name: "Static code analysis"
diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml
index 4672b17c1..a2059d80c 100644
--- a/.github/workflows/formatter.yml
+++ b/.github/workflows/formatter.yml
@@ -3,7 +3,7 @@ on: [workflow_dispatch]
env:
FLUTTER_CHANNEL: 'stable'
- FLUTTER_VERSION: '2.10.5'
+ FLUTTER_VERSION: '3.10.5'
jobs:
format:
diff --git a/example/.metadata b/example/.metadata
index 3b7a05a05..6311493bc 100644
--- a/example/.metadata
+++ b/example/.metadata
@@ -1,10 +1,39 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
-# This file should be version controlled and should not be manually edited.
+# This file should be version controlled.
version:
- revision: 2e2f19d3e9dd9bbc4e97e6b79bd573ab67c65109
- channel: master
+ revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ channel: stable
project_type: app
+
+# Tracks metadata for the flutter migrate command
+migration:
+ platforms:
+ - platform: root
+ create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ - platform: android
+ create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ - platform: ios
+ create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ - platform: macos
+ create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ - platform: web
+ create_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+ base_revision: d3d8effc686d73e0114d71abdcccef63fa1f25d2
+
+ # User provided section
+
+ # List of Local paths (relative to this file) that should be
+ # ignored by the migrate tool.
+ #
+ # Files that are not part of the templates will be ignored by default.
+ unmanaged_files:
+ - 'lib/main.dart'
+ - 'ios/Runner.xcodeproj/project.pbxproj'
diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml
new file mode 100644
index 000000000..f9b303465
--- /dev/null
+++ b/example/analysis_options.yaml
@@ -0,0 +1 @@
+include: package:flutter_lints/flutter.yaml
diff --git a/example/android/.gitignore b/example/android/.gitignore
index ee44ebdec..6f568019d 100644
--- a/example/android/.gitignore
+++ b/example/android/.gitignore
@@ -1,11 +1,13 @@
-*.iml
-*.class
-.gradle
+gradle-wrapper.jar
+/.gradle
+/captures/
+/gradlew
+/gradlew.bat
/local.properties
-/.idea/workspace.xml
-/.idea/libraries
-.DS_Store
-/build
-/captures
GeneratedPluginRegistrant.java
-app/src/main/res/values/developer-config.xml
\ No newline at end of file
+
+# Remember to never publicly share your keystore.
+# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
+key.properties
+**/*.keystore
+**/*.jks
diff --git a/example/android/.project b/example/android/.project
deleted file mode 100644
index c8a9ddca6..000000000
--- a/example/android/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- android
- Project android created by Buildship.
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.buildship.core.gradleprojectnature
-
-
-
- 1656406248070
-
- 30
-
- org.eclipse.core.resources.regexFilterMatcher
- node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
-
-
-
-
diff --git a/example/android/.settings/org.eclipse.buildship.core.prefs b/example/android/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index e47955840..000000000
--- a/example/android/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,13 +0,0 @@
-arguments=
-auto.sync=false
-build.scans.enabled=false
-connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
-connection.project.dir=
-eclipse.preferences.version=1
-gradle.user.home=
-java.home=
-jvm.arguments=
-offline.mode=false
-override.workspace.settings=false
-show.console.view=false
-show.executions.view=false
diff --git a/example/android/app/.classpath b/example/android/app/.classpath
deleted file mode 100644
index eb19361b5..000000000
--- a/example/android/app/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/example/android/app/.project b/example/android/app/.project
deleted file mode 100644
index 96e309c9c..000000000
--- a/example/android/app/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
- app
- Project app created by Buildship.
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.buildship.core.gradleprojectbuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- org.eclipse.buildship.core.gradleprojectnature
-
-
-
- 1656406248119
-
- 30
-
- org.eclipse.core.resources.regexFilterMatcher
- node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
-
-
-
-
diff --git a/example/android/app/.settings/org.eclipse.buildship.core.prefs b/example/android/app/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index b1886adb4..000000000
--- a/example/android/app/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-connection.project.dir=..
-eclipse.preferences.version=1
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index 231b94a07..f52635891 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -22,25 +22,33 @@ if (flutterVersionName == null) {
}
apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
- compileSdkVersion 31
- ndkVersion "21.1.6352462"
+ namespace "com.mapbox.example"
+ compileSdkVersion flutter.compileSdkVersion
+ ndkVersion flutter.ndkVersion
- lintOptions {
- disable 'InvalidPackage'
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ kotlinOptions {
+ jvmTarget = '1.8'
+ }
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
- // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.mapbox.mapboxglexample"
- minSdkVersion 21
- targetSdkVersion 31
+ minSdkVersion 20
+ targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- multiDexEnabled true
}
buildTypes {
@@ -48,17 +56,8 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
-
- // To fix UnsatisfiedLinkError
- ndk {
- abiFilters 'armeabi-v7a','arm64-v8a','x86_64', 'x86'
- }
}
}
- compileOptions {
- sourceCompatibility 1.8
- targetCompatibility 1.8
- }
}
flutter {
@@ -66,15 +65,5 @@ flutter {
}
dependencies {
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
- constraints {
- implementation('com.google.android.gms:play-services-location') {
- version {
- strictly "16.0.0"
- }
- because 'location: 4.2.3 does not specify version play-services-location'
- }
- }
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml
new file mode 100644
index 000000000..399f6981d
--- /dev/null
+++ b/example/android/app/src/debug/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index cab095b33..10c605ae5 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -1,43 +1,36 @@
-
-
+
-
-
+
+ android:name="io.flutter.embedding.android.NormalTheme"
+ android:resource="@style/NormalTheme"
+ />
-
-
-
-
+
-
diff --git a/example/android/app/src/main/java/com/mapbox/mapboxglexample/MainActivity.java b/example/android/app/src/main/java/com/mapbox/mapboxglexample/MainActivity.java
deleted file mode 100644
index 39570e461..000000000
--- a/example/android/app/src/main/java/com/mapbox/mapboxglexample/MainActivity.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.mapbox.mapboxglexample;
-
-import io.flutter.embedding.android.FlutterActivity;
-
-public class MainActivity extends FlutterActivity {}
diff --git a/example/android/app/src/main/kotlin/com/mapbox/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/mapbox/example/MainActivity.kt
index d6fa3f0b5..911d1cd12 100644
--- a/example/android/app/src/main/kotlin/com/mapbox/example/MainActivity.kt
+++ b/example/android/app/src/main/kotlin/com/mapbox/example/MainActivity.kt
@@ -1,12 +1,6 @@
package com.mapbox.example
-import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
-import io.flutter.embedding.engine.FlutterEngine
-import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
- override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
- GeneratedPluginRegistrant.registerWith(flutterEngine);
- }
}
diff --git a/example/android/app/src/main/res/drawable-v21/launch_background.xml b/example/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 000000000..f74085f3f
--- /dev/null
+++ b/example/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/example/android/app/src/main/res/values-night/styles.xml b/example/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 000000000..06952be74
--- /dev/null
+++ b/example/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml
index 00fa4417c..cb1ef8805 100644
--- a/example/android/app/src/main/res/values/styles.xml
+++ b/example/android/app/src/main/res/values/styles.xml
@@ -1,8 +1,18 @@
-
+
+
diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml
index f11e4c8d0..879d8dd3d 100644
--- a/example/android/app/src/profile/AndroidManifest.xml
+++ b/example/android/app/src/profile/AndroidManifest.xml
@@ -1,6 +1,6 @@
-
-
diff --git a/example/android/build.gradle b/example/android/build.gradle
index d66a442e3..f7eb7f63c 100644
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -1,11 +1,13 @@
buildscript {
+ ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.2'
+ classpath 'com.android.tools.build:gradle:7.3.0'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -24,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
-task clean(type: Delete) {
+tasks.register("clean", Delete) {
delete rootProject.buildDir
}
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index b6e61b62b..94adc3a3f 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -1,4 +1,3 @@
-android.enableJetifier=true
-android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M
-android.enableR8=true
+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 984258df3..3c472b99c 100644
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Wed Jun 03 09:18:08 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
diff --git a/example/android/settings.gradle b/example/android/settings.gradle
index f860b7645..44e62bcf0 100644
--- a/example/android/settings.gradle
+++ b/example/android/settings.gradle
@@ -8,4 +8,4 @@ localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
-apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
\ No newline at end of file
+apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
diff --git a/example/android/settings_aar.gradle b/example/android/settings_aar.gradle
deleted file mode 100644
index e7b4def49..000000000
--- a/example/android/settings_aar.gradle
+++ /dev/null
@@ -1 +0,0 @@
-include ':app'
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist
index 8d4492f97..9625e105d 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 9.0
+ 11.0
diff --git a/example/ios/Podfile b/example/ios/Podfile
index ec2d8a2b5..ece43299c 100644
--- a/example/ios/Podfile
+++ b/example/ios/Podfile
@@ -2,7 +2,7 @@ source 'https://cdn.cocoapods.org/'
source 'https://github.com/m0nac0/flutter-maplibre-podspecs.git'
# Uncomment this line to define a global platform for your project
-platform :ios, '9.0'
+platform :ios, '11.0'
pod 'MapLibre'
pod 'MapLibreAnnotationExtension'
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index 2a1292162..225d685bd 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -11,8 +11,9 @@ PODS:
- MapLibreAnnotationExtension (~> 0.0.1-beta.2)
- MapLibreAnnotationExtension (0.0.1-beta.2):
- MapLibre (~> 5.12.0)
- - path_provider_ios (0.0.1):
+ - path_provider_foundation (0.0.1):
- Flutter
+ - FlutterMacOS
DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
@@ -21,7 +22,7 @@ DEPENDENCIES:
- MapLibre
- maplibre_gl (from `.symlinks/plugins/maplibre_gl/ios`)
- MapLibreAnnotationExtension
- - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
+ - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
SPEC REPOS:
https://github.com/m0nac0/flutter-maplibre-podspecs.git:
@@ -37,18 +38,18 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/location/ios"
maplibre_gl:
:path: ".symlinks/plugins/maplibre_gl/ios"
- path_provider_ios:
- :path: ".symlinks/plugins/path_provider_ios/ios"
+ path_provider_foundation:
+ :path: ".symlinks/plugins/path_provider_foundation/darwin"
SPEC CHECKSUMS:
- device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
- Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
+ device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
+ Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740
MapLibre: 5aa820115d91293a4d09e681e7470f88bd34b672
maplibre_gl: 2a0ce99f40b3a133b0e8b40b5ef37e0562165399
MapLibreAnnotationExtension: bc7f1041206218d7d24ba0908e3145cd54b86664
- path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
+ path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9
-PODFILE CHECKSUM: 17402884ac1fb1b8596341d3b2550e1bb899a5ea
+PODFILE CHECKSUM: a908f6081c2697d922d17bcdb852cad068049f2e
-COCOAPODS: 1.11.3
+COCOAPODS: 1.12.1
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 7df86d991..22e2d66c7 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 50;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -210,10 +210,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@@ -251,7 +253,7 @@
"${BUILT_PRODUCTS_DIR}/device_info_plus/device_info_plus.framework",
"${BUILT_PRODUCTS_DIR}/location/location.framework",
"${BUILT_PRODUCTS_DIR}/maplibre_gl/maplibre_gl.framework",
- "${BUILT_PRODUCTS_DIR}/path_provider_ios/path_provider_ios.framework",
+ "${BUILT_PRODUCTS_DIR}/path_provider_foundation/path_provider_foundation.framework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/MapLibre/Mapbox.framework/Mapbox",
);
name = "[CP] Embed Pods Frameworks";
@@ -260,7 +262,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/location.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/maplibre_gl.framework",
- "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_ios.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_foundation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mapbox.framework",
);
runOnlyForDeploymentPostprocessing = 0;
@@ -270,6 +272,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -358,7 +361,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -440,7 +443,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -489,7 +492,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 000000000..f9b0d7c5e
--- /dev/null
+++ b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index 5ef0ea0b3..9c93607ed 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -49,5 +49,9 @@
Shows your location on the map and helps improve the map
NSLocationAlwaysUsageDescription
Shows your location on the map and helps improve the map
+ CADisableMinimumFrameDurationOnPhone
+
+ UIApplicationSupportsIndirectInputEvents
+
diff --git a/example/lib/animate_camera.dart b/example/lib/animate_camera.dart
index 59530e99a..9c83dd29a 100644
--- a/example/lib/animate_camera.dart
+++ b/example/lib/animate_camera.dart
@@ -8,7 +8,7 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class AnimateCameraPage extends ExamplePage {
- AnimateCameraPage()
+ const AnimateCameraPage({super.key})
: super(const Icon(Icons.map), 'Camera control, animated');
@override
@@ -18,7 +18,8 @@ class AnimateCameraPage extends ExamplePage {
}
class AnimateCamera extends StatefulWidget {
- const AnimateCamera();
+ const AnimateCamera({super.key});
+
@override
State createState() => AnimateCameraState();
}
@@ -65,8 +66,10 @@ class AnimateCameraState extends State {
),
),
)
- .then((result) => print(
- "mapController.animateCamera() returned $result"));
+ .then(
+ (result) => debugPrint(
+ "mapController.animateCamera() returned $result"),
+ );
},
child: const Text('newCameraPosition'),
),
@@ -77,9 +80,9 @@ class AnimateCameraState extends State {
CameraUpdate.newLatLng(
const LatLng(56.1725505, 10.1850512),
),
- duration: Duration(seconds: 5),
+ duration: const Duration(seconds: 5),
)
- .then((result) => print(
+ .then((result) => debugPrint(
"mapController.animateCamera() returned $result"));
},
child: const Text('newLatLng'),
diff --git a/example/lib/annotation_order_maps.dart b/example/lib/annotation_order_maps.dart
index 2640401f7..bbfb9f404 100644
--- a/example/lib/annotation_order_maps.dart
+++ b/example/lib/annotation_order_maps.dart
@@ -6,18 +6,18 @@ import 'page.dart';
import 'util.dart';
class AnnotationOrderPage extends ExamplePage {
- AnnotationOrderPage()
+ const AnnotationOrderPage({super.key})
: super(const Icon(Icons.layers), 'Annotation order maps');
@override
- Widget build(BuildContext context) => AnnotationOrderBody();
+ Widget build(BuildContext context) => const AnnotationOrderBody();
}
class AnnotationOrderBody extends StatefulWidget {
- AnnotationOrderBody();
+ const AnnotationOrderBody({super.key});
@override
- _AnnotationOrderBodyState createState() => _AnnotationOrderBodyState();
+ State createState() => _AnnotationOrderBodyState();
}
class _AnnotationOrderBodyState extends State {
@@ -103,11 +103,11 @@ class _AnnotationOrderBodyState extends State {
}
void onMapCreatedOne(MaplibreMapController controller) {
- this.controllerOne = controller;
+ controllerOne = controller;
}
void onMapCreatedTwo(MaplibreMapController controller) {
- this.controllerTwo = controller;
+ controllerTwo = controller;
}
void onStyleLoaded(MaplibreMapController controller) async {
@@ -123,7 +123,7 @@ class _AnnotationOrderBodyState extends State {
),
);
controller.addLine(
- LineOptions(
+ const LineOptions(
draggable: false,
lineColor: "#ff0000",
lineWidth: 7.0,
@@ -139,7 +139,7 @@ class _AnnotationOrderBodyState extends State {
),
);
controller.addFill(
- FillOptions(
+ const FillOptions(
draggable: false,
fillColor: "#008888",
fillOpacity: 0.3,
diff --git a/example/lib/click_annotations.dart b/example/lib/click_annotations.dart
index 4c522da88..0b10eb875 100644
--- a/example/lib/click_annotations.dart
+++ b/example/lib/click_annotations.dart
@@ -9,7 +9,7 @@ import 'page.dart';
import 'util.dart';
class ClickAnnotationPage extends ExamplePage {
- ClickAnnotationPage()
+ const ClickAnnotationPage({super.key})
: super(const Icon(Icons.check_circle), 'Annotation tap');
@override
@@ -19,7 +19,7 @@ class ClickAnnotationPage extends ExamplePage {
}
class ClickAnnotationBody extends StatefulWidget {
- const ClickAnnotationBody();
+ const ClickAnnotationBody({super.key});
@override
State createState() => ClickAnnotationBodyState();
@@ -27,7 +27,8 @@ class ClickAnnotationBody extends StatefulWidget {
class ClickAnnotationBodyState extends State {
ClickAnnotationBodyState();
- static const LatLng center = const LatLng(-33.88, 151.16);
+
+ static const LatLng center = LatLng(-33.88, 151.16);
MaplibreMapController? controller;
@@ -50,8 +51,13 @@ class ClickAnnotationBodyState extends State {
_showSnackBar(String type, String id) {
final snackBar = SnackBar(
- content: Text('Tapped $type $id',
- style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
+ content: Text(
+ 'Tapped $type $id',
+ style: const TextStyle(
+ fontSize: 18,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
backgroundColor: Theme.of(context).primaryColor);
ScaffoldMessenger.of(context).clearSnackBars();
ScaffoldMessenger.of(context).showSnackBar(snackBar);
@@ -77,7 +83,7 @@ class ClickAnnotationBodyState extends State {
await addImageFromAsset(
controller!, "custom-marker", "assets/symbols/custom-marker.png");
controller!.addCircle(
- CircleOptions(
+ const CircleOptions(
geometry: LatLng(-33.881979408447314, 151.171361438502117),
circleStrokeColor: "#00FF00",
circleStrokeWidth: 2,
@@ -85,7 +91,7 @@ class ClickAnnotationBodyState extends State {
),
);
controller!.addCircle(
- CircleOptions(
+ const CircleOptions(
geometry: LatLng(-33.894372606072309, 151.17576679759523),
circleStrokeColor: "#00FF00",
circleStrokeWidth: 2,
@@ -93,13 +99,13 @@ class ClickAnnotationBodyState extends State {
),
);
controller!.addSymbol(
- SymbolOptions(
+ const SymbolOptions(
geometry: LatLng(-33.894372606072309, 151.17576679759523),
iconImage: "custom-marker", //"fast-food-15",
iconSize: 2),
);
controller!.addLine(
- LineOptions(
+ const LineOptions(
geometry: [
LatLng(-33.874867744475786, 151.170627211986584),
LatLng(-33.881979408447314, 151.171361438502117),
@@ -113,7 +119,7 @@ class ClickAnnotationBodyState extends State {
);
controller!.addFill(
- FillOptions(
+ const FillOptions(
geometry: [
[
LatLng(-33.901517742631846, 151.178099204457737),
@@ -134,7 +140,7 @@ class ClickAnnotationBodyState extends State {
@override
Widget build(BuildContext context) {
return MaplibreMap(
- annotationOrder: [
+ annotationOrder: const [
AnnotationType.fill,
AnnotationType.line,
AnnotationType.circle,
diff --git a/example/lib/custom_marker.dart b/example/lib/custom_marker.dart
index 382afc4f8..63be880f8 100644
--- a/example/lib/custom_marker.dart
+++ b/example/lib/custom_marker.dart
@@ -11,29 +11,30 @@ import 'page.dart';
const randomMarkerNum = 100;
class CustomMarkerPage extends ExamplePage {
- CustomMarkerPage() : super(const Icon(Icons.place), 'Custom marker');
+ const CustomMarkerPage({super.key})
+ : super(const Icon(Icons.place), 'Custom marker');
@override
Widget build(BuildContext context) {
- return CustomMarker();
+ return const CustomMarker();
}
}
class CustomMarker extends StatefulWidget {
- const CustomMarker();
+ const CustomMarker({super.key});
@override
State createState() => CustomMarkerState();
}
class CustomMarkerState extends State {
- final Random _rnd = new Random();
+ final _rnd = Random();
late MaplibreMapController _mapController;
- List _markers = [];
- List<_MarkerState> _markerStates = [];
+ final _markers = [];
+ final _markerStates = [];
- void _addMarkerStates(_MarkerState markerState) {
+ void _addMarkerStates(MarkerState markerState) {
_markerStates.add(markerState);
}
@@ -47,7 +48,7 @@ class CustomMarkerState extends State {
}
void _onStyleLoadedCallback() {
- print('onStyleLoadedCallback');
+ debugPrint('onStyleLoadedCallback');
}
void _onMapLongClickCallback(Point point, LatLng coordinates) {
@@ -74,14 +75,20 @@ class CustomMarkerState extends State {
void _addMarker(Point point, LatLng coordinates) {
setState(() {
- _markers.add(Marker(_rnd.nextInt(100000).toString(), coordinates, point,
- _addMarkerStates));
+ _markers.add(
+ Marker(
+ _rnd.nextInt(100000).toString(),
+ coordinates,
+ point,
+ _addMarkerStates,
+ ),
+ );
});
}
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
body: Stack(children: [
MaplibreMap(
trackCameraPosition: true,
@@ -118,21 +125,21 @@ class CustomMarkerState extends State {
}
});
},
- child: Icon(Icons.add),
+ child: const Icon(Icons.add),
),
);
}
// ignore: unused_element
void _measurePerformance() {
- final trial = 10;
+ const trial = 10;
final batches = [500, 1000, 1500, 2000, 2500, 3000];
- var results = Map>();
+ final results = >{};
for (final batch in batches) {
results[batch] = [0.0, 0.0];
}
- _mapController.toScreenLocation(LatLng(0, 0));
+ _mapController.toScreenLocation(const LatLng(0, 0));
Stopwatch sw = Stopwatch();
for (final batch in batches) {
@@ -168,42 +175,47 @@ class CustomMarkerState extends State {
sw.reset();
}
- print(
- 'batch=$batch,primitive=${results[batch]![0] / trial}ms, batch=${results[batch]![1] / trial}ms');
+ debugPrint(
+ 'batch=$batch,primitive=${results[batch]![0] / trial}ms, batch=${results[batch]![1] / trial}ms',
+ );
}
}
}
class Marker extends StatefulWidget {
- final Point _initialPosition;
+ final Point initialPosition;
final LatLng _coordinate;
- final void Function(_MarkerState) _addMarkerState;
+ final void Function(MarkerState) addMarkerState;
Marker(
- String key, this._coordinate, this._initialPosition, this._addMarkerState)
- : super(key: Key(key));
+ String key,
+ this._coordinate,
+ this.initialPosition,
+ this.addMarkerState,
+ ) : super(key: Key(key));
@override
State createState() {
- final state = _MarkerState(_initialPosition);
- _addMarkerState(state);
- return state;
+ return MarkerState();
}
}
-class _MarkerState extends State with TickerProviderStateMixin {
+class MarkerState extends State with TickerProviderStateMixin {
final _iconSize = 20.0;
- Point _position;
+ late Point _position;
late AnimationController _controller;
late Animation _animation;
- _MarkerState(this._position);
+ MarkerState();
@override
void initState() {
super.initState();
+ _position = widget.initialPosition;
+ widget.addMarkerState(this);
+
_controller = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
@@ -246,6 +258,6 @@ class _MarkerState extends State with TickerProviderStateMixin {
}
LatLng getCoordinate() {
- return (widget as Marker)._coordinate;
+ return widget._coordinate;
}
}
diff --git a/example/lib/full_map.dart b/example/lib/full_map.dart
index d333ea322..b17ebccae 100644
--- a/example/lib/full_map.dart
+++ b/example/lib/full_map.dart
@@ -4,7 +4,8 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class FullMapPage extends ExamplePage {
- FullMapPage() : super(const Icon(Icons.map), 'Full screen map');
+ const FullMapPage({super.key})
+ : super(const Icon(Icons.map), 'Full screen map');
@override
Widget build(BuildContext context) {
@@ -13,7 +14,7 @@ class FullMapPage extends ExamplePage {
}
class FullMap extends StatefulWidget {
- const FullMap();
+ const FullMap({super.key});
@override
State createState() => FullMapState();
@@ -28,16 +29,18 @@ class FullMapState extends State {
}
_onStyleLoadedCallback() {
- ScaffoldMessenger.of(context).showSnackBar(SnackBar(
- content: Text("Style loaded :)"),
- backgroundColor: Theme.of(context).primaryColor,
- duration: Duration(seconds: 1),
- ));
+ ScaffoldMessenger.of(context).showSnackBar(
+ SnackBar(
+ content: const Text("Style loaded :)"),
+ backgroundColor: Theme.of(context).primaryColor,
+ duration: const Duration(seconds: 1),
+ ),
+ );
}
@override
Widget build(BuildContext context) {
- return new Scaffold(
+ return Scaffold(
// TODO: commented out when cherry-picking https://github.com/flutter-mapbox-gl/maps/pull/775
// needs different dark and light styles in this repo
// floatingActionButton: Padding(
diff --git a/example/lib/generated_plugin_registrant.dart b/example/lib/generated_plugin_registrant.dart
deleted file mode 100644
index 78c9b0d92..000000000
--- a/example/lib/generated_plugin_registrant.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Generated file. Do not edit.
-//
-
-// ignore_for_file: directives_ordering
-// ignore_for_file: lines_longer_than_80_chars
-
-import 'package:device_info_plus_web/device_info_plus_web.dart';
-import 'package:location_web/location_web.dart';
-import 'package:maplibre_gl_web/mapbox_gl_web.dart';
-
-import 'package:flutter_web_plugins/flutter_web_plugins.dart';
-
-// ignore: public_member_api_docs
-void registerPlugins(Registrar registrar) {
- DeviceInfoPlusPlugin.registerWith(registrar);
- LocationWebPlugin.registerWith(registrar);
- MapboxMapPlugin.registerWith(registrar);
- registrar.registerMessageHandler();
-}
diff --git a/example/lib/get_map_informations.dart b/example/lib/get_map_informations.dart
index 4bcb6f4a5..ab75ed3de 100644
--- a/example/lib/get_map_informations.dart
+++ b/example/lib/get_map_informations.dart
@@ -4,16 +4,17 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class GetMapInfoPage extends ExamplePage {
- GetMapInfoPage() : super(const Icon(Icons.info), 'Get map state');
+ const GetMapInfoPage({super.key})
+ : super(const Icon(Icons.info), 'Get map state');
@override
Widget build(BuildContext context) {
- return GetMapInfoBody();
+ return const GetMapInfoBody();
}
}
class GetMapInfoBody extends StatefulWidget {
- const GetMapInfoBody();
+ const GetMapInfoBody({super.key});
@override
State createState() => _GetMapInfoBodyState();
@@ -66,7 +67,7 @@ class _GetMapInfoBodyState extends State {
),
onMapCreated: onMapCreated,
compassEnabled: false,
- annotationOrder: [],
+ annotationOrder: const [],
myLocationEnabled: false,
styleString: '''{
"version": 8,
@@ -94,16 +95,14 @@ class _GetMapInfoBodyState extends State {
),
),
),
- Center(
- child: const Text('© OpenStreetMap contributors'),
- ),
+ const Center(child: Text('© OpenStreetMap contributors')),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
- SizedBox(height: 30),
+ const SizedBox(height: 30),
Center(child: Text(data)),
- SizedBox(height: 30),
+ const SizedBox(height: 30),
ElevatedButton(
onPressed: controller == null ? null : displayLayers,
child: const Text('Get map layers'),
diff --git a/example/lib/given_bounds.dart b/example/lib/given_bounds.dart
index c2d96b959..47e4a3afa 100644
--- a/example/lib/given_bounds.dart
+++ b/example/lib/given_bounds.dart
@@ -8,7 +8,7 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class GivenBoundsPage extends ExamplePage {
- GivenBoundsPage()
+ const GivenBoundsPage({super.key})
: super(const Icon(Icons.map_sharp), 'Changing given bounds');
@override
@@ -18,7 +18,8 @@ class GivenBoundsPage extends ExamplePage {
}
class GivenBounds extends StatefulWidget {
- const GivenBounds();
+ const GivenBounds({super.key});
+
@override
State createState() => GivenBoundsState();
}
diff --git a/example/lib/layer.dart b/example/lib/layer.dart
index c674b7646..fd59aeae0 100644
--- a/example/lib/layer.dart
+++ b/example/lib/layer.dart
@@ -8,19 +8,21 @@ import 'package:maplibre_gl_example/page.dart';
import 'util.dart';
class LayerPage extends ExamplePage {
- LayerPage() : super(const Icon(Icons.share), 'Layer');
+ const LayerPage({super.key}) : super(const Icon(Icons.share), 'Layer');
@override
- Widget build(BuildContext context) => LayerBody();
+ Widget build(BuildContext context) => const LayerBody();
}
class LayerBody extends StatefulWidget {
+ const LayerBody({super.key});
+
@override
State createState() => LayerState();
}
class LayerState extends State {
- static final LatLng center = const LatLng(-33.86711, 151.1947171);
+ static const LatLng center = LatLng(-33.86711, 151.1947171);
late MaplibreMapController controller;
Timer? bikeTimer;
@@ -34,9 +36,9 @@ class LayerState extends State {
myLocationEnabled: true,
onMapCreated: _onMapCreated,
onMapClick: (point, latLong) =>
- print(point.toString() + latLong.toString()),
+ debugPrint(point.toString() + latLong.toString()),
onStyleLoadedCallback: _onStyleLoadedCallback,
- initialCameraPosition: CameraPosition(
+ initialCameraPosition: const CameraPosition(
target: center,
zoom: 11.0,
),
@@ -54,7 +56,7 @@ class LayerState extends State {
final snackBar = SnackBar(
content: Text(
'Tapped feature with id $featureId',
- style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
+ style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
backgroundColor: Theme.of(context).primaryColor,
);
@@ -74,7 +76,7 @@ class LayerState extends State {
await controller.addFillLayer(
"fills",
"fills",
- FillLayerProperties(fillColor: [
+ const FillLayerProperties(fillColor: [
Expressions.interpolate,
['exponential', 0.5],
[Expressions.zoom],
@@ -115,7 +117,7 @@ class LayerState extends State {
await controller.addSymbolLayer(
"points",
"symbols",
- SymbolLayerProperties(
+ const SymbolLayerProperties(
iconImage: "custom-marker", // "{type}-15",
iconSize: 2,
iconAllowOverlap: true,
@@ -134,7 +136,8 @@ class LayerState extends State {
Expressions.literal,
[0, 2]
],
- iconImage: "custom-marker", // "bicycle-15",
+ iconImage: "custom-marker",
+ // "bicycle-15",
iconSize: 2,
iconAllowOverlap: true,
textAllowOverlap: true,
@@ -142,11 +145,11 @@ class LayerState extends State {
minzoom: 11,
);
- bikeTimer = Timer.periodic(Duration(milliseconds: 10), (t) {
+ bikeTimer = Timer.periodic(const Duration(milliseconds: 10), (t) {
controller.setGeoJsonSource("moving", _movingFeature(t.tick / 2000));
});
- filterTimer = Timer.periodic(Duration(seconds: 3), (t) {
+ filterTimer = Timer.periodic(const Duration(seconds: 3), (t) {
filteredId = filteredId == 0 ? 1 : 0;
controller.setFilter('fills', ['==', 'id', filteredId]);
});
@@ -164,11 +167,11 @@ Map _movingFeature(double t) {
List makeLatLong(double t) {
final angle = t * 2 * pi;
const r = 0.025;
- const center_x = 151.1849;
- const center_y = -33.8748;
+ const centerX = 151.1849;
+ const centerY = -33.8748;
return [
- center_x + r * sin(angle),
- center_y + r * cos(angle),
+ centerX + r * sin(angle),
+ centerY + r * cos(angle),
];
}
diff --git a/example/lib/line.dart b/example/lib/line.dart
index 8bcb13242..f6cdd99a2 100644
--- a/example/lib/line.dart
+++ b/example/lib/line.dart
@@ -11,7 +11,7 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class LinePage extends ExamplePage {
- LinePage() : super(const Icon(Icons.share), 'Line');
+ const LinePage({super.key}) : super(const Icon(Icons.share), 'Line');
@override
Widget build(BuildContext context) {
@@ -20,7 +20,7 @@ class LinePage extends ExamplePage {
}
class LineBody extends StatefulWidget {
- const LineBody();
+ const LineBody({super.key});
@override
State createState() => LineBodyState();
@@ -29,7 +29,7 @@ class LineBody extends StatefulWidget {
class LineBodyState extends State {
LineBodyState();
- static final LatLng center = const LatLng(-33.86711, 151.1947171);
+ static const LatLng center = LatLng(-33.86711, 151.1947171);
MaplibreMapController? controller;
int _lineCount = 0;
@@ -56,13 +56,13 @@ class LineBodyState extends State {
_onLineTapped(Line line) async {
await _updateSelectedLine(
- LineOptions(lineColor: "#ff0000"),
+ const LineOptions(lineColor: "#ff0000"),
);
setState(() {
_selectedLine = line;
});
await _updateSelectedLine(
- LineOptions(lineColor: "#ffe100"),
+ const LineOptions(lineColor: "#ffe100"),
);
}
@@ -72,7 +72,7 @@ class LineBodyState extends State {
void _add() {
controller!.addLine(
- LineOptions(
+ const LineOptions(
geometry: [
LatLng(-33.86711, 151.1947171),
LatLng(-33.86711, 151.1947171),
@@ -118,10 +118,7 @@ class LineBodyState extends State {
Future _changeAlpha() async {
double? current = _selectedLine!.options.lineOpacity;
- if (current == null) {
- // default value
- current = 1.0;
- }
+ current ??= 1.0;
await _updateSelectedLine(
LineOptions(lineOpacity: current < 0.1 ? 1.0 : current * 0.75),
@@ -130,10 +127,7 @@ class LineBodyState extends State {
Future _toggleVisible() async {
double? current = _selectedLine!.options.lineOpacity;
- if (current == null) {
- // default value
- current = 1.0;
- }
+ current ??= 1.0;
await _updateSelectedLine(
LineOptions(lineOpacity: current == 0.0 ? 1.0 : 0.0),
);
@@ -142,7 +136,7 @@ class LineBodyState extends State {
_onStyleLoadedCallback() async {
addImageFromAsset("assetImage", _linePatternImage);
await controller!.addLine(
- LineOptions(
+ const LineOptions(
geometry: [LatLng(37.4220, -122.0841), LatLng(37.4240, -122.0941)],
lineColor: "#ff0000",
lineWidth: 14.0,
@@ -180,52 +174,52 @@ class LineBodyState extends State {
Row(
children: [
TextButton(
- child: const Text('add'),
onPressed: (_lineCount == 12) ? null : _add,
+ child: const Text('add'),
),
TextButton(
- child: const Text('remove'),
onPressed: (_selectedLine == null) ? null : _remove,
+ child: const Text('remove'),
),
TextButton(
- child: const Text('move'),
onPressed: (_selectedLine == null)
? null
: () async {
await _move();
},
+ child: const Text('move'),
),
TextButton(
- child: const Text('change line-pattern'),
onPressed: (_selectedLine == null)
? null
: _changeLinePattern,
+ child: const Text('change line-pattern'),
),
],
),
Row(
children: [
TextButton(
- child: const Text('change alpha'),
onPressed:
(_selectedLine == null) ? null : _changeAlpha,
+ child: const Text('change alpha'),
),
TextButton(
- child: const Text('toggle visible'),
onPressed:
(_selectedLine == null) ? null : _toggleVisible,
+ child: const Text('toggle visible'),
),
TextButton(
- child: const Text('print current LatLng'),
onPressed: (_selectedLine == null)
? null
: () async {
var latLngs = await controller!
.getLineLatLngs(_selectedLine!);
for (var latLng in latLngs) {
- print(latLng.toString());
+ debugPrint(latLng.toString());
}
},
+ child: const Text('print current LatLng'),
),
],
),
diff --git a/example/lib/local_style.dart b/example/lib/local_style.dart
index 68124fe91..6b040b661 100644
--- a/example/lib/local_style.dart
+++ b/example/lib/local_style.dart
@@ -7,7 +7,8 @@ import 'package:path_provider/path_provider.dart';
import 'page.dart';
class LocalStylePage extends ExamplePage {
- LocalStylePage() : super(const Icon(Icons.map), 'Local style');
+ const LocalStylePage({super.key})
+ : super(const Icon(Icons.map), 'Local style');
@override
Widget build(BuildContext context) {
@@ -16,7 +17,7 @@ class LocalStylePage extends ExamplePage {
}
class LocalStyle extends StatefulWidget {
- const LocalStyle();
+ const LocalStyle({super.key});
@override
State createState() => LocalStyleState();
@@ -36,9 +37,9 @@ class LocalStyleState extends State {
String styleJSON =
'{"version":8,"name":"Demo style","center":[50,10],"zoom":4,"sources":{"demotiles":{"type":"vector","url":"https://demotiles.maplibre.org/tiles/tiles.json"}},"sprite":"","glyphs":"https://orangemug.github.io/font-glyphs/glyphs/{fontstack}/{range}.pbf","layers":[{"id":"background","type":"background","paint":{"background-color":"rgba(255, 255, 255, 1)"}},{"id":"countries","type":"line","source":"demotiles","source-layer":"countries","paint":{"line-color":"rgba(0, 0, 0, 1)","line-width":1,"line-opacity":1}}]}';
- await new Directory(stylesDir).create(recursive: true);
+ await Directory(stylesDir).create(recursive: true);
- File styleFile = new File('$stylesDir/style.json');
+ File styleFile = File('$stylesDir/style.json');
await styleFile.writeAsString(styleJSON);
@@ -55,12 +56,12 @@ class LocalStyleState extends State {
@override
Widget build(BuildContext context) {
if (styleAbsoluteFilePath == null) {
- return Scaffold(
+ return const Scaffold(
body: Center(child: Text('Creating local style file...')),
);
}
- return new Scaffold(
+ return Scaffold(
body: MaplibreMap(
styleString: styleAbsoluteFilePath,
onMapCreated: _onMapCreated,
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 0b7e217e5..eb3191c84 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -34,29 +34,31 @@ import 'sources.dart';
import 'package:maplibre_gl/mapbox_gl.dart';
final List _allPages = [
- MapUiPage(),
- FullMapPage(),
- AnimateCameraPage(),
- MoveCameraPage(),
- PlaceSymbolPage(),
- PlaceSourcePage(),
- LinePage(),
- LocalStylePage(),
- LayerPage(),
- PlaceCirclePage(),
- PlaceFillPage(),
- ScrollingMapPage(),
- OfflineRegionsPage(),
- AnnotationOrderPage(),
- CustomMarkerPage(),
- BatchAddPage(),
- ClickAnnotationPage(),
- Sources(),
- GivenBoundsPage(),
- GetMapInfoPage(),
+ const MapUiPage(),
+ const FullMapPage(),
+ const AnimateCameraPage(),
+ const MoveCameraPage(),
+ const PlaceSymbolPage(),
+ const PlaceSourcePage(),
+ const LinePage(),
+ const LocalStylePage(),
+ const LayerPage(),
+ const PlaceCirclePage(),
+ const PlaceFillPage(),
+ const ScrollingMapPage(),
+ const OfflineRegionsPage(),
+ const AnnotationOrderPage(),
+ const CustomMarkerPage(),
+ const BatchAddPage(),
+ const ClickAnnotationPage(),
+ const Sources(),
+ const GivenBoundsPage(),
+ const GetMapInfoPage(),
];
class MapsDemo extends StatefulWidget {
+ const MapsDemo({super.key});
+
@override
State createState() => _MapsDemoState();
}
@@ -75,7 +77,7 @@ class _MapsDemoState extends State {
if (!kIsWeb && Platform.isAndroid) {
final androidInfo = await DeviceInfoPlugin().androidInfo;
final sdkVersion = androidInfo.version.sdkInt;
- if (sdkVersion != null && sdkVersion >= 29) {
+ if (sdkVersion >= 29) {
MaplibreMap.useHybridComposition = true;
} else {
MaplibreMap.useHybridComposition = false;
@@ -91,6 +93,8 @@ class _MapsDemoState extends State {
await location.requestPermission();
}
}
+ if (!mounted) return;
+
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => Scaffold(
appBar: AppBar(title: Text(page.title)),
@@ -105,7 +109,7 @@ class _MapsDemoState extends State {
body: ListView.builder(
itemCount: _allPages.length + 1,
itemBuilder: (_, int index) => index == _allPages.length
- ? AboutListTile(
+ ? const AboutListTile(
applicationName: "flutter-maplibre-gl example",
)
: ListTile(
@@ -119,5 +123,5 @@ class _MapsDemoState extends State {
}
void main() {
- runApp(MaterialApp(home: MapsDemo()));
+ runApp(const MaterialApp(home: MapsDemo()));
}
diff --git a/example/lib/map_ui.dart b/example/lib/map_ui.dart
index a666f3b20..b7ff28ac4 100644
--- a/example/lib/map_ui.dart
+++ b/example/lib/map_ui.dart
@@ -16,7 +16,7 @@ final LatLngBounds sydneyBounds = LatLngBounds(
);
class MapUiPage extends ExamplePage {
- MapUiPage() : super(const Icon(Icons.map), 'User interface');
+ const MapUiPage({super.key}) : super(const Icon(Icons.map), 'User interface');
@override
Widget build(BuildContext context) {
@@ -25,7 +25,7 @@ class MapUiPage extends ExamplePage {
}
class MapUiBody extends StatefulWidget {
- const MapUiBody();
+ const MapUiBody({super.key});
@override
State createState() => MapUiBodyState();
@@ -34,7 +34,7 @@ class MapUiBody extends StatefulWidget {
class MapUiBodyState extends State {
MapUiBodyState();
- static final CameraPosition _kInitialPosition = const CameraPosition(
+ static const CameraPosition _kInitialPosition = CameraPosition(
target: LatLng(-33.852, 151.211),
zoom: 11.0,
);
@@ -47,13 +47,17 @@ class MapUiBodyState extends State {
CameraTargetBounds _cameraTargetBounds = CameraTargetBounds.unbounded;
MinMaxZoomPreference _minMaxZoomPreference = MinMaxZoomPreference.unbounded;
int _styleStringIndex = 0;
+
// Style string can a reference to a local or remote resources.
// On Android the raw JSON can also be passed via a styleString, on iOS this is not supported.
- List _styleStrings = [
+ final List _styleStrings = [
"https://demotiles.maplibre.org/style.json",
"assets/style.json"
];
- List _styleStringLabels = ["Maplibre demo style", "Local style file"];
+ final List _styleStringLabels = [
+ "Maplibre demo style",
+ "Local style file"
+ ];
bool _rotateGesturesEnabled = true;
bool _scrollGesturesEnabled = true;
bool? _doubleClickToZoomEnabled;
@@ -280,9 +284,11 @@ class MapUiBodyState extends State {
Widget _visibleRegionGetter() {
return TextButton(
- child: Text('get currently visible region'),
+ child: const Text('get currently visible region'),
onPressed: () async {
var result = await mapController!.getVisibleRegion();
+ if (!mounted) return;
+
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
"SW: ${result.southwest.toString()} NE: ${result.northeast.toString()}"),
@@ -293,18 +299,18 @@ class MapUiBodyState extends State {
Widget _sourceFeaturesGetter() {
return TextButton(
- child: Text('get source features (maplibre)'),
+ child: const Text('get source features (maplibre)'),
onPressed: () async {
var result = await mapController!
.querySourceFeatures("maplibre", "centroids", null);
- print(result);
+ debugPrint(result.toString());
},
);
}
Widget _layerVisibilityToggler() {
return TextButton(
- child: Text('toggle layer visibility'),
+ child: const Text('toggle layer visibility'),
onPressed: () async {
_countriesVisible = !_countriesVisible;
mapController?.setLayerVisibility('countries-fill', _countriesVisible);
@@ -362,46 +368,48 @@ class MapUiBodyState extends State {
myLocationTrackingMode: _myLocationTrackingMode,
myLocationRenderMode: MyLocationRenderMode.GPS,
onMapClick: (point, latLng) async {
- print(
+ debugPrint(
"Map click: ${point.x},${point.y} ${latLng.latitude}/${latLng.longitude}");
- print("Filter $_featureQueryFilter");
+ debugPrint("Filter $_featureQueryFilter");
List features = await mapController!
.queryRenderedFeatures(point, [], _featureQueryFilter);
- print('# features: ${features.length}');
+ if (!mounted) return;
+
+ debugPrint('# features: ${features.length}');
_clearFill();
if (features.isEmpty && _featureQueryFilter != null) {
- ScaffoldMessenger.of(context).showSnackBar(SnackBar(
+ ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text('QueryRenderedFeatures: No features found!')));
} else if (features.isNotEmpty) {
_drawFill(features);
}
},
onMapLongClick: (point, latLng) async {
- print(
+ debugPrint(
"Map long press: ${point.x},${point.y} ${latLng.latitude}/${latLng.longitude}");
Point convertedPoint = await mapController!.toScreenLocation(latLng);
LatLng convertedLatLng = await mapController!.toLatLng(point);
- print(
+ debugPrint(
"Map long press converted: ${convertedPoint.x},${convertedPoint.y} ${convertedLatLng.latitude}/${convertedLatLng.longitude}");
double metersPerPixel =
await mapController!.getMetersPerPixelAtLatitude(latLng.latitude);
- print(
+ debugPrint(
"Map long press The distance measured in meters at latitude ${latLng.latitude} is $metersPerPixel m");
List features =
await mapController!.queryRenderedFeatures(point, [], null);
- if (features.length > 0) {
- print(features[0]);
+ if (features.isNotEmpty) {
+ debugPrint(features[0]);
}
},
onCameraTrackingDismissed: () {
- this.setState(() {
+ setState(() {
_myLocationTrackingMode = MyLocationTrackingMode.None;
});
},
onUserLocationUpdated: (location) {
- print(
+ debugPrint(
"new location: ${location.position}, alt.: ${location.altitude}, bearing: ${location.bearing}, speed: ${location.speed}, horiz. accuracy: ${location.horizontalAccuracy}, vert. accuracy: ${location.verticalAccuracy}");
},
);
diff --git a/example/lib/move_camera.dart b/example/lib/move_camera.dart
index b706e82d3..f7734ab5f 100644
--- a/example/lib/move_camera.dart
+++ b/example/lib/move_camera.dart
@@ -8,7 +8,8 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class MoveCameraPage extends ExamplePage {
- MoveCameraPage() : super(const Icon(Icons.map), 'Camera control');
+ const MoveCameraPage({super.key})
+ : super(const Icon(Icons.map), 'Camera control');
@override
Widget build(BuildContext context) {
@@ -17,7 +18,8 @@ class MoveCameraPage extends ExamplePage {
}
class MoveCamera extends StatefulWidget {
- const MoveCamera();
+ const MoveCamera({super.key});
+
@override
State createState() => MoveCameraState();
}
@@ -41,7 +43,7 @@ class MoveCameraState extends State {
height: 200.0,
child: MaplibreMap(
onMapCreated: _onMapCreated,
- onCameraIdle: () => print("onCameraIdle"),
+ onCameraIdle: () => debugPrint("onCameraIdle"),
initialCameraPosition:
const CameraPosition(target: LatLng(0.0, 0.0)),
),
diff --git a/example/lib/offline_region_map.dart b/example/lib/offline_region_map.dart
index 39b311f5b..38bfaac5a 100644
--- a/example/lib/offline_region_map.dart
+++ b/example/lib/offline_region_map.dart
@@ -4,12 +4,12 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'offline_regions.dart';
class OfflineRegionMap extends StatefulWidget {
- OfflineRegionMap(this.item);
+ const OfflineRegionMap(this.item, {super.key});
final OfflineRegionListItem item;
@override
- _OfflineRegionMapState createState() => _OfflineRegionMapState();
+ State createState() => _OfflineRegionMapState();
}
class _OfflineRegionMapState extends State {
diff --git a/example/lib/offline_regions.dart b/example/lib/offline_regions.dart
index 8018483c2..d141ec005 100644
--- a/example/lib/offline_regions.dart
+++ b/example/lib/offline_regions.dart
@@ -98,7 +98,8 @@ final List allRegions = [
];
class OfflineRegionsPage extends ExamplePage {
- OfflineRegionsPage() : super(const Icon(Icons.map), 'Offline Regions');
+ const OfflineRegionsPage({super.key})
+ : super(const Icon(Icons.map), 'Offline Regions');
@override
Widget build(BuildContext context) {
@@ -107,14 +108,14 @@ class OfflineRegionsPage extends ExamplePage {
}
class OfflineRegionBody extends StatefulWidget {
- const OfflineRegionBody();
+ const OfflineRegionBody({super.key});
@override
- _OfflineRegionsBodyState createState() => _OfflineRegionsBodyState();
+ State createState() => _OfflineRegionsBodyState();
}
class _OfflineRegionsBodyState extends State {
- List _items = [];
+ final List _items = [];
@override
void initState() {
@@ -133,7 +134,7 @@ class _OfflineRegionsBodyState extends State {
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
- icon: Icon(Icons.map),
+ icon: const Icon(Icons.map),
onPressed: () => _goToMap(_items[index]),
),
Column(
@@ -142,14 +143,14 @@ class _OfflineRegionsBodyState extends State {
children: [
Text(
_items[index].name,
- style: TextStyle(
+ style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
Text(
'Est. tiles: ${_items[index].estimatedTiles}',
- style: TextStyle(
+ style: const TextStyle(
fontSize: 16,
),
),
@@ -157,10 +158,10 @@ class _OfflineRegionsBodyState extends State {
),
const Spacer(),
_items[index].isDownloading
- ? Container(
- child: CircularProgressIndicator(),
+ ? const SizedBox(
height: 16,
width: 16,
+ child: CircularProgressIndicator(),
)
: IconButton(
icon: Icon(
diff --git a/example/lib/page.dart b/example/lib/page.dart
index ab895ac4e..12c408834 100644
--- a/example/lib/page.dart
+++ b/example/lib/page.dart
@@ -5,7 +5,7 @@
import 'package:flutter/material.dart';
abstract class ExamplePage extends StatelessWidget {
- const ExamplePage(this.leading, this.title);
+ const ExamplePage(this.leading, this.title, {super.key});
final Widget leading;
final String title;
diff --git a/example/lib/place_batch.dart b/example/lib/place_batch.dart
index 8281d072d..5b1c9e5a3 100644
--- a/example/lib/place_batch.dart
+++ b/example/lib/place_batch.dart
@@ -45,7 +45,8 @@ const fillOptions = [
];
class BatchAddPage extends ExamplePage {
- BatchAddPage() : super(const Icon(Icons.check_circle), 'Batch add/remove');
+ const BatchAddPage({super.key})
+ : super(const Icon(Icons.check_circle), 'Batch add/remove');
@override
Widget build(BuildContext context) {
@@ -54,7 +55,7 @@ class BatchAddPage extends ExamplePage {
}
class BatchAddBody extends StatefulWidget {
- const BatchAddBody();
+ const BatchAddBody({super.key});
@override
State createState() => BatchAddBodyState();
@@ -62,12 +63,13 @@ class BatchAddBody extends StatefulWidget {
class BatchAddBodyState extends State {
BatchAddBodyState();
+
List _fills = [];
List _circles = [];
List _lines = [];
List _symbols = [];
- static final LatLng center = const LatLng(-33.86711, 151.1947171);
+ static const LatLng center = LatLng(-33.86711, 151.1947171);
late MaplibreMapController controller;
@@ -104,11 +106,12 @@ class BatchAddBodyState extends State {
final symbolOptions = [];
for (final option in options) {
// put symbols only on the inner most ring if it exists
- if (option.geometry!.length > 1)
+ if (option.geometry!.length > 1) {
for (final latLng in option.geometry!.last) {
symbolOptions
.add(SymbolOptions(iconImage: 'custom-marker', geometry: latLng));
}
+ }
}
return symbolOptions;
}
@@ -172,10 +175,10 @@ class BatchAddBodyState extends State {
Column(
children: [
TextButton(
- child: const Text('batch add'), onPressed: _add),
+ onPressed: _add, child: const Text('batch add')),
TextButton(
- child: const Text('batch remove'),
- onPressed: _remove),
+ onPressed: _remove,
+ child: const Text('batch remove')),
],
),
],
diff --git a/example/lib/place_circle.dart b/example/lib/place_circle.dart
index ba8248d1e..8ffae69ee 100644
--- a/example/lib/place_circle.dart
+++ b/example/lib/place_circle.dart
@@ -11,7 +11,8 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class PlaceCirclePage extends ExamplePage {
- PlaceCirclePage() : super(const Icon(Icons.check_circle), 'Place circle');
+ const PlaceCirclePage({super.key})
+ : super(const Icon(Icons.check_circle), 'Place circle');
@override
Widget build(BuildContext context) {
@@ -20,7 +21,7 @@ class PlaceCirclePage extends ExamplePage {
}
class PlaceCircleBody extends StatefulWidget {
- const PlaceCircleBody();
+ const PlaceCircleBody({super.key});
@override
State createState() => PlaceCircleBodyState();
@@ -29,7 +30,7 @@ class PlaceCircleBody extends StatefulWidget {
class PlaceCircleBodyState extends State {
PlaceCircleBodyState();
- static final LatLng center = const LatLng(-33.86711, 151.1947171);
+ static const LatLng center = LatLng(-33.86711, 151.1947171);
MaplibreMapController? controller;
int _circleCount = 0;
@@ -56,7 +57,7 @@ class PlaceCircleBodyState extends State {
_selectedCircle = circle;
});
_updateSelectedCircle(
- CircleOptions(
+ const CircleOptions(
circleRadius: 30,
),
);
@@ -106,10 +107,7 @@ class PlaceCircleBodyState extends State {
void _changeDraggable() {
bool? draggable = _selectedCircle!.options.draggable;
- if (draggable == null) {
- // default value
- draggable = false;
- }
+ draggable ??= false;
_updateSelectedCircle(
CircleOptions(
draggable: !draggable,
@@ -119,6 +117,8 @@ class PlaceCircleBodyState extends State {
void _getLatLng() async {
LatLng latLng = await controller!.getCircleLatLng(_selectedCircle!);
+ if (!mounted) return;
+
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(latLng.toString()),
@@ -128,10 +128,7 @@ class PlaceCircleBodyState extends State {
void _changeCircleStrokeOpacity() {
double? current = _selectedCircle!.options.circleStrokeOpacity;
- if (current == null) {
- // default value
- current = 1.0;
- }
+ current ??= 1.0;
_updateSelectedCircle(
CircleOptions(circleStrokeOpacity: current < 0.1 ? 1.0 : current * 0.75),
@@ -140,20 +137,14 @@ class PlaceCircleBodyState extends State {
void _changeCircleStrokeWidth() {
double? current = _selectedCircle!.options.circleStrokeWidth;
- if (current == null) {
- // default value
- current = 0;
- }
+ current ??= 0;
_updateSelectedCircle(
CircleOptions(circleStrokeWidth: current == 0 ? 5.0 : 0));
}
Future _changeCircleStrokeColor() async {
String? current = _selectedCircle!.options.circleStrokeColor;
- if (current == null) {
- // default value
- current = "#FFFFFF";
- }
+ current ??= "#FFFFFF";
_updateSelectedCircle(
CircleOptions(
@@ -163,10 +154,7 @@ class PlaceCircleBodyState extends State {
Future _changeCircleOpacity() async {
double? current = _selectedCircle!.options.circleOpacity;
- if (current == null) {
- // default value
- current = 1.0;
- }
+ current ??= 1.0;
_updateSelectedCircle(
CircleOptions(circleOpacity: current < 0.1 ? 1.0 : current * 0.75),
@@ -175,10 +163,7 @@ class PlaceCircleBodyState extends State {
Future _changeCircleRadius() async {
double? current = _selectedCircle!.options.circleRadius;
- if (current == null) {
- // default value
- current = 0;
- }
+ current ??= 0;
_updateSelectedCircle(
CircleOptions(circleRadius: current == 120.0 ? 30.0 : current + 30.0),
);
@@ -186,22 +171,16 @@ class PlaceCircleBodyState extends State {
Future _changeCircleColor() async {
String? current = _selectedCircle!.options.circleColor;
- if (current == null) {
- // default value
- current = "#FF0000";
- }
+ current ??= "#FF0000";
_updateSelectedCircle(
- CircleOptions(circleColor: "#FFFF00"),
+ const CircleOptions(circleColor: "#FFFF00"),
);
}
Future _changeCircleBlur() async {
double? current = _selectedCircle!.options.circleBlur;
- if (current == null) {
- // default value
- current = 0;
- }
+ current ??= 0;
_updateSelectedCircle(
CircleOptions(circleBlur: current == 0.75 ? 0 : 0.75),
);
@@ -236,75 +215,75 @@ class PlaceCircleBodyState extends State {
Column(
children: [
TextButton(
- child: const Text('add'),
onPressed: (_circleCount == 12) ? null : _add,
+ child: const Text('add'),
),
TextButton(
- child: const Text('remove'),
onPressed: (_selectedCircle == null) ? null : _remove,
+ child: const Text('remove'),
),
],
),
Column(
children: [
TextButton(
- child: const Text('change circle-opacity'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleOpacity,
+ child: const Text('change circle-opacity'),
),
TextButton(
- child: const Text('change circle-radius'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleRadius,
+ child: const Text('change circle-radius'),
),
TextButton(
- child: const Text('change circle-color'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleColor,
+ child: const Text('change circle-color'),
),
TextButton(
- child: const Text('change circle-blur'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleBlur,
+ child: const Text('change circle-blur'),
),
TextButton(
- child: const Text('change circle-stroke-width'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeWidth,
+ child: const Text('change circle-stroke-width'),
),
TextButton(
- child: const Text('change circle-stroke-color'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeColor,
+ child: const Text('change circle-stroke-color'),
),
TextButton(
- child: const Text('change circle-stroke-opacity'),
onPressed: (_selectedCircle == null)
? null
: _changeCircleStrokeOpacity,
+ child: const Text('change circle-stroke-opacity'),
),
TextButton(
- child: const Text('change position'),
onPressed: (_selectedCircle == null)
? null
: _changePosition,
+ child: const Text('change position'),
),
TextButton(
- child: const Text('toggle draggable'),
onPressed: (_selectedCircle == null)
? null
: _changeDraggable,
+ child: const Text('toggle draggable'),
),
TextButton(
- child: const Text('get current LatLng'),
onPressed:
(_selectedCircle == null) ? null : _getLatLng,
+ child: const Text('get current LatLng'),
),
],
),
diff --git a/example/lib/place_fill.dart b/example/lib/place_fill.dart
index f999403be..4147d7edb 100644
--- a/example/lib/place_fill.dart
+++ b/example/lib/place_fill.dart
@@ -11,7 +11,8 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class PlaceFillPage extends ExamplePage {
- PlaceFillPage() : super(const Icon(Icons.check_circle), 'Place fill');
+ const PlaceFillPage({super.key})
+ : super(const Icon(Icons.check_circle), 'Place fill');
@override
Widget build(BuildContext context) {
@@ -20,7 +21,7 @@ class PlaceFillPage extends ExamplePage {
}
class PlaceFillBody extends StatefulWidget {
- const PlaceFillBody();
+ const PlaceFillBody({super.key});
@override
State createState() => PlaceFillBodyState();
@@ -29,22 +30,22 @@ class PlaceFillBody extends StatefulWidget {
class PlaceFillBodyState extends State {
PlaceFillBodyState();
- static final LatLng center = const LatLng(-33.86711, 151.1947171);
+ static const LatLng center = LatLng(-33.86711, 151.1947171);
final String _fillPatternImage = "assets/fill/cat_silhouette_pattern.png";
final List> _defaultGeometry = [
[
- LatLng(-33.719, 151.150),
- LatLng(-33.858, 151.150),
- LatLng(-33.866, 151.401),
- LatLng(-33.747, 151.328),
- LatLng(-33.719, 151.150),
+ const LatLng(-33.719, 151.150),
+ const LatLng(-33.858, 151.150),
+ const LatLng(-33.866, 151.401),
+ const LatLng(-33.747, 151.328),
+ const LatLng(-33.719, 151.150),
],
[
- LatLng(-33.762, 151.250),
- LatLng(-33.827, 151.250),
- LatLng(-33.833, 151.347),
- LatLng(-33.762, 151.250),
+ const LatLng(-33.762, 151.250),
+ const LatLng(-33.827, 151.250),
+ const LatLng(-33.833, 151.347),
+ const LatLng(-33.762, 151.250),
]
];
@@ -128,9 +129,7 @@ class PlaceFillBodyState extends State {
void _changePosition() {
List>? geometry = _selectedFill!.options.geometry;
- if (geometry == null) {
- geometry = _defaultGeometry;
- }
+ geometry ??= _defaultGeometry;
_updateSelectedFill(FillOptions(
geometry: geometry
@@ -144,10 +143,7 @@ class PlaceFillBodyState extends State {
void _changeDraggable() {
bool? draggable = _selectedFill!.options.draggable;
- if (draggable == null) {
- // default value
- draggable = false;
- }
+ draggable ??= false;
_updateSelectedFill(
FillOptions(draggable: !draggable),
);
@@ -155,10 +151,7 @@ class PlaceFillBodyState extends State {
Future _changeFillOpacity() async {
double? current = _selectedFill!.options.fillOpacity;
- if (current == null) {
- // default value
- current = 1.0;
- }
+ current ??= 1.0;
_updateSelectedFill(
FillOptions(fillOpacity: current < 0.1 ? 1.0 : current * 0.75),
@@ -167,25 +160,19 @@ class PlaceFillBodyState extends State {
Future _changeFillColor() async {
String? current = _selectedFill!.options.fillColor;
- if (current == null) {
- // default value
- current = "#FF0000";
- }
+ current ??= "#FF0000";
_updateSelectedFill(
- FillOptions(fillColor: "#FFFF00"),
+ const FillOptions(fillColor: "#FFFF00"),
);
}
Future _changeFillOutlineColor() async {
String? current = _selectedFill!.options.fillOutlineColor;
- if (current == null) {
- // default value
- current = "#FF0000";
- }
+ current ??= "#FF0000";
_updateSelectedFill(
- FillOptions(fillOutlineColor: "#FFFF00"),
+ const FillOptions(fillOutlineColor: "#FFFF00"),
);
}
@@ -227,49 +214,49 @@ class PlaceFillBodyState extends State {
Column(
children: [
TextButton(
- child: const Text('add'),
onPressed: (_fillCount == 12) ? null : _add,
+ child: const Text('add'),
),
TextButton(
- child: const Text('remove'),
onPressed: (_selectedFill == null) ? null : _remove,
+ child: const Text('remove'),
),
],
),
Column(
children: [
TextButton(
- child: const Text('change fill-opacity'),
onPressed: (_selectedFill == null)
? null
: _changeFillOpacity,
+ child: const Text('change fill-opacity'),
),
TextButton(
- child: const Text('change fill-color'),
onPressed:
(_selectedFill == null) ? null : _changeFillColor,
+ child: const Text('change fill-color'),
),
TextButton(
- child: const Text('change fill-outline-color'),
onPressed: (_selectedFill == null)
? null
: _changeFillOutlineColor,
+ child: const Text('change fill-outline-color'),
),
TextButton(
- child: const Text('change fill-pattern'),
onPressed: (_selectedFill == null)
? null
: _changeFillPattern,
+ child: const Text('change fill-pattern'),
),
TextButton(
- child: const Text('change position'),
onPressed:
(_selectedFill == null) ? null : _changePosition,
+ child: const Text('change position'),
),
TextButton(
- child: const Text('toggle draggable'),
onPressed:
(_selectedFill == null) ? null : _changeDraggable,
+ child: const Text('toggle draggable'),
),
],
),
diff --git a/example/lib/place_source.dart b/example/lib/place_source.dart
index 07d8d96fa..97ba21db5 100644
--- a/example/lib/place_source.dart
+++ b/example/lib/place_source.dart
@@ -11,7 +11,8 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class PlaceSourcePage extends ExamplePage {
- PlaceSourcePage() : super(const Icon(Icons.place), 'Place source');
+ const PlaceSourcePage({super.key})
+ : super(const Icon(Icons.place), 'Place source');
@override
Widget build(BuildContext context) {
@@ -20,7 +21,7 @@ class PlaceSourcePage extends ExamplePage {
}
class PlaceSymbolBody extends StatefulWidget {
- const PlaceSymbolBody();
+ const PlaceSymbolBody({super.key});
@override
State createState() => PlaceSymbolBodyState();
@@ -29,8 +30,8 @@ class PlaceSymbolBody extends StatefulWidget {
class PlaceSymbolBodyState extends State {
PlaceSymbolBodyState();
- static const SOURCE_ID = 'sydney_source';
- static const LAYER_ID = 'sydney_layer';
+ static const sourceId = 'sydney_source';
+ static const layerId = 'sydney_layer';
bool sourceAdded = false;
bool layerAdded = false;
@@ -116,44 +117,44 @@ class PlaceSymbolBodyState extends State {
Column(
children: [
TextButton(
- child: const Text('Add source (asset image)'),
onPressed: sourceAdded
? null
: () {
addImageSourceFromAsset(
- SOURCE_ID, 'assets/sydney.png')
+ sourceId, 'assets/sydney.png')
.then((value) {
setState(() => sourceAdded = true);
});
},
+ child: const Text('Add source (asset image)'),
),
TextButton(
- child: const Text('Remove source (asset image)'),
onPressed: sourceAdded
? () async {
- await removeLayer(LAYER_ID);
- removeImageSource(SOURCE_ID).then((value) {
+ await removeLayer(layerId);
+ removeImageSource(sourceId).then((value) {
setState(() => sourceAdded = false);
});
}
: null,
+ child: const Text('Remove source (asset image)'),
),
TextButton(
- child: const Text('Show layer'),
onPressed: sourceAdded
- ? () => addLayer(LAYER_ID, SOURCE_ID)
+ ? () => addLayer(layerId, sourceId)
: null,
+ child: const Text('Show layer'),
),
TextButton(
- child: const Text('Show layer below water'),
onPressed: sourceAdded
- ? () => addLayerBelow(LAYER_ID, SOURCE_ID, 'water')
+ ? () => addLayerBelow(layerId, sourceId, 'water')
: null,
+ child: const Text('Show layer below water'),
),
TextButton(
- child: const Text('Hide layer'),
onPressed:
- sourceAdded ? () => removeLayer(LAYER_ID) : null,
+ sourceAdded ? () => removeLayer(layerId) : null,
+ child: const Text('Hide layer'),
),
],
),
diff --git a/example/lib/place_symbol.dart b/example/lib/place_symbol.dart
index 74b4770cb..90152dec8 100644
--- a/example/lib/place_symbol.dart
+++ b/example/lib/place_symbol.dart
@@ -14,7 +14,8 @@ import 'package:maplibre_gl/mapbox_gl.dart';
import 'page.dart';
class PlaceSymbolPage extends ExamplePage {
- PlaceSymbolPage() : super(const Icon(Icons.place), 'Place symbol');
+ const PlaceSymbolPage({super.key})
+ : super(const Icon(Icons.place), 'Place symbol');
@override
Widget build(BuildContext context) {
@@ -23,7 +24,7 @@ class PlaceSymbolPage extends ExamplePage {
}
class PlaceSymbolBody extends StatefulWidget {
- const PlaceSymbolBody();
+ const PlaceSymbolBody({super.key});
@override
State createState() => PlaceSymbolBodyState();
@@ -32,7 +33,7 @@ class PlaceSymbolBody extends StatefulWidget {
class PlaceSymbolBodyState extends State {
PlaceSymbolBodyState();
- static final LatLng center = const LatLng(-33.86711, 151.1947171);
+ static const LatLng center = LatLng(-33.86711, 151.1947171);
MaplibreMapController? controller;
int _symbolCount = 0;
@@ -80,9 +81,7 @@ class PlaceSymbolBodyState extends State {
_selectedSymbol = symbol;
});
_updateSelectedSymbol(
- SymbolOptions(
- iconSize: 1.4,
- ),
+ const SymbolOptions(iconSize: 1.4),
);
}
@@ -92,8 +91,9 @@ class PlaceSymbolBodyState extends State {
void _add(String iconImage) {
List availableNumbers = Iterable.generate(12).toList();
- controller!.symbols.forEach(
- (s) => availableNumbers.removeWhere((i) => i == s.data!['count']));
+ for (var s in controller!.symbols) {
+ availableNumbers.removeWhere((i) => i == s.data!['count']);
+ }
if (availableNumbers.isNotEmpty) {
controller!.addSymbol(
_getSymbolOptions(iconImage, availableNumbers.first),
@@ -117,7 +117,7 @@ class PlaceSymbolBodyState extends State {
fontNames: ['DIN Offc Pro Bold', 'Arial Unicode MS Regular'],
textField: 'Airport',
textSize: 12.5,
- textOffset: Offset(0, 0.8),
+ textOffset: const Offset(0, 0.8),
textAnchor: 'top',
textColor: '#000000',
textHaloBlur: 1,
@@ -127,15 +127,16 @@ class PlaceSymbolBodyState extends State {
: SymbolOptions(
geometry: geometry,
textField: 'Airport',
- textOffset: Offset(0, 0.8),
+ textOffset: const Offset(0, 0.8),
iconImage: iconImage,
);
}
Future _addAll(String iconImage) async {
List symbolsToAddNumbers = Iterable.generate(12).toList();
- controller!.symbols.forEach(
- (s) => symbolsToAddNumbers.removeWhere((i) => i == s.data!['count']));
+ for (var s in controller!.symbols) {
+ symbolsToAddNumbers.removeWhere((i) => i == s.data!['count']);
+ }
if (symbolsToAddNumbers.isNotEmpty) {
final List symbolOptionsList = symbolsToAddNumbers
@@ -184,10 +185,7 @@ class PlaceSymbolBodyState extends State {
void _changeIconOffset() {
Offset? currentAnchor = _selectedSymbol!.options.iconOffset;
- if (currentAnchor == null) {
- // default value
- currentAnchor = Offset(0.0, 0.0);
- }
+ currentAnchor ??= const Offset(0.0, 0.0);
final Offset newAnchor = Offset(1.0 - currentAnchor.dy, currentAnchor.dx);
_updateSelectedSymbol(SymbolOptions(iconOffset: newAnchor));
}
@@ -206,10 +204,7 @@ class PlaceSymbolBodyState extends State {
Future _toggleDraggable() async {
bool? draggable = _selectedSymbol!.options.draggable;
- if (draggable == null) {
- // default value
- draggable = false;
- }
+ draggable ??= false;
_updateSelectedSymbol(
SymbolOptions(draggable: !draggable),
@@ -218,10 +213,7 @@ class PlaceSymbolBodyState extends State {
Future _changeAlpha() async {
double? current = _selectedSymbol!.options.iconOpacity;
- if (current == null) {
- // default value
- current = 1.0;
- }
+ current ??= 1.0;
_updateSelectedSymbol(
SymbolOptions(iconOpacity: current < 0.1 ? 1.0 : current * 0.75),
@@ -230,10 +222,7 @@ class PlaceSymbolBodyState extends State {
Future _changeRotation() async {
double? current = _selectedSymbol!.options.iconRotate;
- if (current == null) {
- // default value
- current = 0;
- }
+ current ??= 0;
_updateSelectedSymbol(
SymbolOptions(iconRotate: current == 330.0 ? 0.0 : current + 30.0),
);
@@ -241,10 +230,7 @@ class PlaceSymbolBodyState extends State {
Future _toggleVisible() async {
double? current = _selectedSymbol!.options.iconOpacity;
- if (current == null) {
- // default value
- current = 1.0;
- }
+ current ??= 1.0;
_updateSelectedSymbol(
SymbolOptions(iconOpacity: current == 0.0 ? 1.0 : 0.0),
@@ -253,17 +239,16 @@ class PlaceSymbolBodyState extends State {
Future _changeZIndex() async {
int? current = _selectedSymbol!.options.zIndex;
- if (current == null) {
- // default value
- current = 0;
- }
+ current ??= 0;
_updateSelectedSymbol(
SymbolOptions(zIndex: current == 12 ? 0 : current + 1),
);
}
void _getLatLng() async {
- LatLng latLng = await controller!.getSymbolLatLng(_selectedSymbol!);
+ final latLng = await controller!.getSymbolLatLng(_selectedSymbol!);
+ if (!mounted) return;
+
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(latLng.toString()),
@@ -327,17 +312,17 @@ class PlaceSymbolBodyState extends State {
: _add("assets/symbols/custom-icon.png"),
),
TextButton(
- child: const Text('remove'),
onPressed: (_selectedSymbol == null) ? null : _remove,
+ child: const Text('remove'),
),
TextButton(
+ onPressed: _changeIconOverlap,
child: Text(
'${_iconAllowOverlap ? 'disable' : 'enable'} icon overlap'),
- onPressed: _changeIconOverlap,
),
TextButton(
- child: const Text('remove all'),
onPressed: (_symbolCount == 0) ? null : _removeAll,
+ child: const Text('remove all'),
),
TextButton(
child: const Text('add (asset image)'),
@@ -363,54 +348,54 @@ class PlaceSymbolBodyState extends State {
Column(
children: [
TextButton(
- child: const Text('change alpha'),
onPressed:
(_selectedSymbol == null) ? null : _changeAlpha,
+ child: const Text('change alpha'),
),
TextButton(
- child: const Text('change icon offset'),
onPressed: (_selectedSymbol == null)
? null
: _changeIconOffset,
+ child: const Text('change icon offset'),
),
TextButton(
- child: const Text('change icon anchor'),
onPressed: (_selectedSymbol == null)
? null
: _changeIconAnchor,
+ child: const Text('change icon anchor'),
),
TextButton(
- child: const Text('toggle draggable'),
onPressed: (_selectedSymbol == null)
? null
: _toggleDraggable,
+ child: const Text('toggle draggable'),
),
TextButton(
- child: const Text('change position'),
onPressed: (_selectedSymbol == null)
? null
: _changePosition,
+ child: const Text('change position'),
),
TextButton(
- child: const Text('change rotation'),
onPressed: (_selectedSymbol == null)
? null
: _changeRotation,
+ child: const Text('change rotation'),
),
TextButton(
- child: const Text('toggle visible'),
onPressed:
(_selectedSymbol == null) ? null : _toggleVisible,
+ child: const Text('toggle visible'),
),
TextButton(
- child: const Text('change zIndex'),
onPressed:
(_selectedSymbol == null) ? null : _changeZIndex,
+ child: const Text('change zIndex'),
),
TextButton(
- child: const Text('get current LatLng'),
onPressed:
(_selectedSymbol == null) ? null : _getLatLng,
+ child: const Text('get current LatLng'),
),
],
),
diff --git a/example/lib/scrolling_map.dart b/example/lib/scrolling_map.dart
index 30964473a..034716748 100644
--- a/example/lib/scrolling_map.dart
+++ b/example/lib/scrolling_map.dart
@@ -12,19 +12,20 @@ import 'package:maplibre_gl_example/util.dart';
import 'page.dart';
class ScrollingMapPage extends ExamplePage {
- ScrollingMapPage() : super(const Icon(Icons.map), 'Scrolling map');
+ const ScrollingMapPage({super.key})
+ : super(const Icon(Icons.map), 'Scrolling map');
@override
Widget build(BuildContext context) {
- return ScrollingMapBody();
+ return const ScrollingMapBody();
}
}
class ScrollingMapBody extends StatefulWidget {
- ScrollingMapBody();
+ const ScrollingMapBody({super.key});
@override
- _ScrollingMapBodyState createState() => _ScrollingMapBodyState();
+ State createState() => _ScrollingMapBodyState();
}
class _ScrollingMapBodyState extends State {
@@ -57,12 +58,12 @@ class _ScrollingMapBodyState extends State {
target: center,
zoom: 11.0,
),
- gestureRecognizers:
- >[
+ gestureRecognizers: >{
Factory(
() => EagerGestureRecognizer(),
),
- ].toSet(),
+ },
),
),
),
@@ -92,12 +93,12 @@ class _ScrollingMapBodyState extends State {
target: center,
zoom: 11.0,
),
- gestureRecognizers:
- >[
+ gestureRecognizers: >{
Factory(
() => ScaleGestureRecognizer(),
),
- ].toSet(),
+ },
),
),
),
@@ -110,11 +111,11 @@ class _ScrollingMapBodyState extends State {
}
void onMapCreatedOne(MaplibreMapController controller) {
- this.controllerOne = controller;
+ controllerOne = controller;
}
void onMapCreatedTwo(MaplibreMapController controller) {
- this.controllerTwo = controller;
+ controllerTwo = controller;
}
void onStyleLoaded(MaplibreMapController controller) async {
@@ -127,7 +128,7 @@ class _ScrollingMapBodyState extends State {
),
iconImage: "custom-marker"));
controller.addLine(
- LineOptions(
+ const LineOptions(
geometry: [
LatLng(-33.86711, 151.1947171),
LatLng(-33.86711, 151.1947171),
diff --git a/example/lib/sources.dart b/example/lib/sources.dart
index bcfc8af47..607327b66 100644
--- a/example/lib/sources.dart
+++ b/example/lib/sources.dart
@@ -19,7 +19,7 @@ class StyleInfo {
}
class Sources extends ExamplePage {
- Sources() : super(const Icon(Icons.map), 'Various Sources');
+ const Sources({super.key}) : super(const Icon(Icons.map), 'Various Sources');
@override
Widget build(BuildContext context) {
@@ -28,7 +28,7 @@ class Sources extends ExamplePage {
}
class FullMap extends StatefulWidget {
- const FullMap();
+ const FullMap({super.key});
@override
State createState() => FullMapState();
@@ -46,7 +46,7 @@ class FullMapState extends State {
static Future addRaster(MaplibreMapController controller) async {
await controller.addSource(
"watercolor",
- RasterSourceProperties(
+ const RasterSourceProperties(
tiles: [
'https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg'
],
@@ -55,14 +55,14 @@ class FullMapState extends State {
'Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA'),
);
await controller.addLayer(
- "watercolor", "watercolor", RasterLayerProperties());
+ "watercolor", "watercolor", const RasterLayerProperties());
}
static Future addGeojsonCluster(
MaplibreMapController controller) async {
await controller.addSource(
"earthquakes",
- GeojsonSourceProperties(
+ const GeojsonSourceProperties(
data:
'https://docs.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson',
cluster: true,
@@ -73,7 +73,7 @@ class FullMapState extends State {
await controller.addLayer(
"earthquakes",
"earthquakes-circles",
- CircleLayerProperties(circleColor: [
+ const CircleLayerProperties(circleColor: [
Expressions.step,
[Expressions.get, 'point_count'],
'#51bbd6',
@@ -93,7 +93,7 @@ class FullMapState extends State {
await controller.addLayer(
"earthquakes",
"earthquakes-count",
- SymbolLayerProperties(
+ const SymbolLayerProperties(
textField: [Expressions.get, 'point_count_abbreviated'],
textFont: ['Open Sans Semibold'],
textSize: 12,
@@ -103,14 +103,14 @@ class FullMapState extends State {
static Future addVector(MaplibreMapController controller) async {
await controller.addSource(
"terrain",
- VectorSourceProperties(
+ const VectorSourceProperties(
url: "https://demotiles.maplibre.org/tiles/tiles.json",
));
await controller.addLayer(
"terrain",
"contour",
- LineLayerProperties(
+ const LineLayerProperties(
lineColor: "#ff69b4",
lineWidth: 1,
lineCap: "round",
@@ -122,7 +122,7 @@ class FullMapState extends State {
static Future addImage(MaplibreMapController controller) async {
await controller.addSource(
"radar",
- ImageSourceProperties(
+ const ImageSourceProperties(
url: "https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif",
coordinates: [
[-80.425, 46.437],
@@ -134,14 +134,14 @@ class FullMapState extends State {
await controller.addRasterLayer(
"radar",
"radar",
- RasterLayerProperties(rasterFadeDuration: 0),
+ const RasterLayerProperties(rasterFadeDuration: 0),
);
}
static Future addVideo(MaplibreMapController controller) async {
await controller.addSource(
"video",
- VideoSourceProperties(urls: [
+ const VideoSourceProperties(urls: [
'https://static-assets.mapbox.com/mapbox-gl-js/drone.mp4',
'https://static-assets.mapbox.com/mapbox-gl-js/drone.webm'
], coordinates: [
@@ -154,7 +154,7 @@ class FullMapState extends State {
await controller.addRasterLayer(
"video",
"video",
- RasterLayerProperties(),
+ const RasterLayerProperties(),
);
}
@@ -236,11 +236,11 @@ class FullMapState extends State {
final nextName =
_stylesAndLoaders[(selectedStyleId + 1) % _stylesAndLoaders.length]
.name;
- return new Scaffold(
+ return Scaffold(
floatingActionButton: Padding(
padding: const EdgeInsets.all(32.0),
child: FloatingActionButton.extended(
- icon: Icon(Icons.swap_horiz),
+ icon: const Icon(Icons.swap_horiz),
label: SizedBox(
width: 120, child: Center(child: Text("To $nextName"))),
onPressed: () => setState(
@@ -258,7 +258,7 @@ class FullMapState extends State {
onStyleLoadedCallback: _onStyleLoadedCallback,
),
Container(
- padding: EdgeInsets.all(8),
+ padding: const EdgeInsets.all(8),
alignment: Alignment.topCenter,
child: Card(
child: Padding(
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 87d59d62b..f1d4e0a85 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -13,10 +13,10 @@ packages:
dependency: transitive
description:
name: async
- sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
+ sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
- version: "2.10.0"
+ version: "2.11.0"
boolean_selector:
dependency: transitive
description:
@@ -29,10 +29,10 @@ packages:
dependency: transitive
description:
name: characters
- sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
+ sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
- version: "1.2.1"
+ version: "1.3.0"
clock:
dependency: transitive
description:
@@ -45,10 +45,10 @@ packages:
dependency: "direct main"
description:
name: collection
- sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
+ sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
url: "https://pub.dev"
source: hosted
- version: "1.17.0"
+ version: "1.17.1"
convert:
dependency: transitive
description:
@@ -77,50 +77,18 @@ packages:
dependency: "direct main"
description:
name: device_info_plus
- sha256: c2386729379f04cd39ee0d5d4c48d8c8a0e70f7622dac626cbf5e396392602fd
- url: "https://pub.dev"
- source: hosted
- version: "3.2.4"
- device_info_plus_linux:
- dependency: transitive
- description:
- name: device_info_plus_linux
- sha256: e4eb5db4704f5534e872148a21cfcd39581022b63df556da6720d88f7c9f91a9
+ sha256: "2c35b6d1682b028e42d07b3aee4b98fa62996c10bc12cb651ec856a80d6a761b"
url: "https://pub.dev"
source: hosted
- version: "2.1.1"
- device_info_plus_macos:
- dependency: transitive
- description:
- name: device_info_plus_macos
- sha256: "38871fd2ad31871399d8307630c9f4eb5941dd2c643ee221c44d58de95d367a1"
- url: "https://pub.dev"
- source: hosted
- version: "2.2.3"
+ version: "9.0.2"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
- sha256: b2743934f0efc3e291880d76fb341ea114b7e8417d77ee0f93bd21f5dfd3e8d2
+ sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
url: "https://pub.dev"
source: hosted
- version: "2.6.1"
- device_info_plus_web:
- dependency: transitive
- description:
- name: device_info_plus_web
- sha256: "38715ad1ef3bee8915dd7bee08a9ac9ab54472a8df425c887062a3046209f663"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.0"
- device_info_plus_windows:
- dependency: transitive
- description:
- name: device_info_plus_windows
- sha256: "8fb1403fc94636d6ab48aeebb5f9379f2ca51cde3b337167ec6f39db09234492"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.1"
+ version: "7.0.0"
fake_async:
dependency: transitive
description:
@@ -133,10 +101,10 @@ packages:
dependency: transitive
description:
name: ffi
- sha256: "13a6ccf6a459a125b3fcdb6ec73bd5ff90822e071207c663bfd1f70062d51d18"
+ sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99
url: "https://pub.dev"
source: hosted
- version: "1.2.1"
+ version: "2.0.2"
file:
dependency: transitive
description:
@@ -150,6 +118,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ flutter_lints:
+ dependency: "direct dev"
+ description:
+ name: flutter_lints
+ sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -164,10 +140,10 @@ packages:
dependency: "direct main"
description:
name: http
- sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482"
+ sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
url: "https://pub.dev"
source: hosted
- version: "0.13.5"
+ version: "1.1.0"
http_parser:
dependency: transitive
description:
@@ -188,18 +164,27 @@ packages:
dependency: transitive
description:
name: js
- sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
+ sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
- version: "0.6.5"
- location:
- dependency: "direct main"
+ version: "0.6.7"
+ lints:
+ dependency: transitive
description:
- name: location
- sha256: "9051959f6f2ccadd887b28b66e9cbbcc25b6838e37cf9e894c421ccc0ebf80b5"
+ name: lints
+ sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
url: "https://pub.dev"
source: hosted
- version: "4.4.0"
+ version: "2.1.1"
+ location:
+ dependency: "direct main"
+ description:
+ path: "packages/location"
+ ref: V4
+ resolved-ref: "44745026a384c743cb5e64f94296303d9adbb237"
+ url: "https://github.com/781flyingdutchman/flutterlocation.git"
+ source: git
+ version: "4.4.1"
location_platform_interface:
dependency: transitive
description:
@@ -217,7 +202,7 @@ packages:
source: hosted
version: "3.1.1"
maplibre_gl:
- dependency: "direct dev"
+ dependency: "direct main"
description:
path: ".."
relative: true
@@ -233,7 +218,7 @@ packages:
source: git
version: "0.2.2"
maplibre_gl_platform_interface:
- dependency: "direct overridden"
+ dependency: "direct main"
description:
path: "../maplibre_gl_platform_interface"
relative: true
@@ -250,10 +235,10 @@ packages:
dependency: transitive
description:
name: matcher
- sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
+ sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
url: "https://pub.dev"
source: hosted
- version: "0.12.13"
+ version: "0.12.15"
material_color_utilities:
dependency: transitive
description:
@@ -266,26 +251,26 @@ packages:
dependency: transitive
description:
name: meta
- sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
+ sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
url: "https://pub.dev"
source: hosted
- version: "1.8.0"
+ version: "1.9.1"
path:
dependency: transitive
description:
name: path
- sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
+ sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
url: "https://pub.dev"
source: hosted
- version: "1.8.2"
+ version: "1.8.3"
path_provider:
dependency: "direct main"
description:
name: path_provider
- sha256: c7edf82217d4b2952b2129a61d3ad60f1075b9299e629e149a8d2e39c2e6aad4
+ sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2"
url: "https://pub.dev"
source: hosted
- version: "2.0.14"
+ version: "2.0.15"
path_provider_android:
dependency: transitive
description:
@@ -322,10 +307,10 @@ packages:
dependency: transitive
description:
name: path_provider_windows
- sha256: a34ecd7fb548f8e57321fd8e50d865d266941b54e6c3b7758cf8f37c24116905
+ sha256: "1cb68ba4cd3a795033de62ba1b7b4564dace301f952de6bfb3cd91b202b6ee96"
url: "https://pub.dev"
source: hosted
- version: "2.0.7"
+ version: "2.1.7"
petitparser:
dependency: transitive
description:
@@ -415,10 +400,10 @@ packages:
dependency: transitive
description:
name: test_api
- sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
+ sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
url: "https://pub.dev"
source: hosted
- version: "0.4.16"
+ version: "0.5.1"
typed_data:
dependency: transitive
description:
@@ -439,10 +424,18 @@ packages:
dependency: transitive
description:
name: win32
- sha256: c0e3a4f7be7dae51d8f152230b86627e3397c1ba8c3fa58e63d44a9f3edc9cef
+ sha256: "7dacfda1edcca378031db9905ad7d7bd56b29fd1a90b0908b71a52a12c41e36b"
url: "https://pub.dev"
source: hosted
- version: "2.6.1"
+ version: "5.0.3"
+ win32_registry:
+ dependency: transitive
+ description:
+ name: win32_registry
+ sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.1"
xdg_directories:
dependency: transitive
description:
@@ -460,5 +453,5 @@ packages:
source: hosted
version: "6.2.2"
sdks:
- dart: ">=2.18.0 <3.0.0"
- flutter: ">=3.0.0"
+ dart: ">=3.0.0 <4.0.0"
+ flutter: ">=3.10.0"
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 7f408409d..c2cf9f21b 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -4,7 +4,8 @@ publish_to: 'none'
version: 1.0.0+1
environment:
- sdk: '>=2.12.0 <3.0.0'
+ sdk: '>=3.0.0 <4.0.0'
+ flutter: '>=3.10.0'
dependencies:
flutter:
@@ -12,14 +13,27 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
- cupertino_icons: ^1.0.0
- location: ^4.0.0
- path_provider: ^2.0.0
- http: ^0.13.0
- collection: ^1.0.0
+ cupertino_icons: ^1.0.5
+
+ maplibre_gl_platform_interface:
+ path: ../
+
+ maplibre_gl:
+ path: ../
+
+ # Workaround for this issue:
+ # https://github.com/Lyokone/flutterlocation/issues/838#issuecomment-1546739392
+ location:
+ git:
+ url: https://github.com/781flyingdutchman/flutterlocation.git
+ ref: V4
+ path: packages/location
+ path_provider: ^2.0.15
+ http: ^1.1.0
+ collection: ^1.17.1
# temporary fix:
platform: ^3.1.0
- device_info_plus: ^3.2.2
+ device_info_plus: ^9.0.2
dependency_overrides:
maplibre_gl_platform_interface:
@@ -28,12 +42,10 @@ dependency_overrides:
path: ../maplibre_gl_web
dev_dependencies:
+ flutter_lints: ^2.0.1
flutter_test:
sdk: flutter
- maplibre_gl:
- path: ../
-
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
diff --git a/maplibre_gl_web/lib/src/mapbox_web_gl_platform.dart b/maplibre_gl_web/lib/src/mapbox_web_gl_platform.dart
index ed52e27df..81065dcb6 100644
--- a/maplibre_gl_web/lib/src/mapbox_web_gl_platform.dart
+++ b/maplibre_gl_web/lib/src/mapbox_web_gl_platform.dart
@@ -229,6 +229,8 @@ class MaplibreMapController extends MapLibreGlPlatform
@override
Future matchMapLanguageWithDeviceDefault() async {
+ // Fix in https://github.com/maplibre/flutter-maplibre-gl/issues/263
+ // ignore: deprecated_member_use
setMapLanguage(ui.window.locale.languageCode);
}
diff --git a/pubspec.lock b/pubspec.lock
index 670a78dac..5e0d8eea2 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -13,18 +13,18 @@ packages:
dependency: transitive
description:
name: characters
- sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
+ sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
- version: "1.2.1"
+ version: "1.3.0"
collection:
dependency: transitive
description:
name: collection
- sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
+ sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
url: "https://pub.dev"
source: hosted
- version: "1.17.0"
+ version: "1.17.1"
convert:
dependency: transitive
description:
@@ -63,10 +63,10 @@ packages:
dependency: transitive
description:
name: js
- sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
+ sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
- version: "0.6.5"
+ version: "0.6.7"
maplibre_gl_dart:
dependency: transitive
description:
@@ -102,10 +102,10 @@ packages:
dependency: transitive
description:
name: meta
- sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
+ sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
url: "https://pub.dev"
source: hosted
- version: "1.8.0"
+ version: "1.9.1"
path:
dependency: transitive
description:
@@ -160,5 +160,5 @@ packages:
source: hosted
version: "6.2.2"
sdks:
- dart: ">=2.18.0 <3.0.0"
+ dart: ">=3.0.0-0 <4.0.0"
flutter: ">=2.0.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 8a3e6a1aa..90e4602df 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -35,6 +35,7 @@ flutter:
default_package: mapbox_gl_web
environment:
- sdk: '>=2.12.0 <3.0.0'
- # Flutter versions prior to 1.10 did not support the flutter.plugin.platforms map.
- flutter: ">=2.0.0"
+ # Flutter 2.15 is the required min to be able to use Enum.name
+ sdk: '>=2.15.0 <3.0.0'
+ flutter: ">=2.8.1"
+
diff --git a/scripts/pubspec.lock b/scripts/pubspec.lock
index 79abdd9f6..561dc45be 100644
--- a/scripts/pubspec.lock
+++ b/scripts/pubspec.lock
@@ -18,4 +18,4 @@ packages:
source: hosted
version: "4.0.0"
sdks:
- dart: ">=2.12.0 <3.0.0"
+ dart: ">=2.12.0 <4.0.0"