diff --git a/.gitignore b/.gitignore index e08f7b9..4655c8a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ .buildlog/ .history .svn/ -resources/ # IntelliJ related *.iml @@ -25,10 +24,12 @@ resources/ **/doc/api/ .dart_tool/ .flutter-plugins +.flutter-plugins-dependencies .packages .pub-cache/ .pub/ build/ +pubspec.lock # Android related **/android/**/gradle-wrapper.jar @@ -58,6 +59,7 @@ build/ **/ios/.generated/ **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec **/ios/Flutter/Generated.xcconfig **/ios/Flutter/app.flx **/ios/Flutter/app.zip @@ -71,6 +73,3 @@ build/ !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages -example/.flutter-plugins-dependencies -example/ios/Flutter/Flutter.podspec diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 3287bb6..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Flutter", - "request": "launch", - "type": "dart" - } - ] -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d711b..72233db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.0 + +* Adds null safety. Refresh example app. + ## 0.1.9+4 * Fixed build failure diff --git a/example/.gitignore b/example/.gitignore index 2ddde2a..0fa6b67 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -22,52 +22,25 @@ # Flutter/Dart/Pub related **/doc/api/ +**/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins +.flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java +# Web related +lib/generated_plugin_registrant.dart -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/Flutter/flutter_export_environment.sh -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* +# Symbolication related +app.*.symbols -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/example/.metadata b/example/.metadata index 65686a2..80206eb 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: cc949a8e8b9cf394b9290a8e80f87af3e207dce5 + revision: c5a4b4029c0798f37c4a39b479d7cb75daa7b05c channel: stable project_type: app diff --git a/example/android/.gitignore b/example/android/.gitignore new file mode 100644 index 0000000..0a741cb --- /dev/null +++ b/example/android/.gitignore @@ -0,0 +1,11 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/example/android/.project b/example/android/.project deleted file mode 100644 index fc26fbf..0000000 --- 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 - - - - 1602529678411 - - 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 fa61503..0000000 --- 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=/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home -jvm.arguments= -offline.mode=false -override.workspace.settings=true -show.console.view=true -show.executions.view=true diff --git a/example/android/app/.classpath b/example/android/app/.classpath deleted file mode 100644 index 32d6691..0000000 --- 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 e1e06b4..0000000 --- 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 - - - - 1602529678416 - - 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 b1886ad..0000000 --- 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/.settings/org.eclipse.jdt.core.prefs b/example/android/app/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c51875c..0000000 --- a/example/android/app/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=12 -org.eclipse.jdt.core.compiler.compliance=12 -org.eclipse.jdt.core.compiler.source=12 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index f9732ba..b8b72b9 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,23 +26,19 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 30 sourceSets { main.java.srcDirs += 'src/main/kotlin' } - lintOptions { - disable 'InvalidPackage' - } - defaultConfig { - applicationId "de.luisthein.flutter_platform_maps_example" + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.flutter_platform_maps_example" minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { @@ -60,7 +56,4 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' } diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 9b031da..dc71632 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,13 +1,6 @@ - - - - + + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> + + + + diff --git a/example/android/app/src/main/kotlin/com/example/flutter_platform_maps_example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/flutter_platform_maps_example/MainActivity.kt index 15b7f5f..25f0ff8 100644 --- a/example/android/app/src/main/kotlin/com/example/flutter_platform_maps_example/MainActivity.kt +++ b/example/android/app/src/main/kotlin/com/example/flutter_platform_maps_example/MainActivity.kt @@ -1,13 +1,6 @@ package com.example.flutter_platform_maps_example -import android.os.Bundle - -import io.flutter.app.FlutterActivity -import io.flutter.plugins.GeneratedPluginRegistrant +import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - GeneratedPluginRegistrant.registerWith(this) - } } 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 0000000..f74085f --- /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 0000000..449a9f9 --- /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 00fa441..d74aa35 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/build.gradle b/example/android/build.gradle index 3a58dbb..c505a86 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.10' + ext.kotlin_version = '1.3.50' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.2' + classpath 'com.android.tools.build:gradle:4.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 2324ab5..94adc3a 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,5 +1,3 @@ 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 b6eef6e..bc6a58a 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Mar 05 15:38:22 CET 2020 +#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 5a2f14f..44e62bc 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -1,15 +1,11 @@ include ':app' -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} +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" diff --git a/example/ios/.gitignore b/example/ios/.gitignore new file mode 100644 index 0000000..e96ef60 --- /dev/null +++ b/example/ios/.gitignore @@ -0,0 +1,32 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 6b4c0f7..9367d48 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable App CFBundleIdentifier diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig index e8efba1..ec97fc6 100644 --- a/example/ios/Flutter/Debug.xcconfig +++ b/example/ios/Flutter/Debug.xcconfig @@ -1,2 +1,2 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig index 399e934..c4855bf 100644 --- a/example/ios/Flutter/Release.xcconfig +++ b/example/ios/Flutter/Release.xcconfig @@ -1,2 +1,2 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 25209e6..2f9269b 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -5,10 +5,10 @@ PODS: - google_maps_flutter (0.0.1): - Flutter - GoogleMaps (< 3.10) - - GoogleMaps (3.8.0): - - GoogleMaps/Maps (= 3.8.0) - - GoogleMaps/Base (3.8.0) - - GoogleMaps/Maps (3.8.0): + - GoogleMaps (3.9.0): + - GoogleMaps/Maps (= 3.9.0) + - GoogleMaps/Base (3.9.0) + - GoogleMaps/Maps (3.9.0): - GoogleMaps/Base DEPENDENCIES: @@ -32,8 +32,8 @@ SPEC CHECKSUMS: apple_maps_flutter: c59725efea39e13e703cde52a1d2b14866ad68a8 Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619 - GoogleMaps: 7c8d66d70e4e8c300f43a7219d8fdaad7b325a9a + GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac -PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c -COCOAPODS: 1.10.0 +COCOAPODS: 1.10.1 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 1fe07df..80d5f17 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -10,8 +10,7 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 7FE74C0AD0EF56424D639BC6 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC748B521FCB03A49BA22856 /* Pods_Runner.framework */; }; - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; + 86B19C37B340C8DF26555928 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F10B8C6FE3F460AA06EDE606 /* Pods_Runner.framework */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; @@ -33,9 +32,9 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 34ABAEC7C2DD893049707DA0 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 281A54299CBF9682C923189D /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 729441750D12482C4D29D068 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 403055A11ACF00CFDE534638 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -46,8 +45,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DC748B521FCB03A49BA22856 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - EBA65092DBD8FDD261FAFFD0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + E2456F27E102984F89956738 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + F10B8C6FE3F460AA06EDE606 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -55,28 +54,21 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 7FE74C0AD0EF56424D639BC6 /* Pods_Runner.framework in Frameworks */, + 86B19C37B340C8DF26555928 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 1CE192A111D712DD9A43F4F8 /* Frameworks */ = { + 0EB538D30556BF806410CCFF /* Pods */ = { isa = PBXGroup; children = ( - DC748B521FCB03A49BA22856 /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 597E5CD6E9CF1449739D05C5 /* Pods */ = { - isa = PBXGroup; - children = ( - 34ABAEC7C2DD893049707DA0 /* Pods-Runner.debug.xcconfig */, - 729441750D12482C4D29D068 /* Pods-Runner.release.xcconfig */, - EBA65092DBD8FDD261FAFFD0 /* Pods-Runner.profile.xcconfig */, + 403055A11ACF00CFDE534638 /* Pods-Runner.debug.xcconfig */, + E2456F27E102984F89956738 /* Pods-Runner.release.xcconfig */, + 281A54299CBF9682C923189D /* Pods-Runner.profile.xcconfig */, ); + name = Pods; path = Pods; sourceTree = ""; }; @@ -97,8 +89,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - 597E5CD6E9CF1449739D05C5 /* Pods */, - 1CE192A111D712DD9A43F4F8 /* Frameworks */, + 0EB538D30556BF806410CCFF /* Pods */, + B2ED3FDAD20C7554124CEC4B /* Frameworks */, ); sourceTree = ""; }; @@ -117,7 +109,6 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, @@ -126,11 +117,12 @@ path = Runner; sourceTree = ""; }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { + B2ED3FDAD20C7554124CEC4B /* Frameworks */ = { isa = PBXGroup; children = ( + F10B8C6FE3F460AA06EDE606 /* Pods_Runner.framework */, ); - name = "Supporting Files"; + name = Frameworks; sourceTree = ""; }; /* End PBXGroup section */ @@ -140,15 +132,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - CBD17C7EFA1A784BF2C71A08 /* [CP] Check Pods Manifest.lock */, + 5B104C5C09A0B66E644C71E6 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - B0C469C42311B1BE80FECB95 /* [CP] Embed Pods Frameworks */, - A44EDA5090B1A005FDEDDAF0 /* [CP] Copy Pods Resources */, + 882663772740F21D0502C7C7 /* [CP] Embed Pods Frameworks */, + 509C3ECF666D4B4E74707666 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -166,17 +158,16 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1020; - ORGANIZATIONNAME = "The Chromium Authors"; + ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = PT2UDFM269; - LastSwiftMigration = 1130; + LastSwiftMigration = 1100; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -200,7 +191,6 @@ files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -223,77 +213,75 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 9740EEB61CF901F6004384FC /* Run Script */ = { + 509C3ECF666D4B4E74707666 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputPaths = ( + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "Run Script"; - outputPaths = ( + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; }; - A44EDA5090B1A005FDEDDAF0 /* [CP] Copy Pods Resources */ = { + 5B104C5C09A0B66E644C71E6 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", - "${PODS_ROOT}/GoogleMaps/Maps/Frameworks/GoogleMaps.framework/Resources/GoogleMaps.bundle", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleMaps.bundle", + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - B0C469C42311B1BE80FECB95 /* [CP] Embed Pods Frameworks */ = { + 882663772740F21D0502C7C7 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/apple_maps_flutter/apple_maps_flutter.framework", + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/apple_maps_flutter.framework", + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - CBD17C7EFA1A784BF2C71A08 /* [CP] Check Pods Manifest.lock */ = { + 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( ); + name = "Run Script"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; /* End PBXShellScriptBuildPhase section */ @@ -370,9 +358,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -385,18 +374,9 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = PT2UDFM269; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterPlatformMapsExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -452,7 +432,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -501,9 +481,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -517,18 +498,9 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = PT2UDFM269; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterPlatformMapsExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -545,18 +517,9 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = PT2UDFM269; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterPlatformMapsExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /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 749ec3f..72089ce 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -2,10 +2,6 @@ - io.flutter.embedded_views_preview - YES - Privacy - Location When In Use Usage Description - Your usage description CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/example/ios/Runner/Runner-Bridging-Header.h index 7335fdf..308a2a5 100644 --- a/example/ios/Runner/Runner-Bridging-Header.h +++ b/example/ios/Runner/Runner-Bridging-Header.h @@ -1 +1 @@ -#import "GeneratedPluginRegistrant.h" \ No newline at end of file +#import "GeneratedPluginRegistrant.h" diff --git a/example/lib/main.dart b/example/lib/main.dart index 7fbe187..ba3fd1e 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; - import 'package:platform_maps_flutter/platform_maps_flutter.dart'; void main() => runApp(MyApp()); @@ -15,7 +14,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key}) : super(key: key); + MyHomePage({Key? key}) : super(key: key); @override _MyHomePageState createState() => _MyHomePageState(); @@ -25,54 +24,50 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { return Scaffold( - body: Container( - width: 300, - height: 300, - child: PlatformMap( - initialCameraPosition: CameraPosition( - target: const LatLng(47.6, 8.8796), - zoom: 16.0, - ), - markers: Set.of( - [ - Marker( - markerId: MarkerId('marker_1'), - position: LatLng(47.6, 8.8796), - consumeTapEvents: true, - infoWindow: InfoWindow( - title: 'PlatformMarker', - snippet: "Hi I'm a Platform Marker", - ), - onTap: () { - print("Marker tapped"); - }, + body: PlatformMap( + initialCameraPosition: CameraPosition( + target: const LatLng(47.6, 8.8796), + zoom: 16.0, + ), + markers: Set.of( + [ + Marker( + markerId: MarkerId('marker_1'), + position: LatLng(47.6, 8.8796), + consumeTapEvents: true, + infoWindow: InfoWindow( + title: 'PlatformMarker', + snippet: "Hi I'm a Platform Marker", ), - ], - ), - mapType: MapType.satellite, - onTap: (location) => print('onTap: $location'), - onCameraMove: (cameraUpdate) => print('onCameraMove: $cameraUpdate'), - compassEnabled: true, - onMapCreated: (controller) { - Future.delayed(Duration(seconds: 2)).then( - (_) { - controller.animateCamera( - CameraUpdate.newCameraPosition( - const CameraPosition( - bearing: 270.0, - target: LatLng(51.5160895, -0.1294527), - tilt: 30.0, - zoom: 18, - ), - ), - ); - controller - .getVisibleRegion() - .then((bounds) => print("bounds: ${bounds.toString()}")); + onTap: () { + print("Marker tapped"); }, - ); - }, + ), + ], ), + mapType: MapType.satellite, + onTap: (location) => print('onTap: $location'), + onCameraMove: (cameraUpdate) => print('onCameraMove: $cameraUpdate'), + compassEnabled: true, + onMapCreated: (controller) { + Future.delayed(Duration(seconds: 2)).then( + (_) { + controller.animateCamera( + CameraUpdate.newCameraPosition( + const CameraPosition( + bearing: 270.0, + target: LatLng(51.5160895, -0.1294527), + tilt: 30.0, + zoom: 18, + ), + ), + ); + controller + .getVisibleRegion() + .then((bounds) => print("bounds: ${bounds.toString()}")); + }, + ); + }, ), ); } diff --git a/example/pubspec.lock b/example/pubspec.lock deleted file mode 100644 index 80e03da..0000000 --- a/example/pubspec.lock +++ /dev/null @@ -1,203 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - apple_maps_flutter: - dependency: transitive - description: - name: apple_maps_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.4" - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.5.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.3" - fake_async: - dependency: transitive - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_plugin_android_lifecycle: - dependency: transitive - description: - name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - google_maps_flutter: - dependency: transitive - description: - name: google_maps_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - google_maps_flutter_platform_interface: - dependency: transitive - description: - name: google_maps_flutter_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.10" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - platform_maps_flutter: - dependency: "direct main" - description: - path: ".." - relative: true - source: path - version: "0.1.9+4" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - stream_transform: - dependency: transitive - description: - name: stream_transform - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.19" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" -sdks: - dart: ">=2.12.0-259.9.beta <3.0.0" - flutter: ">=1.22.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 31b0831..c4fa72b 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,10 +1,23 @@ name: flutter_platform_maps_example -description: Example usage of flutter_platform_maps. -publish_to: none -version: 1.0.0 + +# The following line prevents the package from being accidentally published to +# pub.dev using `pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +version: 1.0.0+1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: @@ -15,13 +28,12 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 + cupertino_icons: ^1.0.2 dev_dependencies: flutter_test: sdk: flutter - # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec @@ -35,8 +47,8 @@ flutter: # To add assets to your application, add an assets section, like this: # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. diff --git a/lib/platform_maps_flutter.dart b/lib/platform_maps_flutter.dart index 2e6828f..4668b5a 100644 --- a/lib/platform_maps_flutter.dart +++ b/lib/platform_maps_flutter.dart @@ -3,24 +3,25 @@ library platform_maps_flutter; import 'dart:io'; import 'dart:typed_data'; +import 'package:apple_maps_flutter/apple_maps_flutter.dart' as appleMaps; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart' as googleMaps; -import 'package:apple_maps_flutter/apple_maps_flutter.dart' as appleMaps; +import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; part 'src/bitmap.dart'; part 'src/camera.dart'; -part 'src/platform_maps.dart'; -part 'src/location.dart'; -part 'src/marker.dart'; -part 'src/polyline.dart'; -part 'src/polygon.dart'; part 'src/cap.dart'; part 'src/circle.dart'; +part 'src/controller.dart'; part 'src/joint_type.dart'; +part 'src/location.dart'; +part 'src/marker.dart'; part 'src/pattern_item.dart'; -part 'src/controller.dart'; +part 'src/platform_maps.dart'; +part 'src/polygon.dart'; +part 'src/polyline.dart'; part 'src/ui.dart'; diff --git a/lib/src/bitmap.dart b/lib/src/bitmap.dart index 09e3d7f..758ea57 100644 --- a/lib/src/bitmap.dart +++ b/lib/src/bitmap.dart @@ -10,7 +10,7 @@ class BitmapDescriptor { BitmapDescriptor._(this.bitmapDescriptor); /// Creates a BitmapDescriptor that refers to the default marker image. - static BitmapDescriptor get defaultMarker { + static BitmapDescriptor? get defaultMarker { if (Platform.isIOS) { return BitmapDescriptor._(appleMaps.BitmapDescriptor.defaultAnnotation); } else if (Platform.isAndroid) { @@ -28,8 +28,8 @@ class BitmapDescriptor { static Future fromAssetImage( ImageConfiguration configuration, String assetName, { - AssetBundle bundle, - String package, + AssetBundle? bundle, + String? package, }) async { dynamic bitmap; if (Platform.isIOS) { diff --git a/lib/src/camera.dart b/lib/src/camera.dart index d9ad452..613070c 100644 --- a/lib/src/camera.dart +++ b/lib/src/camera.dart @@ -5,14 +5,11 @@ part of platform_maps_flutter; /// location, its [zoom] level, [pitch] angle, and [heading]. class CameraPosition { const CameraPosition({ - @required this.target, + required this.target, this.bearing = 0.0, this.tilt = 0.0, this.zoom = 0, - }) : assert(target != null), - assert(bearing != null), - assert(tilt != null), - assert(zoom != null); + }); /// The camera's bearing in degrees, measured clockwise from north. /// diff --git a/lib/src/cap.dart b/lib/src/cap.dart index 0615141..c2752e0 100644 --- a/lib/src/cap.dart +++ b/lib/src/cap.dart @@ -23,10 +23,10 @@ class _Cap { }; static googleMaps.Cap googlePolylineCap(Cap cap) { - return googleMapsCaps[cap]; + return googleMapsCaps[cap]!; } static appleMaps.Cap applePolylineCap(Cap cap) { - return appleMapsCaps[cap]; + return appleMapsCaps[cap]!; } } diff --git a/lib/src/circle.dart b/lib/src/circle.dart index 5f0e034..544b2ad 100644 --- a/lib/src/circle.dart +++ b/lib/src/circle.dart @@ -10,7 +10,7 @@ part of platform_maps_flutter; @immutable class CircleId { /// Creates an immutable identifier for a [Circle]. - CircleId(this.value) : assert(value != null); + CircleId(this.value); /// value of the [CircleId]. final String value; @@ -18,7 +18,7 @@ class CircleId { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (other.runtimeType != runtimeType) return false; + if (other is! CircleId) return false; final CircleId typedOther = other; return value == typedOther.value; } @@ -37,7 +37,7 @@ class CircleId { class Circle { /// Creates an immutable representation of a [Circle] to draw on [PlatformMap]. const Circle({ - @required this.circleId, + required this.circleId, this.consumeTapEvents = false, this.fillColor = Colors.transparent, this.center = const LatLng(0.0, 0.0), @@ -79,19 +79,19 @@ class Circle { final bool visible; /// Callbacks to receive tap events for circle placed on this map. - final VoidCallback onTap; + final VoidCallback? onTap; /// Creates a new [Circle] object whose values are the same as this instance, /// unless overwritten by the specified parameters. Circle copyWith({ - bool consumeTapEventsParam, - Color fillColorParam, - LatLng centerParam, - double radiusParam, - Color strokeColorParam, - int strokeWidthParam, - bool visibleParam, - VoidCallback onTapParam, + bool? consumeTapEventsParam, + Color? fillColorParam, + LatLng? centerParam, + double? radiusParam, + Color? strokeColorParam, + int? strokeWidthParam, + bool? visibleParam, + VoidCallback? onTapParam, }) { return Circle( circleId: circleId, @@ -112,7 +112,7 @@ class Circle { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (other.runtimeType != runtimeType) return false; + if (other is! Circle) return false; final Circle typedOther = other; return circleId == typedOther.circleId && consumeTapEvents == typedOther.consumeTapEvents && @@ -126,7 +126,7 @@ class Circle { } static Set toGoogleMapsCircleSet(Set circles) { - List _circles = []; + List _circles = []; for (Circle circle in circles) { _circles.add(circle.googleMapsCircle); } @@ -134,7 +134,7 @@ class Circle { } static Set toAppleMapsCircleSet(Set circles) { - List _circles = []; + List _circles = []; for (Circle circle in circles) { _circles.add(circle.appleMapsCircle); } diff --git a/lib/src/controller.dart b/lib/src/controller.dart index 368f757..c239d25 100644 --- a/lib/src/controller.dart +++ b/lib/src/controller.dart @@ -1,8 +1,8 @@ part of platform_maps_flutter; class PlatformMapController { - appleMaps.AppleMapController appleController; - googleMaps.GoogleMapController googleController; + appleMaps.AppleMapController? appleController; + googleMaps.GoogleMapController? googleController; PlatformMapController(dynamic controller) { if (controller.runtimeType == googleMaps.GoogleMapController) { @@ -21,11 +21,10 @@ class PlatformMapController { /// * [hideMarkerInfoWindow] to hide the Info Window. /// * [isMarkerInfoWindowShown] to check if the Info Window is showing. Future showMarkerInfoWindow(MarkerId markerId) { - assert(markerId != null); if (Platform.isAndroid) { - return googleController.showMarkerInfoWindow(markerId.googleMapsMarkerId); + return googleController!.showMarkerInfoWindow(markerId.googleMapsMarkerId); } else if (Platform.isIOS) { - return appleController + return appleController! .showMarkerInfoWindow(markerId.appleMapsAnnoationId); } throw ('Platform not supported.'); @@ -40,11 +39,10 @@ class PlatformMapController { /// * [showMarkerInfoWindow] to show the Info Window. /// * [isMarkerInfoWindowShown] to check if the Info Window is showing. Future hideMarkerInfoWindow(MarkerId markerId) { - assert(markerId != null); if (Platform.isAndroid) { - return googleController.hideMarkerInfoWindow(markerId.googleMapsMarkerId); + return googleController!.hideMarkerInfoWindow(markerId.googleMapsMarkerId); } else if (Platform.isIOS) { - return appleController + return appleController! .hideMarkerInfoWindow(markerId.appleMapsAnnoationId); } throw ('Platform not supported.'); @@ -59,12 +57,11 @@ class PlatformMapController { /// * [showMarkerInfoWindow] to show the Info Window. /// * [hideMarkerInfoWindow] to hide the Info Window. Future isMarkerInfoWindowShown(MarkerId markerId) { - assert(markerId != null); if (Platform.isAndroid) { - return googleController + return googleController! .isMarkerInfoWindowShown(markerId.googleMapsMarkerId); } else if (Platform.isIOS) { - return appleController + return appleController! .isMarkerInfoWindowShown(markerId.appleMapsAnnoationId); } throw ('Platform not supported.'); @@ -76,9 +73,9 @@ class PlatformMapController { /// platform side. Future animateCamera(cameraUpdate) async { if (Platform.isIOS) { - return this.appleController.animateCamera(cameraUpdate); + return this.appleController!.animateCamera(cameraUpdate); } else if (Platform.isAndroid) { - return this.googleController.animateCamera(cameraUpdate); + return this.googleController!.animateCamera(cameraUpdate); } throw ('Platform not supported.'); } @@ -89,22 +86,22 @@ class PlatformMapController { /// platform side. Future moveCamera(cameraUpdate) async { if (Platform.isIOS) { - return this.appleController.moveCamera(cameraUpdate); + return this.appleController!.moveCamera(cameraUpdate); } else if (Platform.isAndroid) { - return this.googleController.moveCamera(cameraUpdate); + return this.googleController!.moveCamera(cameraUpdate); } } /// Return [LatLngBounds] defining the region that is visible in a map. Future getVisibleRegion() async { - LatLngBounds _bounds; + late LatLngBounds _bounds; if (Platform.isIOS) { appleMaps.LatLngBounds appleBounds = - await this.appleController.getVisibleRegion(); + await this.appleController!.getVisibleRegion(); _bounds = LatLngBounds._fromAppleLatLngBounds(appleBounds); } else if (Platform.isAndroid) { googleMaps.LatLngBounds googleBounds = - await this.googleController.getVisibleRegion(); + await this.googleController!.getVisibleRegion(); _bounds = LatLngBounds._fromGoogleLatLngBounds(googleBounds); } return _bounds; diff --git a/lib/src/location.dart b/lib/src/location.dart index 4efbbe8..a2537be 100644 --- a/lib/src/location.dart +++ b/lib/src/location.dart @@ -10,9 +10,7 @@ class LatLng { /// The longitude is normalized to the half-open interval from -180.0 /// (inclusive) to +180.0 (exclusive) const LatLng(double latitude, double longitude) - : assert(latitude != null), - assert(longitude != null), - latitude = + : latitude = (latitude < -90.0 ? -90.0 : (90.0 < latitude ? 90.0 : latitude)), longitude = (longitude + 180.0) % 360.0 - 180.0; @@ -64,10 +62,8 @@ class LatLngBounds { /// /// The latitude of the southwest corner cannot be larger than the /// latitude of the northeast corner. - LatLngBounds({@required this.southwest, @required this.northeast}) - : assert(southwest != null), - assert(northeast != null), - assert(southwest.latitude <= northeast.latitude); + LatLngBounds({required this.southwest, required this.northeast}) + : assert(southwest.latitude <= northeast.latitude); static LatLngBounds _fromAppleLatLngBounds(appleMaps.LatLngBounds bounds) => LatLngBounds( diff --git a/lib/src/marker.dart b/lib/src/marker.dart index bcfa861..49bef05 100644 --- a/lib/src/marker.dart +++ b/lib/src/marker.dart @@ -10,12 +10,12 @@ class InfoWindow { /// Text displayed in an info window when the user taps the marker. /// /// A null value means no title. - final String title; + final String? title; /// Additional text displayed below the [title]. /// /// A null value means no additional text. - final String snippet; + final String? snippet; /// The icon image point that will be the anchor of the info window when /// displayed. @@ -23,10 +23,10 @@ class InfoWindow { /// The image point is specified in normalized coordinates: An anchor of /// (0.0, 0.0) means the top left corner of the image. An anchor /// of (1.0, 1.0) means the bottom right corner of the image. - final Offset anchor; + final Offset? anchor; /// onTap callback for this [InfoWindow]. - final VoidCallback onTap; + final VoidCallback? onTap; appleMaps.InfoWindow get appleMapsInfoWindow => appleMaps.InfoWindow( anchor: this.anchor ?? Offset(0, 0), @@ -45,10 +45,10 @@ class InfoWindow { /// Creates a new [InfoWindow] object whose values are the same as this instance, /// unless overwritten by the specified parameters. InfoWindow copyWith({ - String titleParam, - String snippetParam, - Offset anchorParam, - VoidCallback onTapParam, + String? titleParam, + String? snippetParam, + Offset? anchorParam, + VoidCallback? onTapParam, }) { return InfoWindow( title: titleParam ?? title, @@ -64,7 +64,7 @@ class InfoWindow { /// This does not have to be globally unique, only unique among the list. @immutable class MarkerId { - MarkerId(this.value) : assert(value != null); + MarkerId(this.value); /// value of the [MarkerId]. final String value; @@ -99,7 +99,7 @@ class Marker { /// * is visible; [visible] is true /// * is placed at the base of the drawing order; [zIndex] is 0.0 const Marker({ - @required this.markerId, + required this.markerId, this.alpha = 1.0, this.consumeTapEvents = false, this.draggable = false, @@ -109,7 +109,7 @@ class Marker { this.onTap, this.visible = true, this.onDragEnd, - }) : assert(alpha == null || (0.0 <= alpha && alpha <= 1.0)); + }) : assert((0.0 <= alpha && alpha <= 1.0)); /// Uniquely identifies a [Marker]. final MarkerId markerId; @@ -128,7 +128,7 @@ class Marker { final bool draggable; /// A description of the bitmap used to draw the marker icon. - final BitmapDescriptor icon; + final BitmapDescriptor? icon; /// A Google Maps InfoWindow. /// @@ -139,12 +139,12 @@ class Marker { final LatLng position; /// Callbacks to receive tap events for markers placed on this map. - final VoidCallback onTap; + final VoidCallback? onTap; /// True if the annotation is visible. final bool visible; - final ValueChanged onDragEnd; + final ValueChanged? onDragEnd; appleMaps.Annotation get appleMapsAnnotation => appleMaps.Annotation( annotationId: this.markerId.appleMapsAnnoationId, @@ -152,8 +152,8 @@ class Marker { draggable: this.draggable, infoWindow: this.infoWindow.appleMapsInfoWindow, onTap: this.onTap, - icon: this.icon.bitmapDescriptor ?? - BitmapDescriptor.defaultMarker.bitmapDescriptor, + icon: this.icon?.bitmapDescriptor ?? + BitmapDescriptor.defaultMarker?.bitmapDescriptor, visible: this.visible, onDragEnd: this.onDragEnd != null ? (appleMaps.LatLng latLng) => @@ -168,8 +168,8 @@ class Marker { draggable: this.draggable, infoWindow: this.infoWindow.googleMapsInfoWindow, onTap: this.onTap, - icon: this.icon.bitmapDescriptor ?? - BitmapDescriptor.defaultMarker.bitmapDescriptor, + icon: this.icon?.bitmapDescriptor ?? + BitmapDescriptor.defaultMarker?.bitmapDescriptor, visible: this.visible, onDragEnd: this.onDragEnd != null ? (googleMaps.LatLng latLng) => @@ -187,7 +187,7 @@ class Marker { infoWindow: marker.infoWindow.appleMapsInfoWindow, onTap: marker.onTap, icon: marker.icon?.bitmapDescriptor ?? - BitmapDescriptor.defaultMarker.bitmapDescriptor, + BitmapDescriptor.defaultMarker?.bitmapDescriptor, visible: marker.visible, onDragEnd: marker.onDragEnd != null ? (appleMaps.LatLng latLng) => @@ -205,7 +205,7 @@ class Marker { infoWindow: marker.infoWindow.googleMapsInfoWindow, onTap: marker.onTap, icon: marker.icon?.bitmapDescriptor ?? - BitmapDescriptor.defaultMarker.bitmapDescriptor, + BitmapDescriptor.defaultMarker?.bitmapDescriptor, visible: marker.visible, onDragEnd: marker.onDragEnd != null ? (googleMaps.LatLng latLng) => @@ -216,7 +216,7 @@ class Marker { static Set toAppleMapsAnnotationSet( Set markers) { - List _annotations = []; + List _annotations = []; for (Marker marker in markers) { _annotations.add(appleMapsAnnotationFromMarker(marker)); } @@ -224,7 +224,7 @@ class Marker { } static Set toGoogleMapsMarkerSet(Set markers) { - List _markers = []; + List _markers = []; for (Marker marker in markers) { _markers.add(googleMapsMarkerFromMarker(marker)); } @@ -232,14 +232,14 @@ class Marker { } Marker copyWith({ - double alphaParam, - bool consumeTapEventsParam, - bool draggableParam, - BitmapDescriptor iconParam, - InfoWindow infoWindowParam, - LatLng positionParam, - bool visibleParam, - VoidCallback onTapParam, + double? alphaParam, + bool? consumeTapEventsParam, + bool? draggableParam, + BitmapDescriptor? iconParam, + InfoWindow? infoWindowParam, + LatLng? positionParam, + bool? visibleParam, + VoidCallback? onTapParam, }) { return Marker( markerId: markerId, @@ -254,16 +254,12 @@ class Marker { ); } - static _onGoogleMarkerDragEnd(googleMaps.LatLng latLng, Function onDragEnd) { - if (onDragEnd != null) { - onDragEnd(LatLng._fromGoogleLatLng(latLng)); - } + static _onGoogleMarkerDragEnd(googleMaps.LatLng latLng, Function? onDragEnd) { + onDragEnd?.call(LatLng._fromGoogleLatLng(latLng)); } static _onAppleAnnotationDragEnd( - appleMaps.LatLng latLng, Function onDragEnd) { - if (onDragEnd != null) { - onDragEnd(LatLng._fromAppleLatLng(latLng)); - } + appleMaps.LatLng latLng, Function? onDragEnd) { + onDragEnd?.call(LatLng._fromAppleLatLng(latLng)); } } diff --git a/lib/src/platform_maps.dart b/lib/src/platform_maps.dart index 0f9d900..860ed81 100644 --- a/lib/src/platform_maps.dart +++ b/lib/src/platform_maps.dart @@ -6,35 +6,37 @@ typedef void CameraPositionCallback(CameraPosition position); class PlatformMap extends StatefulWidget { const PlatformMap({ - Key key, - @required this.initialCameraPosition, + Key? key, + required this.initialCameraPosition, this.onMapCreated, - this.gestureRecognizers, + this.gestureRecognizers = const >{}, this.compassEnabled = true, - this.trafficEnabled = false, - this.mapType, - this.padding, + this.mapType = MapType.normal, + this.minMaxZoomPreference = MinMaxZoomPreference.unbounded, this.rotateGesturesEnabled = true, this.scrollGesturesEnabled = true, this.zoomControlsEnabled = true, this.zoomGesturesEnabled = true, - this.tiltGestureEnabled = true, + this.tiltGesturesEnabled = true, this.myLocationEnabled = false, this.myLocationButtonEnabled = false, - this.markers, - this.polylines, - this.polygons, - this.circles, + this.padding = const EdgeInsets.all(0), + this.trafficEnabled = false, + this.markers = const {}, + this.polygons = const {}, + this.polylines = const {}, + this.circles = const {}, this.onCameraMoveStarted, this.onCameraMove, this.onCameraIdle, this.onTap, this.onLongPress, - this.minMaxZoomPreference, - }) : assert(initialCameraPosition != null), - super(key: key); + }) : super(key: key); - final MapCreatedCallback onMapCreated; + /// Callback method for when the map is ready to be used. + /// + /// Used to receive a [GoogleMapController] for this [GoogleMap]. + final MapCreatedCallback? onMapCreated; /// The initial position of the map's camera. final CameraPosition initialCameraPosition; @@ -45,9 +47,6 @@ class PlatformMap extends StatefulWidget { /// Type of map tiles to be rendered. final MapType mapType; - /// True if the map should display the current traffic. - final bool trafficEnabled; - /// Preferred bounds for the camera zoom level. /// /// Actual bounds depend on map data and device. @@ -69,18 +68,21 @@ class PlatformMap extends StatefulWidget { final bool zoomGesturesEnabled; /// True if the map view should respond to tilt gestures. - final bool tiltGestureEnabled; + final bool tiltGesturesEnabled; + + /// Padding to be set on map. See https://developers.google.com/maps/documentation/android-sdk/map#map_padding for more details. + final EdgeInsets padding; /// Markers to be placed on the map. final Set markers; - /// Polylines to be placed on the map. - final Set polylines; - /// Polygons to be placed on the map. final Set polygons; - /// Polygons to be placed on the map. + /// Polylines to be placed on the map. + final Set polylines; + + /// Circles to be placed on the map. final Set circles; /// Called when the camera starts moving. @@ -91,30 +93,24 @@ class PlatformMap extends StatefulWidget { /// 2. Programmatically initiated animation. /// 3. Camera motion initiated in response to user gestures on the map. /// For example: pan, tilt, pinch to zoom, or rotate. - final VoidCallback onCameraMoveStarted; + final VoidCallback? onCameraMoveStarted; /// Called repeatedly as the camera continues to move after an /// onCameraMoveStarted call. /// /// This may be called as often as once every frame and should /// not perform expensive operations. - final CameraPositionCallback onCameraMove; + final CameraPositionCallback? onCameraMove; /// Called when camera movement has ended, there are no pending /// animations and the user has stopped interacting with the map. - final VoidCallback onCameraIdle; - - /// Called every time a [PlatformMap] is tapped. - final Function onTap; + final VoidCallback? onCameraIdle; - /// Called every time a [PlatformMap] is long pressed. - final Function onLongPress; + /// Called every time a [GoogleMap] is tapped. + final ArgumentCallback? onTap; - /// The padding used on the map - /// - /// The amount of additional space (measured in screen points) used for padding for the - /// native controls. - final EdgeInsets padding; + /// Called every time a [GoogleMap] is long pressed. + final ArgumentCallback? onLongPress; /// True if a "My Location" layer should be shown on the map. /// @@ -150,8 +146,13 @@ class PlatformMap extends StatefulWidget { /// By default, the my-location button is enabled (and hence shown when the /// my-location layer is enabled). /// + /// See also: + /// * [myLocationEnabled] parameter. final bool myLocationButtonEnabled; + /// Enables or disables the traffic layer of the map + final bool trafficEnabled; + /// Which gestures should be consumed by the map. /// /// It is possible for other gesture recognizers to be competing with the map on pointer @@ -159,10 +160,9 @@ class PlatformMap extends StatefulWidget { /// vertical drags. The map will claim gestures that are recognized by any of the /// recognizers on this list. /// - /// When this set is empty or null, the map will only handle pointer events for gestures that + /// When this set is empty, the map will only handle pointer events for gestures that /// were not claimed by any other gesture recognizer. final Set> gestureRecognizers; - @override _PlatformMapState createState() => _PlatformMapState(); } @@ -176,25 +176,17 @@ class _PlatformMapState extends State { widget.initialCameraPosition.googleMapsCameraPosition, compassEnabled: widget.compassEnabled, mapType: _getGoogleMapType(), - padding: widget.padding ?? EdgeInsets.zero, - markers: widget.markers != null - ? Marker.toGoogleMapsMarkerSet(widget.markers) - : {}, - polylines: widget.polylines != null - ? Polyline.toGoogleMapsPolylines(widget.polylines) - : {}, - polygons: widget.polygons != null - ? Polygon.toGoogleMapsPolygonSet(widget.polygons) - : {}, - circles: widget.circles != null - ? Circle.toGoogleMapsCircleSet(widget.circles) - : {}, + padding: widget.padding, + markers: Marker.toGoogleMapsMarkerSet(widget.markers), + polylines: Polyline.toGoogleMapsPolylines(widget.polylines), + polygons: Polygon.toGoogleMapsPolygonSet(widget.polygons), + circles: Circle.toGoogleMapsCircleSet(widget.circles), gestureRecognizers: widget.gestureRecognizers, onCameraIdle: widget.onCameraIdle, myLocationButtonEnabled: widget.myLocationButtonEnabled, myLocationEnabled: widget.myLocationEnabled, onCameraMoveStarted: widget.onCameraMoveStarted, - tiltGesturesEnabled: widget.tiltGestureEnabled, + tiltGesturesEnabled: widget.tiltGesturesEnabled, rotateGesturesEnabled: widget.rotateGesturesEnabled, zoomControlsEnabled: widget.zoomControlsEnabled, zoomGesturesEnabled: widget.zoomGesturesEnabled, @@ -204,9 +196,8 @@ class _PlatformMapState extends State { onTap: _onTap, onLongPress: _onLongPress, trafficEnabled: widget.trafficEnabled, - minMaxZoomPreference: widget.minMaxZoomPreference != null - ? widget.minMaxZoomPreference.googleMapsZoomPreference - : MinMaxZoomPreference.unbounded.googleMapsZoomPreference, + minMaxZoomPreference: + widget.minMaxZoomPreference.googleMapsZoomPreference, ); } else if (Platform.isIOS) { return appleMaps.AppleMap( @@ -214,25 +205,17 @@ class _PlatformMapState extends State { widget.initialCameraPosition.appleMapsCameraPosition, compassEnabled: widget.compassEnabled, mapType: _getAppleMapType(), - padding: widget.padding ?? EdgeInsets.zero, - annotations: widget.markers != null - ? Marker.toAppleMapsAnnotationSet(widget.markers) - : widget.markers, - polylines: widget.polylines != null - ? Polyline.toAppleMapsPolylines(widget.polylines) - : widget.polylines, - polygons: widget.polygons != null - ? Polygon.toAppleMapsPolygonSet(widget.polygons) - : widget.polygons, - circles: widget.circles != null - ? Circle.toAppleMapsCircleSet(widget.circles) - : widget.circles, + padding: widget.padding, + annotations: Marker.toAppleMapsAnnotationSet(widget.markers), + polylines: Polyline.toAppleMapsPolylines(widget.polylines), + polygons: Polygon.toAppleMapsPolygonSet(widget.polygons), + circles: Circle.toAppleMapsCircleSet(widget.circles), gestureRecognizers: widget.gestureRecognizers, onCameraIdle: widget.onCameraIdle, myLocationButtonEnabled: widget.myLocationButtonEnabled, myLocationEnabled: widget.myLocationEnabled, onCameraMoveStarted: widget.onCameraMoveStarted, - pitchGesturesEnabled: widget.tiltGestureEnabled, + pitchGesturesEnabled: widget.tiltGesturesEnabled, rotateGesturesEnabled: widget.rotateGesturesEnabled, zoomGesturesEnabled: widget.zoomGesturesEnabled, scrollGesturesEnabled: widget.scrollGesturesEnabled, @@ -241,9 +224,8 @@ class _PlatformMapState extends State { onTap: _onTap, onLongPress: _onLongPress, trafficEnabled: widget.trafficEnabled, - minMaxZoomPreference: widget.minMaxZoomPreference != null - ? widget.minMaxZoomPreference.appleMapsZoomPreference - : MinMaxZoomPreference.unbounded.appleMapsZoomPreference, + minMaxZoomPreference: + widget.minMaxZoomPreference.appleMapsZoomPreference, ); } else { return Text("Platform not yet implemented"); @@ -251,48 +233,41 @@ class _PlatformMapState extends State { } void _onMapCreated(dynamic controller) { - if (widget.onMapCreated != null) { - widget.onMapCreated(PlatformMapController(controller)); - } + widget.onMapCreated?.call(PlatformMapController(controller)); } void _onCameraMove(dynamic cameraPosition) { - if (widget.onCameraMove != null) { - if (Platform.isIOS) { - widget.onCameraMove( - CameraPosition.fromAppleMapCameraPosition( - cameraPosition as appleMaps.CameraPosition, - ), - ); - } else if (Platform.isAndroid) { - widget.onCameraMove( - CameraPosition.fromGoogleMapCameraPosition( - cameraPosition as googleMaps.CameraPosition, - ), - ); - } + if (Platform.isIOS) { + widget.onCameraMove?.call( + CameraPosition.fromAppleMapCameraPosition( + cameraPosition as appleMaps.CameraPosition, + ), + ); + } else if (Platform.isAndroid) { + widget.onCameraMove?.call( + CameraPosition.fromGoogleMapCameraPosition( + cameraPosition as googleMaps.CameraPosition, + ), + ); } } void _onTap(dynamic position) { - if (widget.onTap != null) { - if (Platform.isIOS) { - widget.onTap(LatLng._fromAppleLatLng(position as appleMaps.LatLng)); - } else if (Platform.isAndroid) { - widget.onTap(LatLng._fromGoogleLatLng(position as googleMaps.LatLng)); - } + if (Platform.isIOS) { + widget.onTap?.call(LatLng._fromAppleLatLng(position as appleMaps.LatLng)); + } else if (Platform.isAndroid) { + widget.onTap + ?.call(LatLng._fromGoogleLatLng(position as googleMaps.LatLng)); } } void _onLongPress(dynamic position) { - if (widget.onLongPress != null) { - if (Platform.isIOS) { - widget - .onLongPress(LatLng._fromAppleLatLng(position as appleMaps.LatLng)); - } else if (Platform.isAndroid) { - widget.onLongPress( - LatLng._fromGoogleLatLng(position as googleMaps.LatLng)); - } + if (Platform.isIOS) { + widget.onLongPress + ?.call(LatLng._fromAppleLatLng(position as appleMaps.LatLng)); + } else if (Platform.isAndroid) { + widget.onLongPress + ?.call(LatLng._fromGoogleLatLng(position as googleMaps.LatLng)); } } diff --git a/lib/src/polygon.dart b/lib/src/polygon.dart index 0da780a..843ffed 100644 --- a/lib/src/polygon.dart +++ b/lib/src/polygon.dart @@ -10,7 +10,7 @@ part of platform_maps_flutter; @immutable class PolygonId { /// Creates an immutable identifier for a [Polygon]. - PolygonId(this.value) : assert(value != null); + PolygonId(this.value); /// value of the [PolygonId]. final String value; @@ -18,7 +18,7 @@ class PolygonId { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (other.runtimeType != runtimeType) return false; + if (other is! PolygonId) return false; final PolygonId typedOther = other; return value == typedOther.value; } @@ -37,7 +37,7 @@ class PolygonId { class Polygon { /// Creates an immutable representation of a polygon through geographical locations on the map. const Polygon({ - @required this.polygonId, + required this.polygonId, this.consumeTapEvents = false, this.fillColor = Colors.black, this.points = const [], @@ -77,18 +77,18 @@ class Polygon { final int strokeWidth; /// Callbacks to receive tap events for polygon placed on this map. - final VoidCallback onTap; + final VoidCallback? onTap; /// Creates a new [Polygon] object whose values are the same as this instance, /// unless overwritten by the specified parameters. Polygon copyWith({ - bool consumeTapEventsParam, - List pointsParam, - Color strokeColorParam, - Color fillColorParam, - int strokeWidthParam, - bool visibleParam, - VoidCallback onTapParam, + bool? consumeTapEventsParam, + List? pointsParam, + Color? strokeColorParam, + Color? fillColorParam, + int? strokeWidthParam, + bool? visibleParam, + VoidCallback? onTapParam, }) { return Polygon( polygonId: polygonId, @@ -110,7 +110,7 @@ class Polygon { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (other.runtimeType != runtimeType) return false; + if (other is! Polygon) return false; final Polygon typedOther = other; return polygonId == typedOther.polygonId && consumeTapEvents == typedOther.consumeTapEvents && @@ -126,7 +126,7 @@ class Polygon { int get hashCode => polygonId.hashCode; static Set toGoogleMapsPolygonSet(Set polygons) { - List _polygons = []; + List _polygons = []; for (Polygon polygon in polygons) { _polygons.add(polygon.googleMapsPolygon); } @@ -134,7 +134,7 @@ class Polygon { } static Set toAppleMapsPolygonSet(Set polygons) { - List _polygons = []; + List _polygons = []; for (Polygon polygon in polygons) { _polygons.add(polygon.appleMapsPolygon); } diff --git a/lib/src/polyline.dart b/lib/src/polyline.dart index 929c3ec..bf3724b 100644 --- a/lib/src/polyline.dart +++ b/lib/src/polyline.dart @@ -5,7 +5,7 @@ part of platform_maps_flutter; /// This does not have to be globally unique, only unique among the list. @immutable class PolylineId { - PolylineId(this.value) : assert(value != null); + PolylineId(this.value); /// value of the [PolylineId]. final String value; @@ -27,7 +27,7 @@ class PolylineId { @immutable class Polyline { const Polyline({ - @required this.polylineId, + required this.polylineId, this.consumeTapEvents = false, this.color = Colors.black, this.polylineCap = Cap.buttCap, @@ -104,7 +104,7 @@ class Polyline { final int zIndex; /// Callbacks to receive tap events for polyline placed on this map. - final VoidCallback onTap; + final VoidCallback? onTap; static Set toGoogleMapsPolylines( Set polylines) { @@ -115,22 +115,12 @@ class Polyline { polylineId: polyline.polylineId.googleMapsPolylineId(), color: polyline.color, consumeTapEvents: polyline.consumeTapEvents, - endCap: polyline.polylineCap != null - ? _Cap.googlePolylineCap(polyline.polylineCap) - : polyline.polylineCap, - jointType: polyline.jointType != null - ? JointType.getGoogleMapsJointType(polyline.jointType) - : polyline.jointType, + endCap: _Cap.googlePolylineCap(polyline.polylineCap), + jointType: JointType.getGoogleMapsJointType(polyline.jointType), onTap: polyline.onTap, - patterns: polyline.patterns != null - ? PatternItem.getGoogleMapsPatternItemList(polyline.patterns) - : polyline.patterns, - points: polyline.points != null - ? LatLng.googleMapsLatLngsFromList(polyline.points) - : polyline.points, - startCap: polyline.polylineCap != null - ? _Cap.googlePolylineCap(polyline.polylineCap) - : polyline.polylineCap, + patterns: PatternItem.getGoogleMapsPatternItemList(polyline.patterns), + points: LatLng.googleMapsLatLngsFromList(polyline.points), + startCap: _Cap.googlePolylineCap(polyline.polylineCap), visible: polyline.visible, width: polyline.width, ), @@ -147,19 +137,11 @@ class Polyline { polylineId: polyline.polylineId.appleMapsPolylineId(), color: polyline.color, consumeTapEvents: polyline.consumeTapEvents, - polylineCap: polyline.polylineCap != null - ? _Cap.applePolylineCap(polyline.polylineCap) - : polyline.polylineCap, - jointType: polyline.jointType != null - ? JointType.getAppleMapsJointType(polyline.jointType) - : polyline.jointType, + polylineCap: _Cap.applePolylineCap(polyline.polylineCap), + jointType: JointType.getAppleMapsJointType(polyline.jointType), onTap: polyline.onTap, - patterns: polyline.patterns != null - ? PatternItem.getAppleMapsPatternItemList(polyline.patterns) - : polyline.patterns, - points: polyline.points != null - ? LatLng.appleMapsLatLngsFromList(polyline.points) - : polyline.points, + patterns: PatternItem.getAppleMapsPatternItemList(polyline.patterns), + points: LatLng.appleMapsLatLngsFromList(polyline.points), visible: polyline.visible, width: polyline.width, ), @@ -169,16 +151,16 @@ class Polyline { } Polyline copyWith({ - Color colorParam, - bool consumeTapEventsParam, - Cap polylineCapParam, - JointType jointTypeParam, - List patternsParam, - List pointsParam, - bool visibleParam, - int widthParam, - int zIndexParam, - VoidCallback onTapParam, + Color? colorParam, + bool? consumeTapEventsParam, + Cap? polylineCapParam, + JointType? jointTypeParam, + List? patternsParam, + List? pointsParam, + bool? visibleParam, + int? widthParam, + int? zIndexParam, + VoidCallback? onTapParam, }) { return Polyline( polylineId: polylineId, @@ -198,7 +180,7 @@ class Polyline { @override bool operator ==(Object other) { if (identical(this, other)) return true; - if (other.runtimeType != runtimeType) return false; + if (other is! Polyline) return false; final Polyline typedOther = other; return polylineId == typedOther.polylineId; } diff --git a/lib/src/ui.dart b/lib/src/ui.dart index 7892bf8..815c228 100644 --- a/lib/src/ui.dart +++ b/lib/src/ui.dart @@ -26,10 +26,10 @@ class MinMaxZoomPreference { static const unbounded = MinMaxZoomPreference(null, null); /// The preferred minimum zoom level or null, if unbounded from below. - final double minZoom; + final double? minZoom; /// The preferred maximum zoom level or null, if unbounded from above. - final double maxZoom; + final double? maxZoom; appleMaps.MinMaxZoomPreference get appleMapsZoomPreference => appleMaps.MinMaxZoomPreference(this.maxZoom, this.maxZoom); diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index 9fe9dba..0000000 --- a/pubspec.lock +++ /dev/null @@ -1,189 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - apple_maps_flutter: - dependency: "direct main" - description: - name: apple_maps_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.4" - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.5.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0" - fake_async: - dependency: transitive - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_plugin_android_lifecycle: - dependency: transitive - description: - name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - google_maps_flutter: - dependency: "direct main" - description: - name: google_maps_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - google_maps_flutter_platform_interface: - dependency: transitive - description: - name: google_maps_flutter_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.10" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - stream_transform: - dependency: transitive - description: - name: stream_transform - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.19" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" -sdks: - dart: ">=2.12.0-259.9.beta <3.0.0" - flutter: ">=1.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index cf6ab7d..e9e37d2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,21 +1,21 @@ name: platform_maps_flutter description: A Flutter package that combines google_maps and apple_maps to provide a crossplatform native map implementation. -version: 0.1.9+4 +version: 1.0.0 homepage: https://github.com/LuisThein repository: https://github.com/LuisThein/platform_maps_flutter issue_tracker: https://github.com/LuisThein/platform_maps_flutter/issues environment: - sdk: '>=2.6.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: sdk: flutter google_maps_flutter: ^2.0.1 - - apple_maps_flutter: ^0.1.3 + apple_maps_flutter: ^1.0.0 dev_dependencies: flutter_test: sdk: flutter + pedantic: ^1.11.0