diff --git a/.gitignore b/.gitignore index 07488ba..79c113f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,9 +5,12 @@ *.swp .DS_Store .atom/ +.build/ .buildlog/ .history .svn/ +.swiftpm/ +migrate_working_dir/ # IntelliJ related *.iml @@ -15,56 +18,28 @@ *.iws .idea/ -# Visual Studio Code related -.vscode/ +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ # Flutter/Dart/Pub related **/doc/api/ +**/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins -.packages +.flutter-plugins-dependencies .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 +# Symbolication related +app.*.symbols -# 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/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* +# Obfuscation related +app.*.map.json -# 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 +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata index 07763f7..e8f7bf9 100644 --- a/.metadata +++ b/.metadata @@ -4,7 +4,42 @@ # This file should be version controlled and should not be manually edited. version: - revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713 - channel: stable + revision: "ea121f8859e4b13e47a8f845e4586164519588bc" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: android + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: ios + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: linux + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: macos + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: web + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + - platform: windows + create_revision: ea121f8859e4b13e47a8f845e4586164519588bc + base_revision: ea121f8859e4b13e47a8f845e4586164519588bc + + # 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/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..d4a714a --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +# include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle deleted file mode 100644 index eb0b2f9..0000000 --- a/android/app/build.gradle +++ /dev/null @@ -1,83 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def keystoreProperties = new Properties() -def keystorePropertiesFile = rootProject.file('key.properties') -if (keystorePropertiesFile.exists()) { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 28 - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.yechaoa.wanandroid_flutter" - minSdkVersion 16 - targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - //配置keystore签名 - signingConfigs { - release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] - } - debug { - - } - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.release - } - debug { - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - 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/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..4ab988b --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.yechaoa.wanandroid_flutter" + compileSdk = flutter.compileSdkVersion + ndkVersion = "27.0.12077973" + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.yechaoa.com.yechaoa.wanandroid_flutter" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 98ea077..399f698 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 069364a..f618139 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,39 +1,47 @@ - - - - - + + android:networkSecurityConfig="@xml/network_security_config" + android:icon="@mipmap/ic_launcher"> - + + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> + + + + + + + + diff --git a/android/app/src/main/java/com/yechaoa/wanandroid_flutter/MainActivity.java b/android/app/src/main/java/com/yechaoa/wanandroid_flutter/MainActivity.java deleted file mode 100644 index 5668eb8..0000000 --- a/android/app/src/main/java/com/yechaoa/wanandroid_flutter/MainActivity.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.yechaoa.wanandroid_flutter; - -import android.os.Bundle; - -//import io.flutter.app.FlutterActivity; -import io.flutter.embedding.android.FlutterActivity; -import io.flutter.plugins.GeneratedPluginRegistrant; - -public class MainActivity extends FlutterActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); -// GeneratedPluginRegistrant.registerWith(this); - } -} diff --git a/android/app/src/main/kotlin/com/yechaoa/wanandroid_flutter_migrated/MainActivity.kt b/android/app/src/main/kotlin/com/yechaoa/wanandroid_flutter_migrated/MainActivity.kt new file mode 100644 index 0000000..cf62bdf --- /dev/null +++ b/android/app/src/main/kotlin/com/yechaoa/wanandroid_flutter_migrated/MainActivity.kt @@ -0,0 +1,5 @@ +package com.yechaoa.com.yechaoa.wanandroid_flutter + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml index dd2edc2..304732f 100644 --- a/android/app/src/main/res/drawable/launch_background.xml +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -4,9 +4,9 @@ - + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_logo.png b/android/app/src/main/res/mipmap-hdpi/ic_logo.png deleted file mode 100644 index 205f2be..0000000 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_logo.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_logo.png b/android/app/src/main/res/mipmap-mdpi/ic_logo.png deleted file mode 100644 index 205f2be..0000000 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_logo.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_logo.png b/android/app/src/main/res/mipmap-xhdpi/ic_logo.png deleted file mode 100644 index 18a4254..0000000 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_logo.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_logo.png b/android/app/src/main/res/mipmap-xxhdpi/ic_logo.png deleted file mode 100644 index 18a4254..0000000 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_logo.png and /dev/null differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_logo.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_logo.png deleted file mode 100644 index 8dcc85d..0000000 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_logo.png and /dev/null differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 00fa441..cb1ef88 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 98ea077..399f698 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,6 +1,6 @@ - - diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index 6bc1cb8..0000000 --- a/android/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -buildscript { - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:4.0.2' - } -} - -allprojects { - repositories { - google() - jcenter() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..89176ef --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,21 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/android/gradle.properties b/android/gradle.properties index 38c8d45..f018a61 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M -android.enableR8=true +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 493072b..afa1e8e 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#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-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip diff --git a/android/key.properties b/android/key.properties deleted file mode 100644 index 5d53ec0..0000000 --- a/android/key.properties +++ /dev/null @@ -1,4 +0,0 @@ -storeFile=../key/key.jks -storePassword=wanandroid -keyAlias=key -keyPassword=wanandroid \ No newline at end of file diff --git a/android/key/app-release.apk b/android/key/app-release.apk deleted file mode 100644 index 6dd80e4..0000000 Binary files a/android/key/app-release.apk and /dev/null differ diff --git a/android/key/key.jks b/android/key/key.jks deleted file mode 100644 index e0e7972..0000000 Binary files a/android/key/key.jks and /dev/null differ diff --git a/android/settings.gradle b/android/settings.gradle deleted file mode 100644 index 5a2f14f..0000000 --- a/android/settings.gradle +++ /dev/null @@ -1,15 +0,0 @@ -include ':app' - -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() - -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} - -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..a439442 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,25 @@ +pluginManagement { + val flutterSdkPath = run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.7.0" apply false + id("org.jetbrains.kotlin.android") version "1.8.22" apply false +} + +include(":app") diff --git a/apk/app-debug.apk b/apk/app-debug.apk deleted file mode 100644 index ce87f49..0000000 Binary files a/apk/app-debug.apk and /dev/null differ diff --git a/ios/.gitignore b/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.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/ephemeral/ +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/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 9367d48..7c56964 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 12.0 diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index e8efba1..592ceee 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1,2 +1 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 399e934..592ceee 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1,2 +1 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 5c04902..e1fb9e2 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,25 +3,29 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; - 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 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 */; }; - CFDE286101354ACCBF217CBB /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 30C0E338984CB2127D600CCE /* libPods-Runner.a */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -29,8 +33,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -40,24 +42,19 @@ /* 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 = ""; }; - 30C0E338984CB2127D600CCE /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; 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 = ""; }; - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 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 = ""; }; - A0D973F11A966E2A09EF88E1 /* 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 = ""; }; - C063F1400C00DD4CE12322E9 /* 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 = ""; }; - D9D767BD61D2BB5E9ACEB4EE /* 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 = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -65,32 +62,24 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, - CFDE286101354ACCBF217CBB /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 59DD1ED042B4779DABD37ACA /* Pods */ = { + 331C8082294A63A400263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( - D9D767BD61D2BB5E9ACEB4EE /* Pods-Runner.debug.xcconfig */, - C063F1400C00DD4CE12322E9 /* Pods-Runner.release.xcconfig */, - A0D973F11A966E2A09EF88E1 /* Pods-Runner.profile.xcconfig */, + 331C807B294A618700263BE5 /* RunnerTests.swift */, ); - name = Pods; - path = Pods; + path = RunnerTests; sourceTree = ""; }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -104,8 +93,7 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - 59DD1ED042B4779DABD37ACA /* Pods */, - D0388B85A9E20FB9C2C4466A /* Frameworks */, + 331C8082294A63A400263BE5 /* RunnerTests */, ); sourceTree = ""; }; @@ -113,6 +101,7 @@ isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, ); name = Products; sourceTree = ""; @@ -120,50 +109,48 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( - 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, - 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, ); path = Runner; sourceTree = ""; }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 97C146F21CF9000F007C117D /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - D0388B85A9E20FB9C2C4466A /* Frameworks */ = { - isa = PBXGroup; - children = ( - 30C0E338984CB2127D600CCE /* libPods-Runner.a */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 97C146ED1CF9000F007C117D /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - AC244829656E7ABF2B3DEF66 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - F25008AE419C7212316F07DB /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -180,17 +167,23 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0910; - ORGANIZATIONNAME = "The Chromium Authors"; + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -202,18 +195,25 @@ projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EC1CF9000F007C117D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; 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 */, ); @@ -224,20 +224,23 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -250,58 +253,36 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - AC244829656E7ABF2B3DEF66 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, ); 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; }; - F25008AE419C7212316F07DB /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ 97C146EA1CF9000F007C117D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, - 97C146F31CF9000F007C117D /* main.m in Sources */, + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -324,9 +305,9 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -336,12 +317,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -354,6 +337,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -362,9 +346,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 = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -375,30 +360,74 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = S8QB4VV633; 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 = ( + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", + "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.yechaoa.wanandroidFlutter; + PRODUCT_BUNDLE_IDENTIFIER = com.yechaoa.wanandroidFlutterMigrated; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.yechaoa.wanandroidFlutterMigrated.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.yechaoa.wanandroidFlutterMigrated.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.yechaoa.wanandroidFlutterMigrated.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -408,12 +437,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -426,6 +457,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -440,7 +472,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 = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -450,9 +482,9 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -462,12 +494,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -480,6 +514,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -488,9 +523,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; @@ -501,20 +539,19 @@ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 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 = ( + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", + "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.yechaoa.wanandroidFlutter; + PRODUCT_BUNDLE_IDENTIFIER = com.yechaoa.wanandroidFlutterMigrated; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -524,20 +561,18 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 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 = ( + LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/Flutter", + "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.yechaoa.wanandroidFlutter; + PRODUCT_BUNDLE_IDENTIFIER = com.yechaoa.wanandroidFlutterMigrated; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; @@ -545,6 +580,16 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 786d6aa..15cada4 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - - - + + + + + + @@ -63,8 +71,6 @@ ReferencedContainer = "container:Runner.xcodeproj"> - - - - diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner/AppDelegate.h b/ios/Runner/AppDelegate.h deleted file mode 100644 index 36e21bb..0000000 --- a/ios/Runner/AppDelegate.h +++ /dev/null @@ -1,6 +0,0 @@ -#import -#import - -@interface AppDelegate : FlutterAppDelegate - -@end diff --git a/ios/Runner/AppDelegate.m b/ios/Runner/AppDelegate.m deleted file mode 100644 index 59a72e9..0000000 --- a/ios/Runner/AppDelegate.m +++ /dev/null @@ -1,13 +0,0 @@ -#include "AppDelegate.h" -#include "GeneratedPluginRegistrant.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application - didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - [GeneratedPluginRegistrant registerWithRegistry:self]; - // Override point for customization after application launch. - return [super application:application didFinishLaunchingWithOptions:launchOptions]; -} - -@end diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..6266644 --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png index 3d43d11..dc9ada4 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png index 28c6bf0..7353c41 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png index 2ccbfd9..797d452 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png index f091b6b..6ed2d93 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png index 4cde121..4cd7b00 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png index d0ef06e..fe73094 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png index dcdc230..321773c 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png index 2ccbfd9..797d452 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png index c8f9ed8..502f463 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png index a6d6b86..0ec3034 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png index a6d6b86..0ec3034 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png index 75b2d16..e9f5fea 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png index c4df70d..84ac32a 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png index 6a84f41..8953cba 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png index d0e1f58..0467bf1 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 705d072..a9e88bb 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -3,7 +3,9 @@ CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Wanandroid Flutter Migrated CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -11,7 +13,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - 玩安卓 + wanandroid_flutter CFBundlePackageType APPL CFBundleShortVersionString @@ -39,7 +41,9 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UIViewControllerBasedStatusBarAppearance - + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/ios/Runner/main.m b/ios/Runner/main.m deleted file mode 100644 index dff6597..0000000 --- a/ios/Runner/main.m +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import -#import "AppDelegate.h" - -int main(int argc, char* argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/ios/RunnerTests/RunnerTests.swift b/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/lib/entity/article_entity.dart b/lib/entity/article_entity.dart index 3632dc9..6904522 100644 --- a/lib/entity/article_entity.dart +++ b/lib/entity/article_entity.dart @@ -1,153 +1,185 @@ class ArticleEntity { - ArticleData data; - int errorCode; - String errorMsg; + ArticleData? data; + int? errorCode; + String? errorMsg; - ArticleEntity({this.data, this.errorCode, this.errorMsg}); + ArticleEntity({this.data, this.errorCode, this.errorMsg}); - ArticleEntity.fromJson(Map json) { - data = json['data'] != null ? new ArticleData.fromJson(json['data']) : null; - errorCode = json['errorCode']; - errorMsg = json['errorMsg']; - } + ArticleEntity.fromJson(Map json) { + data = json['data'] != null ? ArticleData.fromJson(json['data']) : null; + errorCode = json['errorCode']; + errorMsg = json['errorMsg']; + } - Map toJson() { - final Map data = new Map(); - if (this.data != null) { - data['data'] = this.data.toJson(); + Map toJson() { + final Map data = {}; + if (this.data != null) { + data['data'] = this.data!.toJson(); } - data['errorCode'] = this.errorCode; - data['errorMsg'] = this.errorMsg; - return data; - } + data['errorCode'] = this.errorCode; + data['errorMsg'] = this.errorMsg; + return data; + } } class ArticleData { - bool over; - int pageCount; - int total; - int curPage; - int offset; - int size; - List datas; + bool? over; + int? pageCount; + int? total; + int? curPage; + int? offset; + int? size; + List datas = []; - ArticleData({this.over, this.pageCount, this.total, this.curPage, this.offset, this.size, this.datas}); - - ArticleData.fromJson(Map json) { - over = json['over']; - pageCount = json['pageCount']; - total = json['total']; - curPage = json['curPage']; - offset = json['offset']; - size = json['size']; - if (json['datas'] != null) { - datas = new List();(json['datas'] as List).forEach((v) { datas.add(new ArticleDataData.fromJson(v)); }); - } - } + ArticleData({this.over, this.pageCount, this.total, this.curPage, this.offset, this.size, List? datas}) { + if (datas != null) { + this.datas = datas; + } + } - Map toJson() { - final Map data = new Map(); - data['over'] = this.over; - data['pageCount'] = this.pageCount; - data['total'] = this.total; - data['curPage'] = this.curPage; - data['offset'] = this.offset; - data['size'] = this.size; - if (this.datas != null) { - data['datas'] = this.datas.map((v) => v.toJson()).toList(); + ArticleData.fromJson(Map json) { + over = json['over']; + pageCount = json['pageCount']; + total = json['total']; + curPage = json['curPage']; + offset = json['offset']; + size = json['size']; + if (json['datas'] != null) { + (json['datas'] as List).forEach((v) { + datas.add(ArticleDataData.fromJson(v)); + }); } - return data; - } + } + + Map toJson() { + final Map data = {}; + data['over'] = this.over; + data['pageCount'] = this.pageCount; + data['total'] = this.total; + data['curPage'] = this.curPage; + data['offset'] = this.offset; + data['size'] = this.size; + data['datas'] = this.datas.map((v) => v.toJson()).toList(); + return data; + } } class ArticleDataData { - String superChapterName; - int publishTime; - int visible; - String niceDate; - String projectLink; - String author; - String prefix; - int zan; - String origin; - String chapterName; - String link; - String title; - int type; - int userId; - List tags; - String apkLink; - String envelopePic; - int chapterId; - int superChapterId; - int id; - int originId; - bool fresh; - bool collect; - int courseId; - String desc; + String? superChapterName; + int? publishTime; + int? visible; + String? niceDate; + String? projectLink; + String? author; + String? prefix; + int? zan; + String? origin; + String? chapterName; + String? link; + String? title; + int? type; + int? userId; + List tags = []; + String? apkLink; + String? envelopePic; + int? chapterId; + int? superChapterId; + int? id; + int? originId; + bool? fresh; + bool? collect; + int? courseId; + String? desc; - ArticleDataData({this.superChapterName, this.publishTime, this.visible, this.niceDate, this.projectLink, this.author, this.prefix, this.zan, this.origin, this.chapterName, this.link, this.title, this.type, this.userId, this.tags, this.apkLink, this.envelopePic, this.chapterId, this.superChapterId, this.id,this.originId, this.fresh, this.collect, this.courseId, this.desc}); - - ArticleDataData.fromJson(Map json) { - superChapterName = json['superChapterName']; - publishTime = json['publishTime']; - visible = json['visible']; - niceDate = json['niceDate']; - projectLink = json['projectLink']; - author = json['author']; - prefix = json['prefix']; - zan = json['zan']; - origin = json['origin']; - chapterName = json['chapterName']; - link = json['link']; - title = json['title']; - type = json['type']; - userId = json['userId']; - if (json['tags'] != null) { - tags = new List(); - } - apkLink = json['apkLink']; - envelopePic = json['envelopePic']; - chapterId = json['chapterId']; - superChapterId = json['superChapterId']; - id = json['id']; - originId = json['originId']; - fresh = json['fresh']; - collect = json['collect']; - courseId = json['courseId']; - desc = json['desc']; - } + ArticleDataData({ + this.superChapterName, + this.publishTime, + this.visible, + this.niceDate, + this.projectLink, + this.author, + this.prefix, + this.zan, + this.origin, + this.chapterName, + this.link, + this.title, + this.type, + this.userId, + List? tags, + this.apkLink, + this.envelopePic, + this.chapterId, + this.superChapterId, + this.id, + this.originId, + this.fresh, + this.collect, + this.courseId, + this.desc, + }) { + if (tags != null) { + this.tags = tags; + } + } - Map toJson() { - final Map data = new Map(); - data['superChapterName'] = this.superChapterName; - data['publishTime'] = this.publishTime; - data['visible'] = this.visible; - data['niceDate'] = this.niceDate; - data['projectLink'] = this.projectLink; - data['author'] = this.author; - data['prefix'] = this.prefix; - data['zan'] = this.zan; - data['origin'] = this.origin; - data['chapterName'] = this.chapterName; - data['link'] = this.link; - data['title'] = this.title; - data['type'] = this.type; - data['userId'] = this.userId; - if (this.tags != null) { - data['tags'] = []; + ArticleDataData.fromJson(Map json) { + superChapterName = json['superChapterName']; + publishTime = json['publishTime']; + visible = json['visible']; + niceDate = json['niceDate']; + projectLink = json['projectLink']; + author = json['author']; + prefix = json['prefix']; + zan = json['zan']; + origin = json['origin']; + chapterName = json['chapterName']; + link = json['link']; + title = json['title']; + type = json['type']; + userId = json['userId']; + if (json['tags'] != null) { + tags = []; } - data['apkLink'] = this.apkLink; - data['envelopePic'] = this.envelopePic; - data['chapterId'] = this.chapterId; - data['superChapterId'] = this.superChapterId; - data['id'] = this.id; - data['originId'] = this.originId; - data['fresh'] = this.fresh; - data['collect'] = this.collect; - data['courseId'] = this.courseId; - data['desc'] = this.desc; - return data; - } + apkLink = json['apkLink']; + envelopePic = json['envelopePic']; + chapterId = json['chapterId']; + superChapterId = json['superChapterId']; + id = json['id']; + originId = json['originId']; + fresh = json['fresh']; + collect = json['collect']; + courseId = json['courseId']; + desc = json['desc']; + } + + Map toJson() { + final Map data = {}; + data['superChapterName'] = this.superChapterName; + data['publishTime'] = this.publishTime; + data['visible'] = this.visible; + data['niceDate'] = this.niceDate; + data['projectLink'] = this.projectLink; + data['author'] = this.author; + data['prefix'] = this.prefix; + data['zan'] = this.zan; + data['origin'] = this.origin; + data['chapterName'] = this.chapterName; + data['link'] = this.link; + data['title'] = this.title; + data['type'] = this.type; + data['userId'] = this.userId; + data['tags'] = []; + data['apkLink'] = this.apkLink; + data['envelopePic'] = this.envelopePic; + data['chapterId'] = this.chapterId; + data['superChapterId'] = this.superChapterId; + data['id'] = this.id; + data['originId'] = this.originId; + data['fresh'] = this.fresh; + data['collect'] = this.collect; + data['courseId'] = this.courseId; + data['desc'] = this.desc; + return data; + } } diff --git a/lib/entity/banner_entity.dart b/lib/entity/banner_entity.dart index 3a9f2db..fa81e2e 100644 --- a/lib/entity/banner_entity.dart +++ b/lib/entity/banner_entity.dart @@ -1,62 +1,75 @@ class BannerEntity { - List data; - int errorCode; - String errorMsg; + List data = []; + int? errorCode; + String? errorMsg; - BannerEntity({this.data, this.errorCode, this.errorMsg}); - - BannerEntity.fromJson(Map json) { - if (json['data'] != null) { - data = new List();(json['data'] as List).forEach((v) { data.add(new BannerData.fromJson(v)); }); - } - errorCode = json['errorCode']; - errorMsg = json['errorMsg']; - } + BannerEntity({List? data, this.errorCode, this.errorMsg}) { + if (data != null) { + this.data = data; + } + } - Map toJson() { - final Map data = new Map(); - if (this.data != null) { - data['data'] = this.data.map((v) => v.toJson()).toList(); + BannerEntity.fromJson(Map json) { + if (json['data'] != null) { + (json['data'] as List).forEach((v) { + data.add(BannerData.fromJson(v)); + }); } - data['errorCode'] = this.errorCode; - data['errorMsg'] = this.errorMsg; - return data; - } + errorCode = json['errorCode']; + errorMsg = json['errorMsg']; + } + + Map toJson() { + final Map data = {}; + data['data'] = this.data.map((v) => v.toJson()).toList(); + data['errorCode'] = this.errorCode; + data['errorMsg'] = this.errorMsg; + return data; + } } class BannerData { - String imagePath; - int id; - int isVisible; - String title; - int type; - String url; - String desc; - int order; + String? imagePath; + int? id; + int? isVisible; + String? title; + int? type; + String? url; + String? desc; + int? order; - BannerData({this.imagePath, this.id, this.isVisible, this.title, this.type, this.url, this.desc, this.order}); + BannerData({ + this.imagePath, + this.id, + this.isVisible, + this.title, + this.type, + this.url, + this.desc, + this.order, + }); - BannerData.fromJson(Map json) { - imagePath = json['imagePath']; - id = json['id']; - isVisible = json['isVisible']; - title = json['title']; - type = json['type']; - url = json['url']; - desc = json['desc']; - order = json['order']; - } + BannerData.fromJson(Map json) { + imagePath = json['imagePath']; + id = json['id']; + isVisible = json['isVisible']; + title = json['title']; + type = json['type']; + url = json['url']; + desc = json['desc']; + order = json['order']; + } - Map toJson() { - final Map data = new Map(); - data['imagePath'] = this.imagePath; - data['id'] = this.id; - data['isVisible'] = this.isVisible; - data['title'] = this.title; - data['type'] = this.type; - data['url'] = this.url; - data['desc'] = this.desc; - data['order'] = this.order; - return data; - } + Map toJson() { + final Map data = {}; + data['imagePath'] = this.imagePath; + data['id'] = this.id; + data['isVisible'] = this.isVisible; + data['title'] = this.title; + data['type'] = this.type; + data['url'] = this.url; + data['desc'] = this.desc; + data['order'] = this.order; + return data; + } } diff --git a/lib/entity/common_entity.dart b/lib/entity/common_entity.dart index 804b7fd..f90d773 100644 --- a/lib/entity/common_entity.dart +++ b/lib/entity/common_entity.dart @@ -1,9 +1,9 @@ -class CommonEntity { +class CommonEntity { dynamic data; - int errorCode; - String errorMsg; + late int errorCode; + late String errorMsg; - CommonEntity({this.data, this.errorCode, this.errorMsg}); + CommonEntity({this.data, required this.errorCode, required this.errorMsg}); CommonEntity.fromJson(Map json) { data = json['data']; diff --git a/lib/entity/hot_key_entity.dart b/lib/entity/hot_key_entity.dart index c09735a..11b84e3 100644 --- a/lib/entity/hot_key_entity.dart +++ b/lib/entity/hot_key_entity.dart @@ -1,53 +1,57 @@ class HotKeyEntity { - List data; - int errorCode; - String errorMsg; + List data = []; + int? errorCode; + String? errorMsg; - HotKeyEntity({this.data, this.errorCode, this.errorMsg}); - - HotKeyEntity.fromJson(Map json) { - if (json['data'] != null) { - data = new List();(json['data'] as List).forEach((v) { data.add(new HotKeyData.fromJson(v)); }); - } - errorCode = json['errorCode']; - errorMsg = json['errorMsg']; - } + HotKeyEntity({List? data, this.errorCode, this.errorMsg}) { + if (data != null) { + this.data = data; + } + } - Map toJson() { - final Map data = new Map(); - if (this.data != null) { - data['data'] = this.data.map((v) => v.toJson()).toList(); + HotKeyEntity.fromJson(Map json) { + if (json['data'] != null) { + (json['data'] as List).forEach((v) { + data.add(HotKeyData.fromJson(v)); + }); } - data['errorCode'] = this.errorCode; - data['errorMsg'] = this.errorMsg; - return data; - } + errorCode = json['errorCode']; + errorMsg = json['errorMsg']; + } + + Map toJson() { + final Map data = {}; + data['data'] = this.data.map((v) => v.toJson()).toList(); + data['errorCode'] = this.errorCode; + data['errorMsg'] = this.errorMsg; + return data; + } } class HotKeyData { - int visible; - String link; - String name; - int id; - int order; + int? visible; + String? link; + String? name; + int? id; + int? order; - HotKeyData({this.visible, this.link, this.name, this.id, this.order}); + HotKeyData({this.visible, this.link, this.name, this.id, this.order}); - HotKeyData.fromJson(Map json) { - visible = json['visible']; - link = json['link']; - name = json['name']; - id = json['id']; - order = json['order']; - } + HotKeyData.fromJson(Map json) { + visible = json['visible']; + link = json['link']; + name = json['name']; + id = json['id']; + order = json['order']; + } - Map toJson() { - final Map data = new Map(); - data['visible'] = this.visible; - data['link'] = this.link; - data['name'] = this.name; - data['id'] = this.id; - data['order'] = this.order; - return data; - } + Map toJson() { + final Map data = {}; + data['visible'] = this.visible; + data['link'] = this.link; + data['name'] = this.name; + data['id'] = this.id; + data['order'] = this.order; + return data; + } } diff --git a/lib/entity/navi_entity.dart b/lib/entity/navi_entity.dart index 2dd3a91..afb942a 100644 --- a/lib/entity/navi_entity.dart +++ b/lib/entity/navi_entity.dart @@ -1,140 +1,175 @@ class NaviEntity { - List data; - int errorCode; - String errorMsg; + List data = []; + int? errorCode; + String? errorMsg; - NaviEntity({this.data, this.errorCode, this.errorMsg}); - - NaviEntity.fromJson(Map json) { - if (json['data'] != null) { - data = new List();(json['data'] as List).forEach((v) { data.add(new NaviData.fromJson(v)); }); - } - errorCode = json['errorCode']; - errorMsg = json['errorMsg']; - } + NaviEntity({List? data, this.errorCode, this.errorMsg}) { + if (data != null) { + this.data = data; + } + } - Map toJson() { - final Map data = new Map(); - if (this.data != null) { - data['data'] = this.data.map((v) => v.toJson()).toList(); + NaviEntity.fromJson(Map json) { + if (json['data'] != null) { + (json['data'] as List).forEach((v) { + data.add(NaviData.fromJson(v)); + }); } - data['errorCode'] = this.errorCode; - data['errorMsg'] = this.errorMsg; - return data; - } + errorCode = json['errorCode']; + errorMsg = json['errorMsg']; + } + + Map toJson() { + final Map data = {}; + data['data'] = this.data.map((v) => v.toJson()).toList(); + data['errorCode'] = this.errorCode; + data['errorMsg'] = this.errorMsg; + return data; + } } class NaviData { - String name; - List articles; - int cid; + String? name; + List articles = []; + int? cid; - NaviData({this.name, this.articles, this.cid}); - - NaviData.fromJson(Map json) { - name = json['name']; - if (json['articles'] != null) { - articles = new List();(json['articles'] as List).forEach((v) { articles.add(new NaviDataArticle.fromJson(v)); }); - } - cid = json['cid']; - } + NaviData({this.name, List? articles, this.cid}) { + if (articles != null) { + this.articles = articles; + } + } - Map toJson() { - final Map data = new Map(); - data['name'] = this.name; - if (this.articles != null) { - data['articles'] = this.articles.map((v) => v.toJson()).toList(); + NaviData.fromJson(Map json) { + name = json['name']; + if (json['articles'] != null) { + (json['articles'] as List).forEach((v) { + articles.add(NaviDataArticle.fromJson(v)); + }); } - data['cid'] = this.cid; - return data; - } + cid = json['cid']; + } + + Map toJson() { + final Map data = {}; + data['name'] = this.name; + data['articles'] = this.articles.map((v) => v.toJson()).toList(); + data['cid'] = this.cid; + return data; + } } class NaviDataArticle { - String superChapterName; - int publishTime; - int visible; - String niceDate; - String projectLink; - String author; - String prefix; - int zan; - String origin; - String chapterName; - String link; - String title; - int type; - int userId; - List tags; - String apkLink; - String envelopePic; - int chapterId; - int superChapterId; - int id; - bool fresh; - bool collect; - int courseId; - String desc; - - NaviDataArticle({this.superChapterName, this.publishTime, this.visible, this.niceDate, this.projectLink, this.author, this.prefix, this.zan, this.origin, this.chapterName, this.link, this.title, this.type, this.userId, this.tags, this.apkLink, this.envelopePic, this.chapterId, this.superChapterId, this.id, this.fresh, this.collect, this.courseId, this.desc}); + String? superChapterName; + int? publishTime; + int? visible; + String? niceDate; + String? projectLink; + String? author; + String? prefix; + int? zan; + String? origin; + String? chapterName; + String? link; + String? title; + int? type; + int? userId; + List tags = []; + String? apkLink; + String? envelopePic; + int? chapterId; + int? superChapterId; + int? id; + bool? fresh; + bool? collect; + int? courseId; + String? desc; - NaviDataArticle.fromJson(Map json) { - superChapterName = json['superChapterName']; - publishTime = json['publishTime']; - visible = json['visible']; - niceDate = json['niceDate']; - projectLink = json['projectLink']; - author = json['author']; - prefix = json['prefix']; - zan = json['zan']; - origin = json['origin']; - chapterName = json['chapterName']; - link = json['link']; - title = json['title']; - type = json['type']; - userId = json['userId']; - if (json['tags'] != null) { - tags = new List(); - } - apkLink = json['apkLink']; - envelopePic = json['envelopePic']; - chapterId = json['chapterId']; - superChapterId = json['superChapterId']; - id = json['id']; - fresh = json['fresh']; - collect = json['collect']; - courseId = json['courseId']; - desc = json['desc']; - } + NaviDataArticle({ + this.superChapterName, + this.publishTime, + this.visible, + this.niceDate, + this.projectLink, + this.author, + this.prefix, + this.zan, + this.origin, + this.chapterName, + this.link, + this.title, + this.type, + this.userId, + List? tags, + this.apkLink, + this.envelopePic, + this.chapterId, + this.superChapterId, + this.id, + this.fresh, + this.collect, + this.courseId, + this.desc, + }) { + if (tags != null) { + this.tags = tags; + } + } - Map toJson() { - final Map data = new Map(); - data['superChapterName'] = this.superChapterName; - data['publishTime'] = this.publishTime; - data['visible'] = this.visible; - data['niceDate'] = this.niceDate; - data['projectLink'] = this.projectLink; - data['author'] = this.author; - data['prefix'] = this.prefix; - data['zan'] = this.zan; - data['origin'] = this.origin; - data['chapterName'] = this.chapterName; - data['link'] = this.link; - data['title'] = this.title; - data['type'] = this.type; - data['userId'] = this.userId; - if (this.tags != null) { - data['tags'] = []; + NaviDataArticle.fromJson(Map json) { + superChapterName = json['superChapterName']; + publishTime = json['publishTime']; + visible = json['visible']; + niceDate = json['niceDate']; + projectLink = json['projectLink']; + author = json['author']; + prefix = json['prefix']; + zan = json['zan']; + origin = json['origin']; + chapterName = json['chapterName']; + link = json['link']; + title = json['title']; + type = json['type']; + userId = json['userId']; + if (json['tags'] != null) { + tags = []; } - data['apkLink'] = this.apkLink; - data['envelopePic'] = this.envelopePic; - data['chapterId'] = this.chapterId; - data['superChapterId'] = this.superChapterId; - data['id'] = this.id; - data['fresh'] = this.fresh; - data['collect'] = this.collect; - data['courseId'] = this.courseId; - data['desc'] = this.desc; - return data; - } + apkLink = json['apkLink']; + envelopePic = json['envelopePic']; + chapterId = json['chapterId']; + superChapterId = json['superChapterId']; + id = json['id']; + fresh = json['fresh']; + collect = json['collect']; + courseId = json['courseId']; + desc = json['desc']; + } + + Map toJson() { + final Map data = {}; + data['superChapterName'] = this.superChapterName; + data['publishTime'] = this.publishTime; + data['visible'] = this.visible; + data['niceDate'] = this.niceDate; + data['projectLink'] = this.projectLink; + data['author'] = this.author; + data['prefix'] = this.prefix; + data['zan'] = this.zan; + data['origin'] = this.origin; + data['chapterName'] = this.chapterName; + data['link'] = this.link; + data['title'] = this.title; + data['type'] = this.type; + data['userId'] = this.userId; + data['tags'] = []; + data['apkLink'] = this.apkLink; + data['envelopePic'] = this.envelopePic; + data['chapterId'] = this.chapterId; + data['superChapterId'] = this.superChapterId; + data['id'] = this.id; + data['fresh'] = this.fresh; + data['collect'] = this.collect; + data['courseId'] = this.courseId; + data['desc'] = this.desc; + return data; + } } diff --git a/lib/entity/project_entity.dart b/lib/entity/project_entity.dart index f4fa6dd..475868b 100644 --- a/lib/entity/project_entity.dart +++ b/lib/entity/project_entity.dart @@ -1,66 +1,81 @@ class ProjectEntity { - List data; - int errorCode; - String errorMsg; + List data = []; + int? errorCode; + String? errorMsg; - ProjectEntity({this.data, this.errorCode, this.errorMsg}); - - ProjectEntity.fromJson(Map json) { - if (json['data'] != null) { - data = new List();(json['data'] as List).forEach((v) { data.add(new ProjectData.fromJson(v)); }); - } - errorCode = json['errorCode']; - errorMsg = json['errorMsg']; - } + ProjectEntity({List? data, this.errorCode, this.errorMsg}) { + if (data != null) { + this.data = data; + } + } - Map toJson() { - final Map data = new Map(); - if (this.data != null) { - data['data'] = this.data.map((v) => v.toJson()).toList(); + ProjectEntity.fromJson(Map json) { + if (json['data'] != null) { + (json['data'] as List).forEach((v) { + data.add(ProjectData.fromJson(v)); + }); } - data['errorCode'] = this.errorCode; - data['errorMsg'] = this.errorMsg; - return data; - } + errorCode = json['errorCode']; + errorMsg = json['errorMsg']; + } + + Map toJson() { + final Map data = {}; + data['data'] = this.data.map((v) => v.toJson()).toList(); + data['errorCode'] = this.errorCode; + data['errorMsg'] = this.errorMsg; + return data; + } } class ProjectData { - int visible; - List children; - String name; - bool userControlSetTop; - int id; - int courseId; - int parentChapterId; - int order; + int? visible; + List children = []; + String? name; + bool? userControlSetTop; + int? id; + int? courseId; + int? parentChapterId; + int? order; - ProjectData({this.visible, this.children, this.name, this.userControlSetTop, this.id, this.courseId, this.parentChapterId, this.order}); - - ProjectData.fromJson(Map json) { - visible = json['visible']; - if (json['children'] != null) { - children = new List(); - } - name = json['name']; - userControlSetTop = json['userControlSetTop']; - id = json['id']; - courseId = json['courseId']; - parentChapterId = json['parentChapterId']; - order = json['order']; - } + ProjectData({ + this.visible, + List? children, + this.name, + this.userControlSetTop, + this.id, + this.courseId, + this.parentChapterId, + this.order, + }) { + if (children != null) { + this.children = children; + } + } - Map toJson() { - final Map data = new Map(); - data['visible'] = this.visible; - if (this.children != null) { - data['children'] = []; + ProjectData.fromJson(Map json) { + visible = json['visible']; + if (json['children'] != null) { + children = []; } - data['name'] = this.name; - data['userControlSetTop'] = this.userControlSetTop; - data['id'] = this.id; - data['courseId'] = this.courseId; - data['parentChapterId'] = this.parentChapterId; - data['order'] = this.order; - return data; - } + name = json['name']; + userControlSetTop = json['userControlSetTop']; + id = json['id']; + courseId = json['courseId']; + parentChapterId = json['parentChapterId']; + order = json['order']; + } + + Map toJson() { + final Map data = {}; + data['visible'] = this.visible; + data['children'] = []; + data['name'] = this.name; + data['userControlSetTop'] = this.userControlSetTop; + data['id'] = this.id; + data['courseId'] = this.courseId; + data['parentChapterId'] = this.parentChapterId; + data['order'] = this.order; + return data; + } } diff --git a/lib/entity/project_list_entity.dart b/lib/entity/project_list_entity.dart index d6ee021..8f2a012 100644 --- a/lib/entity/project_list_entity.dart +++ b/lib/entity/project_list_entity.dart @@ -1,169 +1,202 @@ class ProjectListEntity { - ProjectListData data; - int errorCode; - String errorMsg; + ProjectListData? data; + int? errorCode; + String? errorMsg; - ProjectListEntity({this.data, this.errorCode, this.errorMsg}); + ProjectListEntity({this.data, this.errorCode, this.errorMsg}); - ProjectListEntity.fromJson(Map json) { - data = json['data'] != null ? new ProjectListData.fromJson(json['data']) : null; - errorCode = json['errorCode']; - errorMsg = json['errorMsg']; - } + ProjectListEntity.fromJson(Map json) { + data = json['data'] != null ? ProjectListData.fromJson(json['data']) : null; + errorCode = json['errorCode']; + errorMsg = json['errorMsg']; + } - Map toJson() { - final Map data = new Map(); - if (this.data != null) { - data['data'] = this.data.toJson(); + Map toJson() { + final Map data = {}; + if (this.data != null) { + data['data'] = this.data!.toJson(); } - data['errorCode'] = this.errorCode; - data['errorMsg'] = this.errorMsg; - return data; - } + data['errorCode'] = this.errorCode; + data['errorMsg'] = this.errorMsg; + return data; + } } class ProjectListData { - bool over; - int pageCount; - int total; - int curPage; - int offset; - int size; - List datas; + bool? over; + int? pageCount; + int? total; + int? curPage; + int? offset; + int? size; + List datas = []; - ProjectListData({this.over, this.pageCount, this.total, this.curPage, this.offset, this.size, this.datas}); - - ProjectListData.fromJson(Map json) { - over = json['over']; - pageCount = json['pageCount']; - total = json['total']; - curPage = json['curPage']; - offset = json['offset']; - size = json['size']; - if (json['datas'] != null) { - datas = new List();(json['datas'] as List).forEach((v) { datas.add(new ProjectListDataData.fromJson(v)); }); - } - } + ProjectListData({this.over, this.pageCount, this.total, this.curPage, this.offset, this.size, List? datas}) { + if (datas != null) { + this.datas = datas; + } + } - Map toJson() { - final Map data = new Map(); - data['over'] = this.over; - data['pageCount'] = this.pageCount; - data['total'] = this.total; - data['curPage'] = this.curPage; - data['offset'] = this.offset; - data['size'] = this.size; - if (this.datas != null) { - data['datas'] = this.datas.map((v) => v.toJson()).toList(); + ProjectListData.fromJson(Map json) { + over = json['over']; + pageCount = json['pageCount']; + total = json['total']; + curPage = json['curPage']; + offset = json['offset']; + size = json['size']; + if (json['datas'] != null) { + (json['datas'] as List).forEach((v) { + datas.add(ProjectListDataData.fromJson(v)); + }); } - return data; - } + } + + Map toJson() { + final Map data = {}; + data['over'] = this.over; + data['pageCount'] = this.pageCount; + data['total'] = this.total; + data['curPage'] = this.curPage; + data['offset'] = this.offset; + data['size'] = this.size; + data['datas'] = this.datas.map((v) => v.toJson()).toList(); + return data; + } } class ProjectListDataData { - String superChapterName; - int publishTime; - int visible; - String niceDate; - String projectLink; - String author; - String prefix; - int zan; - String origin; - String chapterName; - String link; - String title; - int type; - int userId; - List tags; - String apkLink; - String envelopePic; - int chapterId; - int superChapterId; - int id; - bool fresh; - bool collect; - int courseId; - String desc; + String? superChapterName; + int? publishTime; + int? visible; + String? niceDate; + String? projectLink; + String? author; + String? prefix; + int? zan; + String? origin; + String? chapterName; + String? link; + String? title; + int? type; + int? userId; + List tags = []; + String? apkLink; + String? envelopePic; + int? chapterId; + int? superChapterId; + int? id; + bool? fresh; + bool? collect; + int? courseId; + String? desc; - ProjectListDataData({this.superChapterName, this.publishTime, this.visible, this.niceDate, this.projectLink, this.author, this.prefix, this.zan, this.origin, this.chapterName, this.link, this.title, this.type, this.userId, this.tags, this.apkLink, this.envelopePic, this.chapterId, this.superChapterId, this.id, this.fresh, this.collect, this.courseId, this.desc}); - - ProjectListDataData.fromJson(Map json) { - superChapterName = json['superChapterName']; - publishTime = json['publishTime']; - visible = json['visible']; - niceDate = json['niceDate']; - projectLink = json['projectLink']; - author = json['author']; - prefix = json['prefix']; - zan = json['zan']; - origin = json['origin']; - chapterName = json['chapterName']; - link = json['link']; - title = json['title']; - type = json['type']; - userId = json['userId']; - if (json['tags'] != null) { - tags = new List();(json['tags'] as List).forEach((v) { tags.add(new ProjectListDataDatasTag.fromJson(v)); }); - } - apkLink = json['apkLink']; - envelopePic = json['envelopePic']; - chapterId = json['chapterId']; - superChapterId = json['superChapterId']; - id = json['id']; - fresh = json['fresh']; - collect = json['collect']; - courseId = json['courseId']; - desc = json['desc']; - } + ProjectListDataData({ + this.superChapterName, + this.publishTime, + this.visible, + this.niceDate, + this.projectLink, + this.author, + this.prefix, + this.zan, + this.origin, + this.chapterName, + this.link, + this.title, + this.type, + this.userId, + List? tags, + this.apkLink, + this.envelopePic, + this.chapterId, + this.superChapterId, + this.id, + this.fresh, + this.collect, + this.courseId, + this.desc, + }) { + if (tags != null) { + this.tags = tags; + } + } - Map toJson() { - final Map data = new Map(); - data['superChapterName'] = this.superChapterName; - data['publishTime'] = this.publishTime; - data['visible'] = this.visible; - data['niceDate'] = this.niceDate; - data['projectLink'] = this.projectLink; - data['author'] = this.author; - data['prefix'] = this.prefix; - data['zan'] = this.zan; - data['origin'] = this.origin; - data['chapterName'] = this.chapterName; - data['link'] = this.link; - data['title'] = this.title; - data['type'] = this.type; - data['userId'] = this.userId; - if (this.tags != null) { - data['tags'] = this.tags.map((v) => v.toJson()).toList(); + ProjectListDataData.fromJson(Map json) { + superChapterName = json['superChapterName']; + publishTime = json['publishTime']; + visible = json['visible']; + niceDate = json['niceDate']; + projectLink = json['projectLink']; + author = json['author']; + prefix = json['prefix']; + zan = json['zan']; + origin = json['origin']; + chapterName = json['chapterName']; + link = json['link']; + title = json['title']; + type = json['type']; + userId = json['userId']; + if (json['tags'] != null) { + (json['tags'] as List).forEach((v) { + tags.add(ProjectListDataDatasTag.fromJson(v)); + }); } - data['apkLink'] = this.apkLink; - data['envelopePic'] = this.envelopePic; - data['chapterId'] = this.chapterId; - data['superChapterId'] = this.superChapterId; - data['id'] = this.id; - data['fresh'] = this.fresh; - data['collect'] = this.collect; - data['courseId'] = this.courseId; - data['desc'] = this.desc; - return data; - } + apkLink = json['apkLink']; + envelopePic = json['envelopePic']; + chapterId = json['chapterId']; + superChapterId = json['superChapterId']; + id = json['id']; + fresh = json['fresh']; + collect = json['collect']; + courseId = json['courseId']; + desc = json['desc']; + } + + Map toJson() { + final Map data = {}; + data['superChapterName'] = this.superChapterName; + data['publishTime'] = this.publishTime; + data['visible'] = this.visible; + data['niceDate'] = this.niceDate; + data['projectLink'] = this.projectLink; + data['author'] = this.author; + data['prefix'] = this.prefix; + data['zan'] = this.zan; + data['origin'] = this.origin; + data['chapterName'] = this.chapterName; + data['link'] = this.link; + data['title'] = this.title; + data['type'] = this.type; + data['userId'] = this.userId; + data['tags'] = this.tags.map((v) => v.toJson()).toList(); + data['apkLink'] = this.apkLink; + data['envelopePic'] = this.envelopePic; + data['chapterId'] = this.chapterId; + data['superChapterId'] = this.superChapterId; + data['id'] = this.id; + data['fresh'] = this.fresh; + data['collect'] = this.collect; + data['courseId'] = this.courseId; + data['desc'] = this.desc; + return data; + } } class ProjectListDataDatasTag { - String name; - String url; + String? name; + String? url; - ProjectListDataDatasTag({this.name, this.url}); + ProjectListDataDatasTag({this.name, this.url}); - ProjectListDataDatasTag.fromJson(Map json) { - name = json['name']; - url = json['url']; - } + ProjectListDataDatasTag.fromJson(Map json) { + name = json['name']; + url = json['url']; + } - Map toJson() { - final Map data = new Map(); - data['name'] = this.name; - data['url'] = this.url; - return data; - } + Map toJson() { + final Map data = {}; + data['name'] = this.name; + data['url'] = this.url; + return data; + } } diff --git a/lib/entity/tree_entity.dart b/lib/entity/tree_entity.dart index 65aa751..d41d70e 100644 --- a/lib/entity/tree_entity.dart +++ b/lib/entity/tree_entity.dart @@ -1,110 +1,139 @@ class TreeEntity { - List data; - int errorCode; - String errorMsg; + List data = []; + int? errorCode; + String? errorMsg; - TreeEntity({this.data, this.errorCode, this.errorMsg}); - - TreeEntity.fromJson(Map json) { - if (json['data'] != null) { - data = new List();(json['data'] as List).forEach((v) { data.add(new TreeData.fromJson(v)); }); - } - errorCode = json['errorCode']; - errorMsg = json['errorMsg']; - } + TreeEntity({List? data, this.errorCode, this.errorMsg}) { + if (data != null) { + this.data = data; + } + } - Map toJson() { - final Map data = new Map(); - if (this.data != null) { - data['data'] = this.data.map((v) => v.toJson()).toList(); + TreeEntity.fromJson(Map json) { + if (json['data'] != null) { + (json['data'] as List).forEach((v) { + data.add(TreeData.fromJson(v)); + }); } - data['errorCode'] = this.errorCode; - data['errorMsg'] = this.errorMsg; - return data; - } + errorCode = json['errorCode']; + errorMsg = json['errorMsg']; + } + + Map toJson() { + final Map data = {}; + data['data'] = this.data.map((v) => v.toJson()).toList(); + data['errorCode'] = this.errorCode; + data['errorMsg'] = this.errorMsg; + return data; + } } class TreeData { - int visible; - List children; - String name; - bool userControlSetTop; - int id; - int courseId; - int parentChapterId; - int order; - bool isExpanded;//标识是否初始化 + int? visible; + List children = []; + String? name; + bool? userControlSetTop; + int? id; + int? courseId; + int? parentChapterId; + int? order; + bool? isExpanded; // 标识是否初始化 - TreeData({this.visible, this.children, this.name, this.userControlSetTop, this.id, this.courseId, this.parentChapterId, this.order,this.isExpanded}); - - TreeData.fromJson(Map json) { - visible = json['visible']; - if (json['children'] != null) { - children = new List();(json['children'] as List).forEach((v) { children.add(new TreeDatachild.fromJson(v)); }); - } - name = json['name']; - userControlSetTop = json['userControlSetTop']; - id = json['id']; - courseId = json['courseId']; - parentChapterId = json['parentChapterId']; - order = json['order']; - isExpanded = json['isExpanded']; - } + TreeData({ + this.visible, + List? children, + this.name, + this.userControlSetTop, + this.id, + this.courseId, + this.parentChapterId, + this.order, + this.isExpanded, + }) { + if (children != null) { + this.children = children; + } + } - Map toJson() { - final Map data = new Map(); - data['visible'] = this.visible; - if (this.children != null) { - data['children'] = this.children.map((v) => v.toJson()).toList(); + TreeData.fromJson(Map json) { + visible = json['visible']; + if (json['children'] != null) { + (json['children'] as List).forEach((v) { + children.add(TreeDatachild.fromJson(v)); + }); } - data['name'] = this.name; - data['userControlSetTop'] = this.userControlSetTop; - data['id'] = this.id; - data['courseId'] = this.courseId; - data['parentChapterId'] = this.parentChapterId; - data['order'] = this.order; - data['isExpanded'] = this.isExpanded; - return data; - } + name = json['name']; + userControlSetTop = json['userControlSetTop']; + id = json['id']; + courseId = json['courseId']; + parentChapterId = json['parentChapterId']; + order = json['order']; + isExpanded = json['isExpanded']; + } + + Map toJson() { + final Map data = {}; + data['visible'] = this.visible; + data['children'] = this.children.map((v) => v.toJson()).toList(); + data['name'] = this.name; + data['userControlSetTop'] = this.userControlSetTop; + data['id'] = this.id; + data['courseId'] = this.courseId; + data['parentChapterId'] = this.parentChapterId; + data['order'] = this.order; + data['isExpanded'] = this.isExpanded; + return data; + } } class TreeDatachild { - int visible; - List children; - String name; - bool userControlSetTop; - int id; - int courseId; - int parentChapterId; - int order; - - TreeDatachild({this.visible, this.children, this.name, this.userControlSetTop, this.id, this.courseId, this.parentChapterId, this.order}); + int? visible; + List children = []; + String? name; + bool? userControlSetTop; + int? id; + int? courseId; + int? parentChapterId; + int? order; - TreeDatachild.fromJson(Map json) { - visible = json['visible']; - if (json['children'] != null) { - children = new List(); - } - name = json['name']; - userControlSetTop = json['userControlSetTop']; - id = json['id']; - courseId = json['courseId']; - parentChapterId = json['parentChapterId']; - order = json['order']; - } + TreeDatachild({ + this.visible, + List? children, + this.name, + this.userControlSetTop, + this.id, + this.courseId, + this.parentChapterId, + this.order, + }) { + if (children != null) { + this.children = children; + } + } - Map toJson() { - final Map data = new Map(); - data['visible'] = this.visible; - if (this.children != null) { - data['children'] = []; + TreeDatachild.fromJson(Map json) { + visible = json['visible']; + if (json['children'] != null) { + children = []; } - data['name'] = this.name; - data['userControlSetTop'] = this.userControlSetTop; - data['id'] = this.id; - data['courseId'] = this.courseId; - data['parentChapterId'] = this.parentChapterId; - data['order'] = this.order; - return data; - } + name = json['name']; + userControlSetTop = json['userControlSetTop']; + id = json['id']; + courseId = json['courseId']; + parentChapterId = json['parentChapterId']; + order = json['order']; + } + + Map toJson() { + final Map data = {}; + data['visible'] = this.visible; + data['children'] = []; + data['name'] = this.name; + data['userControlSetTop'] = this.userControlSetTop; + data['id'] = this.id; + data['courseId'] = this.courseId; + data['parentChapterId'] = this.parentChapterId; + data['order'] = this.order; + return data; + } } diff --git a/lib/entity/user_entity.dart b/lib/entity/user_entity.dart index 19ccaf1..87cd7a7 100644 --- a/lib/entity/user_entity.dart +++ b/lib/entity/user_entity.dart @@ -1,70 +1,86 @@ class UserEntity { - UserData data; - int errorCode; - String errorMsg; + UserData? data; + int? errorCode; + String? errorMsg; - UserEntity({this.data, this.errorCode, this.errorMsg}); + UserEntity({this.data, this.errorCode, this.errorMsg}); - UserEntity.fromJson(Map json) { - data = json['data'] != null ? new UserData.fromJson(json['data']) : null; - errorCode = json['errorCode']; - errorMsg = json['errorMsg']; - } + UserEntity.fromJson(Map json) { + data = json['data'] != null ? UserData.fromJson(json['data']) : null; + errorCode = json['errorCode']; + errorMsg = json['errorMsg']; + } - Map toJson() { - final Map data = new Map(); - if (this.data != null) { - data['data'] = this.data.toJson(); + Map toJson() { + final Map data = {}; + if (this.data != null) { + data['data'] = this.data!.toJson(); } - data['errorCode'] = this.errorCode; - data['errorMsg'] = this.errorMsg; - return data; - } + data['errorCode'] = this.errorCode; + data['errorMsg'] = this.errorMsg; + return data; + } } class UserData { - String password; - List chapterTops; - String icon; - bool admin; - List collectIds; - int id; - int type; - String email; - String token; - String username; + String? password; + List chapterTops = []; + String? icon; + bool? admin; + List collectIds = []; + int? id; + int? type; + String? email; + String? token; + String? username; - UserData({this.password, this.chapterTops, this.icon, this.admin, this.collectIds, this.id, this.type, this.email, this.token, this.username}); - - UserData.fromJson(Map json) { - password = json['password']; - if (json['chapterTops'] != null) { - chapterTops = new List(); - } - icon = json['icon']; - admin = json['admin']; - collectIds = json['collectIds']?.cast(); - id = json['id']; - type = json['type']; - email = json['email']; - token = json['token']; - username = json['username']; - } + UserData({ + this.password, + List? chapterTops, + this.icon, + this.admin, + List? collectIds, + this.id, + this.type, + this.email, + this.token, + this.username, + }) { + if (chapterTops != null) { + this.chapterTops = chapterTops; + } + if (collectIds != null) { + this.collectIds = collectIds; + } + } - Map toJson() { - final Map data = new Map(); - data['password'] = this.password; - if (this.chapterTops != null) { - data['chapterTops'] = []; + UserData.fromJson(Map json) { + password = json['password']; + if (json['chapterTops'] != null) { + chapterTops = []; } - data['icon'] = this.icon; - data['admin'] = this.admin; - data['collectIds'] = this.collectIds; - data['id'] = this.id; - data['type'] = this.type; - data['email'] = this.email; - data['token'] = this.token; - data['username'] = this.username; - return data; - } + icon = json['icon']; + admin = json['admin']; + collectIds = (json['collectIds']?.cast()) ?? []; + id = json['id']; + type = json['type']; + email = json['email']; + token = json['token']; + username = json['username']; + } + + Map toJson() { + final Map data = {}; + data['password'] = this.password; + data['chapterTops'] = []; + data['icon'] = this.icon; + data['admin'] = this.admin; + data['collectIds'] = this.collectIds; + data['id'] = this.id; + data['type'] = this.type; + data['email'] = this.email; + data['token'] = this.token; + data['username'] = this.username; + return data; + } } diff --git a/lib/entity_factory.dart b/lib/entity_factory.dart index 4ea8542..35fe570 100644 --- a/lib/entity_factory.dart +++ b/lib/entity_factory.dart @@ -9,7 +9,7 @@ import 'package:wanandroid_flutter/entity/tree_entity.dart'; import 'package:wanandroid_flutter/entity/user_entity.dart'; class EntityFactory { - static T generateOBJ(json) { + static T? generateOBJ(json) { if (1 == 0) { return null; } else if (T.toString() == "ArticleEntity") { diff --git a/lib/http/httpUtil.dart b/lib/http/httpUtil.dart index 0b98c33..6d63078 100644 --- a/lib/http/httpUtil.dart +++ b/lib/http/httpUtil.dart @@ -4,21 +4,21 @@ import 'package:dio_cookie_manager/dio_cookie_manager.dart'; import 'package:wanandroid_flutter/common/api.dart'; class HttpUtil { - static HttpUtil instance; - Dio dio; - BaseOptions options; + static HttpUtil? instance; + late Dio dio; + late BaseOptions options; CancelToken cancelToken = CancelToken(); static HttpUtil getInstance() { if (null == instance) instance = HttpUtil(); - return instance; + return instance!; } /* * config it and create */ - HttpUtil() { + HttpUtil() { //BaseOptions、Options、RequestOptions 都可以配置参数,优先级别依次递增,且可以根据优先级别覆盖参数 options = BaseOptions( //请求基地址,可以包含子路径 @@ -55,7 +55,7 @@ class HttpUtil { print("响应之前"); // 如果你想终止请求并触发一个错误,你可以使用 `handler.reject(error)`。 return handler.next(response); // continue - }, onError: (DioError e, ErrorInterceptorHandler handler) { + }, onError: (DioException e, ErrorInterceptorHandler handler) { print("错误之前"); // 如果你想完成请求并返回一些自定义数据,你可以使用 `handler.resolve(response)`。 return handler.next(e); @@ -76,9 +76,11 @@ class HttpUtil { // response.headers; 响应头 // response.request; 请求体 // response.statusCode; 状态码 - } on DioError catch (e) { + } on DioException catch (e) { print('get error---------$e'); formatError(e); + // 保证非空本地变量在异常时也被赋值 + response = Response(requestOptions: e.requestOptions, statusCode: e.response?.statusCode, data: e.response?.data); } return response; } @@ -91,9 +93,11 @@ class HttpUtil { try { response = await dio.post(url, queryParameters: data, options: options, cancelToken: cancelToken); print('post success---------${response.data}'); - } on DioError catch (e) { + } on DioException catch (e) { print('post error---------$e'); formatError(e); + // 保证非空本地变量在异常时也被赋值 + response = Response(requestOptions: e.requestOptions, statusCode: e.response?.statusCode, data: e.response?.data); } return response; } @@ -109,9 +113,11 @@ class HttpUtil { print("$count $total"); }); print('downloadFile success---------${response.data}'); - } on DioError catch (e) { + } on DioException catch (e) { print('downloadFile error---------$e'); formatError(e); + // 保证非空本地变量在异常时也被赋值 + response = Response(requestOptions: e.requestOptions, statusCode: e.response?.statusCode, data: e.response?.data); } return response.data; } @@ -119,20 +125,20 @@ class HttpUtil { /* * error统一处理 */ - void formatError(DioError e) { - if (e.type == DioErrorType.connectionTimeout) { + void formatError(DioException e) { + if (e.type == DioExceptionType.connectionTimeout) { // It occurs when url is opened timeout. print("连接超时"); - } else if (e.type == DioErrorType.sendTimeout) { + } else if (e.type == DioExceptionType.sendTimeout) { // It occurs when url is sent timeout. print("请求超时"); - } else if (e.type == DioErrorType.receiveTimeout) { + } else if (e.type == DioExceptionType.receiveTimeout) { //It occurs when receiving timeout print("响应超时"); - } else if (e.type == DioErrorType.badResponse) { + } else if (e.type == DioExceptionType.badResponse) { // When the server response, but with a incorrect status, such as 404, 503... print("出现异常"); - } else if (e.type == DioErrorType.cancel) { + } else if (e.type == DioExceptionType.cancel) { // When the request is cancelled, dio will throw a error with this type. print("请求取消"); } else { diff --git a/lib/main.dart b/lib/main.dart index df06481..8fae987 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:provider/provider.dart'; -import 'package:share/share.dart'; +import 'package:share_plus/share_plus.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:wanandroid_flutter/pages/CollectPage.dart'; import 'package:wanandroid_flutter/pages/about.dart'; @@ -37,7 +37,7 @@ void main() async { Future getTheme() async { SharedPreferences sp = await SharedPreferences.getInstance(); - int themeIndex = sp.getInt(YColors.themeIndexKey); + int? themeIndex = sp.getInt(YColors.themeIndexKey); return null == themeIndex ? 0 : themeIndex; } @@ -45,12 +45,12 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. final int themeIndex; - MyApp(this.themeIndex); + const MyApp(this.themeIndex); @override Widget build(BuildContext context) { // Calls `context.watch` to make [Count] rebuild when [Counter] changes. - final int themeValue = context.watch().value; + final int? themeValue = context.watch().value; return MaterialApp( title: YStrings.appName, @@ -59,11 +59,10 @@ class MyApp extends StatelessWidget { //除了primaryColor,还有brightness、iconTheme、textTheme等等可以设置 primaryColor: YColors.themeColor[themeValue != null ? themeValue : themeIndex]["primaryColor"], primaryColorDark: YColors.themeColor[themeValue != null ? themeValue : themeIndex]["primaryColorDark"], - accentColor: YColors.themeColor[themeValue != null ? themeValue : themeIndex]["colorAccent"] + colorScheme: ThemeData().colorScheme.copyWith( + secondary: YColors.themeColor[themeValue != null ? themeValue : themeIndex]["colorAccent"], + ), - // primaryColor: YColors.colorPrimary, - // primaryColorDark: YColors.colorPrimaryDark, - // accentColor: YColors.colorAccent, // dividerColor: YColors.dividerColor, ), home: MyHomePage(title: YStrings.appName), @@ -72,7 +71,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - MyHomePage({Key key, this.title}) : super(key: key); + const MyHomePage({Key? key, required this.title}) : super(key: key); final String title; diff --git a/lib/pages/CollectPage.dart b/lib/pages/CollectPage.dart index 5ef68ba..1863ac9 100644 --- a/lib/pages/CollectPage.dart +++ b/lib/pages/CollectPage.dart @@ -19,7 +19,7 @@ class CollectPage extends StatefulWidget { } class _CollectPagePageState extends State { - List articleDatas = List(); + List articleDatas = []; int _page = 0; @override @@ -31,11 +31,11 @@ class _CollectPagePageState extends State { void getHttp() async { try { var response = await HttpUtil().get(Api.COLLECT_LIST + "$_page/json"); - Map map = json.decode(response.toString()); + Map map = json.decode(response.toString()); var articleEntity = ArticleEntity.fromJson(map); if (articleEntity.errorCode == -1001) { - YToast.showBottom(context: context, msg: articleEntity.errorMsg); + YToast.showBottom(context: context, msg: articleEntity.errorMsg ?? ""); Navigator.of(context).pop(); Navigator.push( context, @@ -43,7 +43,7 @@ class _CollectPagePageState extends State { ); } else { setState(() { - articleDatas = articleEntity.data.datas; + articleDatas = articleEntity.data?.datas ?? []; }); } } catch (e) { @@ -96,14 +96,14 @@ class _CollectPagePageState extends State { background: Container(color: Theme.of(context).primaryColor), // Each Dismissible must contain a Key. Keys allow Flutter to // uniquely identify Widgets. - key: Key(item.title), + key: Key(item.title ?? ""), // We also need to provide a function that will tell our app // what to do after an item has been swiped away. onDismissed: (direction) { // Remove the item from our data source articleDatas.removeAt(index); - cancelCollect(item.id, item.originId == null ? -1 : item.originId); + cancelCollect(item.id ?? 0, item.originId ?? -1); // Show a snackbar! This snackbar could also contain "Undo" actions. ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("已移除"))); @@ -118,7 +118,7 @@ class _CollectPagePageState extends State { padding: EdgeInsets.all(10.0), child: ListTile( title: Text( - articleDatas[i].title, + articleDatas[i].title ?? "", maxLines: 2, overflow: TextOverflow.ellipsis, ), @@ -136,13 +136,13 @@ class _CollectPagePageState extends State { borderRadius: BorderRadius.circular((20.0)), // 圆角度 ), child: Text( - articleDatas[i].chapterName, + articleDatas[i].chapterName ?? "", style: TextStyle(color: Theme.of(context).primaryColor), ), ), Container( margin: EdgeInsets.only(left: 15), - child: Text(articleDatas[i].author), + child: Text(articleDatas[i].author ?? ""), ), ], ), @@ -154,8 +154,8 @@ class _CollectPagePageState extends State { context, MaterialPageRoute( builder: (context) => ArticleDetail( - title: articleDatas[i].title, - url: articleDatas[i].link, + title: articleDatas[i].title ?? "", + url: articleDatas[i].link ?? "", ), ), ); @@ -171,9 +171,10 @@ class _CollectPagePageState extends State { Future cancelCollect(int id, int originId) async { var data = {'originId': originId}; var collectResponse = await HttpUtil().post(Api.UN_COLLECT + '$id/json', data: data); - Map map = json.decode(collectResponse.toString()); + Map map = json.decode(collectResponse.toString()); var entity = CommonEntity.fromJson(map); if (entity.errorCode == -1001) { + // errorMsg 在 CommonEntity 中是非空字符串,移除无效的空判 YToast.show(context: context, msg: entity.errorMsg); } else { //getHttp(); @@ -182,10 +183,10 @@ class _CollectPagePageState extends State { Future getMoreData() async { var response = await HttpUtil().get(Api.COLLECT_LIST + "$_page/json"); - Map map = json.decode(response.toString()); + Map map = json.decode(response.toString()); var articleEntity = ArticleEntity.fromJson(map); setState(() { - articleDatas.addAll(articleEntity.data.datas); + articleDatas.addAll(articleEntity.data?.datas ?? []); }); } } diff --git a/lib/pages/about.dart b/lib/pages/about.dart index ce9b9d9..fb14cb5 100644 --- a/lib/pages/about.dart +++ b/lib/pages/about.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:share/share.dart'; +import 'package:share_plus/share_plus.dart'; import 'package:wanandroid_flutter/util/ToastUtil.dart'; import 'articleDetail.dart'; diff --git a/lib/pages/articleDetail.dart b/lib/pages/articleDetail.dart index 0241a24..acaba8b 100644 --- a/lib/pages/articleDetail.dart +++ b/lib/pages/articleDetail.dart @@ -1,45 +1,52 @@ import 'package:flutter/material.dart'; -import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; -import 'package:share/share.dart'; -import 'package:wanandroid_flutter/res/colors.dart'; +import 'package:share_plus/share_plus.dart'; +import 'package:webview_flutter/webview_flutter.dart'; -// ignore: must_be_immutable -class ArticleDetail extends StatelessWidget { - String url, title; +class ArticleDetail extends StatefulWidget { + final String title; + final String url; - ArticleDetail({Key key, @required this.title, @required this.url}) + const ArticleDetail({Key? key, required this.title, required this.url}) : super(key: key); + @override + State createState() => _ArticleDetailState(); +} + +class _ArticleDetailState extends State { + late final WebViewController _controller; + + @override + void initState() { + super.initState(); + _controller = WebViewController() + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..loadRequest(Uri.parse(widget.url)); + } + @override Widget build(BuildContext context) { - return MaterialApp( - theme: ThemeData( - primaryColor: Theme.of(context).primaryColor, + return Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).primaryColor, + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () { + Navigator.maybePop(context); + }, + ), + title: Text(widget.title), + actions: [ + IconButton( + icon: const Icon(Icons.share), + tooltip: '分享', + onPressed: () { + Share.share('【${widget.title}】\n${widget.url}'); + }, + ), + ], ), - routes: { - "/": (_) => WebviewScaffold( - url: "$url", - appBar: AppBar( - backgroundColor: Theme.of(context).primaryColor, - //返回键 点击关闭 - leading: IconButton( - icon: Icon(Icons.arrow_back), - onPressed: () { - Navigator.maybePop(context); - }), - title: Text("$title"), - actions: [ - IconButton( - icon: Icon(Icons.share), - tooltip: '分享', - onPressed: () { - Share.share('【$title】\n$url'); - }, - ), - ], - ), - ), - }, + body: WebViewWidget(controller: _controller), ); } } diff --git a/lib/pages/homePage.dart b/lib/pages/homePage.dart index d64fab6..7f67afe 100644 --- a/lib/pages/homePage.dart +++ b/lib/pages/homePage.dart @@ -2,7 +2,7 @@ import 'dart:convert'; import 'package:easy_refresh/easy_refresh.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_swiper/flutter_swiper.dart'; +import 'package:card_swiper/card_swiper.dart'; import 'package:wanandroid_flutter/common/api.dart'; import 'package:wanandroid_flutter/entity/article_entity.dart'; import 'package:wanandroid_flutter/entity/banner_entity.dart'; @@ -15,18 +15,18 @@ import '../res/colors.dart'; import 'loginPage.dart'; class HomePage extends StatefulWidget { - const HomePage({Key key}) : super(key: key); + const HomePage({Key? key}) : super(key: key); @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State { - List bannerDatas = List(); - List articleDatas = List(); + List bannerDatas = []; + List articleDatas = []; - EasyRefreshController _easyRefreshController; - SwiperController _swiperController; + late EasyRefreshController _easyRefreshController; + late SwiperController _swiperController; int _page = 0; bool hasMore = true; @@ -48,17 +48,19 @@ class _HomePageState extends State { try { //banner var bannerResponse = await HttpUtil().get(Api.BANNER); - Map bannerMap = json.decode(bannerResponse.toString()); + Map bannerMap = json.decode(bannerResponse.toString()); var bannerEntity = BannerEntity.fromJson(bannerMap); //article - var articleResponse = await HttpUtil().get(Api.ARTICLE_LIST + "$_page/json"); - Map articleMap = json.decode(articleResponse.toString()); + var articleResponse = + await HttpUtil().get(Api.ARTICLE_LIST + "$_page/json"); + Map articleMap = json.decode(articleResponse.toString()); var articleEntity = ArticleEntity.fromJson(articleMap); setState(() { + // bannerEntity.data 是非空 List,移除无效的空判默认值 bannerDatas = bannerEntity.data; - articleDatas = articleEntity.data.datas; + articleDatas = articleEntity.data?.datas ?? []; }); _swiperController.startAutoplay(); @@ -105,17 +107,18 @@ class _HomePageState extends State { }); getMoreData(); - _easyRefreshController.finishLoad(hasMore ? IndicatorResult.success : IndicatorResult.noMore); + _easyRefreshController.finishLoad( + hasMore ? IndicatorResult.success : IndicatorResult.noMore); }); }, - childBuilder: (context, physics) { return CustomScrollView( physics: physics, slivers: [ SliverAppBar( backgroundColor: Theme.of(context).primaryColor, - expandedHeight: MediaQuery.of(context).size.width / 1.8 * 0.8 + 20, // +20 是上下的padding值 + expandedHeight: MediaQuery.of(context).size.width / 1.8 * 0.8 + + 20, // +20 是上下的padding值 pinned: false, flexibleSpace: FlexibleSpaceBar( background: getBanner(), @@ -148,7 +151,7 @@ class _HomePageState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular((10.0)), // 圆角度 image: DecorationImage( - image: NetworkImage(bannerDatas[index].imagePath), + image: NetworkImage(bannerDatas[index].imagePath ?? ''), fit: BoxFit.fill, ), ), @@ -187,30 +190,30 @@ class _HomePageState extends State { // print("debug <<<<<"); // 防止接口慢的情况 - if (length == 0) return null; + if (length == 0) return const SizedBox.shrink(); return GestureDetector( child: Container( padding: EdgeInsets.symmetric(vertical: 10, horizontal: 5), child: ListTile( leading: IconButton( - icon: articleDatas != null && articleDatas[i].collect + icon: articleDatas[i].collect ?? false ? Icon( Icons.favorite, color: Theme.of(context).primaryColor, ) - : Icon(Icons.favorite_border), + : const Icon(Icons.favorite_border), tooltip: '收藏', onPressed: () { - if (articleDatas[i].collect) { - cancelCollect(articleDatas[i].id); + if (articleDatas[i].collect ?? false) { + cancelCollect(articleDatas[i].id ?? 0); } else { - addCollect(articleDatas[i].id); + addCollect(articleDatas[i].id ?? 0); } }, ), title: Text( - articleDatas[i].title, + articleDatas[i].title ?? '', maxLines: 2, overflow: TextOverflow.ellipsis, ), @@ -228,14 +231,17 @@ class _HomePageState extends State { ), borderRadius: BorderRadius.circular((20.0)), // 圆角度 ), - child: Text(articleDatas[i].superChapterName, - style: TextStyle(color: Theme.of(context).primaryColor), + child: Text(articleDatas[i].superChapterName ?? '', + style: + TextStyle(color: Theme.of(context).primaryColor), overflow: TextOverflow.ellipsis, maxLines: 1)), Container( - margin: EdgeInsets.only(left: 10), - child: Text(articleDatas[i].author), - ), + margin: EdgeInsets.only(left: 10), + child: Text(articleDatas[i].author ?? '', + style: TextStyle(color: Colors.grey), + overflow: TextOverflow.ellipsis, + maxLines: 1)), ], ), ), @@ -246,7 +252,9 @@ class _HomePageState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => ArticleDetail(title: articleDatas[i].title, url: articleDatas[i].link), + builder: (context) => ArticleDetail( + title: articleDatas[i].title ?? '', + url: articleDatas[i].link ?? ''), ), ); }, @@ -255,7 +263,7 @@ class _HomePageState extends State { Future addCollect(int id) async { var collectResponse = await HttpUtil().post(Api.COLLECT + '$id/json'); - Map map = json.decode(collectResponse.toString()); + Map map = json.decode(collectResponse.toString()); var entity = CommonEntity.fromJson(map); if (entity.errorCode == -1001) { YToast.showBottom(context: context, msg: entity.errorMsg); @@ -270,11 +278,13 @@ class _HomePageState extends State { } Future cancelCollect(int id) async { - var collectResponse = await HttpUtil().post(Api.UN_COLLECT_ORIGIN_ID + '$id/json'); - Map map = json.decode(collectResponse.toString()); + var collectResponse = + await HttpUtil().post(Api.UN_COLLECT_ORIGIN_ID + '$id/json'); + Map map = json.decode(collectResponse.toString()); var entity = CommonEntity.fromJson(map); if (entity.errorCode == -1001) { - YToast.show(context: context, msg: entity.errorMsg); + // errorMsg 在 CommonEntity 中是非空字符串,移除无效的空判 + YToast.show(context: context, msg: entity.errorMsg); Navigator.push( context, MaterialPageRoute(builder: (context) => LoginPage()), @@ -287,11 +297,11 @@ class _HomePageState extends State { Future getMoreData() async { var response = await HttpUtil().get(Api.ARTICLE_LIST + "$_page/json"); - Map map = json.decode(response.toString()); + Map map = json.decode(response.toString()); var articleEntity = ArticleEntity.fromJson(map); setState(() { - articleDatas.addAll(articleEntity.data.datas); - if (articleEntity.data.datas.length < 10) { + articleDatas.addAll(articleEntity.data?.datas ?? []); + if ((articleEntity.data?.datas.length ?? 0) < 10) { hasMore = false; } }); diff --git a/lib/pages/loginPage.dart b/lib/pages/loginPage.dart index 249897c..43f4d16 100644 --- a/lib/pages/loginPage.dart +++ b/lib/pages/loginPage.dart @@ -6,6 +6,7 @@ import 'package:wanandroid_flutter/entity/user_entity.dart'; import 'package:wanandroid_flutter/http/httpUtil.dart'; import 'package:wanandroid_flutter/main.dart'; import 'package:wanandroid_flutter/res/colors.dart'; +import 'package:wanandroid_flutter/res/strings.dart'; import 'package:wanandroid_flutter/util/ToastUtil.dart'; class LoginPage extends StatefulWidget { @@ -23,7 +24,7 @@ class _LoginPagePageState extends State with SingleTickerProviderStat bool visible = true; GlobalKey _key = GlobalKey(); bool autoValidate = false; - String username, password, rePassword; + String username = "", password = "", rePassword = ""; @override void initState() { @@ -35,8 +36,8 @@ class _LoginPagePageState extends State with SingleTickerProviderStat return MaterialApp( theme: ThemeData( primaryColor: Theme.of(context).primaryColor, - accentColor: Theme.of(context).accentColor, primaryColorDark: Theme.of(context).primaryColorDark, + colorScheme: Theme.of(context).colorScheme, ), home: Container( decoration: BoxDecoration( @@ -44,7 +45,7 @@ class _LoginPagePageState extends State with SingleTickerProviderStat begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ - Theme.of(context).accentColor, + Theme.of(context).colorScheme.secondary, Theme.of(context).primaryColorDark, ], ), @@ -91,7 +92,7 @@ class _LoginPagePageState extends State with SingleTickerProviderStat validator: validateUsername, onSaved: (text) { setState(() { - username = text; + username = text ?? ''; }); }, ), @@ -107,7 +108,7 @@ class _LoginPagePageState extends State with SingleTickerProviderStat validator: validatePassword, onSaved: (text) { setState(() { - password = text; + password = text ?? ''; }); }, ), @@ -126,7 +127,7 @@ class _LoginPagePageState extends State with SingleTickerProviderStat validator: visible ? null : validateRePassword, onSaved: (text) { setState(() { - rePassword = text; + rePassword = text ?? ''; }); }, ), @@ -184,8 +185,8 @@ class _LoginPagePageState extends State with SingleTickerProviderStat ), ), onPressed: () { - if (_key.currentState.validate()) { - _key.currentState.save(); + if (_key.currentState!.validate()) { + _key.currentState!.save(); print(username + "--" + password + "**" + rePassword); doRequest(); } else { @@ -226,22 +227,22 @@ class _LoginPagePageState extends State with SingleTickerProviderStat super.dispose(); } - String validateUsername(String value) { - if (value.isEmpty) + String? validateUsername(String? value) { + if (value == null || value.isEmpty) return "账号不能为空"; else if (value.length < 6) return "账号最少6位"; return null; } - String validatePassword(String value) { - if (value.isEmpty) + String? validatePassword(String? value) { + if (value == null || value.isEmpty) return "密码不能为空"; else if (value.length < 6) return "密码最少6位"; return null; } - String validateRePassword(String value) { - if (value.isEmpty) + String? validateRePassword(String? value) { + if (value == null || value.isEmpty) return "确认密码不能为空"; else if (value.length < 6) return "确认密码最少6位"; // else if (value != password) return "两次密码不一致"; @@ -256,15 +257,15 @@ class _LoginPagePageState extends State with SingleTickerProviderStat data = {'username': username, 'password': password, 'repassword': rePassword}; var response = await HttpUtil().post(visible ? Api.LOGIN : Api.REGISTER, data: data); - Map userMap = json.decode(response.toString()); + Map userMap = json.decode(response.toString()); var userEntity = UserEntity.fromJson(userMap); if (userEntity.errorCode == 0) { YToast.show(context: context, msg: visible ? "登录成功~" : "注册成功~"); //跳转并关闭当前页面 Navigator.pushAndRemoveUntil( context, - MaterialPageRoute(builder: (context) => MyHomePage()), - (route) => route == null, + MaterialPageRoute(builder: (context) => MyHomePage(title: YStrings.appName)), + (route) => false, ); } else YToast.show(context: context, msg: userMap['errorMsg']); diff --git a/lib/pages/naviPage.dart b/lib/pages/naviPage.dart index f17bf0c..79d7ede 100644 --- a/lib/pages/naviPage.dart +++ b/lib/pages/naviPage.dart @@ -15,9 +15,9 @@ class NaviPage extends StatefulWidget { } class _NaviPageState extends State { - List _datas = List(); //一级分类集合 - List articles = List(); //二级分类集合 - int index; //一级分类下标 + List _datas = []; //一级分类集合 + List articles = []; //二级分类集合 + int index = 0; //一级分类下标 @override void initState() { @@ -28,7 +28,7 @@ class _NaviPageState extends State { void getHttp() async { try { var response = await HttpUtil().get(Api.NAVI); - Map userMap = json.decode(response.toString()); + Map userMap = json.decode(response.toString()); var naviEntity = NaviEntity.fromJson(userMap); /// 初始化 @@ -92,7 +92,7 @@ class _NaviPageState extends State { ), ), child: Text( - _datas[i].name, + _datas[i].name ?? '', style: TextStyle( color: index == i ? textColor : YColors.color_666, fontWeight: index == i ? FontWeight.w600 : FontWeight.w400, @@ -122,7 +122,7 @@ class _NaviPageState extends State { return ActionChip( //标签文字 label: Text( - articles[index].title, + articles[index].title ?? '', style: TextStyle(fontSize: 16, color: YColors.color_666), ), //点击事件 @@ -131,7 +131,7 @@ class _NaviPageState extends State { context, MaterialPageRoute( builder: (context) => ArticleDetail( - title: articles[index].title, url: articles[index].link), + title: articles[index].title ?? '', url: articles[index].link ?? ''), ), ); }, diff --git a/lib/pages/projectPage.dart b/lib/pages/projectPage.dart index 8f79b0c..ada12ed 100644 --- a/lib/pages/projectPage.dart +++ b/lib/pages/projectPage.dart @@ -17,11 +17,11 @@ class ProjectPage extends StatefulWidget { } class _ProjectPageState extends State with TickerProviderStateMixin { - TabController _controller; //tab控制器 + late TabController _controller; //tab控制器 int _currentIndex = 0; //选中下标 - List _datas = List(); //tab集合 - List _listDatas = List(); //内容集合 + List _datas = []; //tab集合 + List _listDatas = []; //内容集合 int _page = 1; //看文档时要注意page是从0还是1开始 @@ -36,10 +36,11 @@ class _ProjectPageState extends State with TickerProviderStateMixin void getHttp() async { try { var response = await HttpUtil().get(Api.PROJECT); - Map userMap = json.decode(response.toString()); + Map userMap = json.decode(response.toString()); var projectEntity = ProjectEntity.fromJson(userMap); setState(() { + // projectEntity.data 是非空的 List,去掉无效的空判默认值 _datas = projectEntity.data; _controller = TabController(vsync: this, length: _datas.length); }); @@ -57,7 +58,8 @@ class _ProjectPageState extends State with TickerProviderStateMixin /// tab改变监听 /// _onTabChanged() { - if (_controller.index.toDouble() == _controller.animation.value) { + final animValue = _controller.animation?.value; + if (_controller.index.toDouble() == (animValue ?? _controller.index.toDouble()) ) { //赋值 并更新数据 this.setState(() { _currentIndex = _controller.index; @@ -71,13 +73,13 @@ class _ProjectPageState extends State with TickerProviderStateMixin /// void getDetail() async { try { - var data = {"cid": _datas[_currentIndex].id}; + var data = {"cid": _datas[_currentIndex].id ?? 0}; var response = await HttpUtil().get(Api.PROJECT_LIST + "$_page/json", data: data); - Map userMap = json.decode(response.toString()); + Map userMap = json.decode(response.toString()); var projectListEntity = ProjectListEntity.fromJson(userMap); setState(() { - _listDatas = projectListEntity.data.datas; + _listDatas = projectListEntity.data?.datas ?? []; }); } catch (e) { print(e); @@ -167,7 +169,7 @@ class _ProjectPageState extends State with TickerProviderStateMixin children: [ Expanded( flex: 2, - child: Image.network(_listDatas[i].envelopePic), + child: Image.network(_listDatas[i].envelopePic ?? ''), ), Expanded( flex: 5, @@ -178,7 +180,7 @@ class _ProjectPageState extends State with TickerProviderStateMixin Padding( padding: EdgeInsets.symmetric(horizontal: 10), child: Text( - _listDatas[i].title, + _listDatas[i].title ?? '', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), maxLines: 3, overflow: TextOverflow.ellipsis, @@ -187,7 +189,7 @@ class _ProjectPageState extends State with TickerProviderStateMixin Padding( padding: EdgeInsets.all(10), child: Text( - _listDatas[i].desc, + _listDatas[i].desc ?? '', style: TextStyle(fontSize: 14, color: YColors.color_666), maxLines: 3, overflow: TextOverflow.ellipsis, @@ -202,7 +204,7 @@ class _ProjectPageState extends State with TickerProviderStateMixin child: Padding( padding: EdgeInsets.all(10), child: Text( - _listDatas[i].niceDate, + _listDatas[i].niceDate ?? '', style: TextStyle(fontSize: 14), ), ), @@ -210,7 +212,7 @@ class _ProjectPageState extends State with TickerProviderStateMixin Padding( padding: EdgeInsets.all(10), child: Text( - _listDatas[i].author, + _listDatas[i].author ?? '', style: TextStyle(fontSize: 14), textAlign: TextAlign.right, ), @@ -231,7 +233,7 @@ class _ProjectPageState extends State with TickerProviderStateMixin Navigator.push( context, MaterialPageRoute( - builder: (context) => ArticleDetail(title: _listDatas[i].title, url: _listDatas[i].link), + builder: (context) => ArticleDetail(title: _listDatas[i].title ?? '', url: _listDatas[i].link ?? ''), ), ); }, @@ -241,10 +243,10 @@ class _ProjectPageState extends State with TickerProviderStateMixin Future getMoreData() async { var data = {"cid": _datas[_currentIndex].id}; var response = await HttpUtil().get(Api.PROJECT_LIST + "$_page/json", data: data); - Map userMap = json.decode(response.toString()); + Map userMap = json.decode(response.toString()); var projectListEntity = ProjectListEntity.fromJson(userMap); setState(() { - _listDatas.addAll(projectListEntity.data.datas); + _listDatas.addAll(projectListEntity.data?.datas ?? []); }); } diff --git a/lib/pages/searchPage.dart b/lib/pages/searchPage.dart index 4493623..b6c7f2a 100644 --- a/lib/pages/searchPage.dart +++ b/lib/pages/searchPage.dart @@ -10,13 +10,13 @@ import 'package:wanandroid_flutter/res/colors.dart'; import 'articleDetail.dart'; -List articleDatas = List(); -List hotKeyDatas = List(); +List articleDatas = []; +List hotKeyDatas = []; String key = ""; var pageContext; class SearchPage extends StatefulWidget { - SearchPage({Key key}) : super(key: key); + const SearchPage({Key? key}) : super(key: key); @override _SearchPageState createState() => _SearchPageState(); @@ -33,10 +33,11 @@ class _SearchPageState extends State { void getHttpByHoyKey() async { try { var hotKeyResponse = await HttpUtil().post(Api.HOT_KEY); - Map hotKeyMap = json.decode(hotKeyResponse.toString()); + Map hotKeyMap = json.decode(hotKeyResponse.toString()); var hotKeyEntity = HotKeyEntity.fromJson(hotKeyMap); setState(() { + // hotKeyEntity.data 是非空的 List,移除无效的空判默认值 hotKeyDatas = hotKeyEntity.data; }); @@ -60,11 +61,11 @@ class _SearchPageState extends State { try { var data = {'k': key}; var articleResponse = await HttpUtil().post(Api.QUERY, data: data); - Map articleMap = json.decode(articleResponse.toString()); + Map articleMap = json.decode(articleResponse.toString()); var articleEntity = ArticleEntity.fromJson(articleMap); setState(() { - articleDatas = articleEntity.data.datas; + articleDatas = articleEntity.data?.datas ?? []; }); } catch (e) { print(e); @@ -73,7 +74,6 @@ class _SearchPageState extends State { } class MySearchDelegate extends SearchDelegate { - BuildContext get context => context; MySearchDelegate( String hintText, @@ -98,9 +98,9 @@ class MySearchDelegate extends SearchDelegate { onPressed: () async { var data = {'k': query}; var articleResponse = await HttpUtil().post(Api.QUERY, data: data); - Map articleMap = json.decode(articleResponse.toString()); + Map articleMap = json.decode(articleResponse.toString()); var articleEntity = ArticleEntity.fromJson(articleMap); - articleDatas = articleEntity.data.datas; + articleDatas = articleEntity.data?.datas ?? []; showResults(context); }, @@ -125,7 +125,7 @@ class MySearchDelegate extends SearchDelegate { progress: transitionAnimation, ), onPressed: () { - close(context, null); + close(context, ""); Navigator.of(pageContext).pop(); }, ); @@ -148,7 +148,9 @@ class MySearchDelegate extends SearchDelegate { padding: EdgeInsets.all(10.0), child: ListTile( title: Text( - articleDatas[position].title.replaceAll("", "【").replaceAll("<\/em>", "】"), + (articleDatas[position].title ?? '') + .replaceAll("", "【") + .replaceAll("<\/em>", "】"), maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle(color: Colors.black54), @@ -165,7 +167,7 @@ class MySearchDelegate extends SearchDelegate { borderRadius: BorderRadius.circular((20.0)), // 圆角度 ), child: Text( - articleDatas[position].superChapterName, + articleDatas[position].superChapterName ?? '', style: TextStyle( color: Theme.of(context).primaryColor, ), @@ -175,7 +177,7 @@ class MySearchDelegate extends SearchDelegate { ), Container( margin: EdgeInsets.only(left: 15), - child: Text(articleDatas[position].author), + child: Text(articleDatas[position].author ?? ''), ), ], ), @@ -187,11 +189,11 @@ class MySearchDelegate extends SearchDelegate { context, MaterialPageRoute( builder: (context) => ArticleDetail( - title: articleDatas[position] - .title + title: (articleDatas[position] + .title ?? '') .replaceAll("", "") .replaceAll("<\/em>", ""), - url: articleDatas[position].link), + url: articleDatas[position].link ?? ''), ), ); }, @@ -226,7 +228,7 @@ class MySearchDelegate extends SearchDelegate { return ActionChip( //标签文字 label: Text( - hotKeyDatas[index].name, + hotKeyDatas[index].name ?? '', style: TextStyle( fontSize: 16, color: Colors.white, @@ -234,16 +236,16 @@ class MySearchDelegate extends SearchDelegate { ), //点击事件 onPressed: () async { - query = hotKeyDatas[index].name; + query = hotKeyDatas[index].name ?? ''; key = query; /// 请求数据 var data = {'k': key}; var articleResponse = await HttpUtil().post(Api.QUERY, data: data); - Map articleMap = json.decode(articleResponse.toString()); + Map articleMap = json.decode(articleResponse.toString()); var articleEntity = ArticleEntity.fromJson(articleMap); - articleDatas = articleEntity.data.datas; + articleDatas = articleEntity.data?.datas ?? []; /// 显示结果 showResults(context); @@ -270,34 +272,16 @@ class MySearchDelegate extends SearchDelegate { /// https://github.com/flutter/flutter/issues/48857 @override ThemeData appBarTheme(BuildContext context) { - - assert(context != null); - final ThemeData theme = Theme.of(context); - assert(theme != null); + final ThemeData theme = Theme.of(context); return theme.copyWith( //主题色 primaryColor: theme.primaryColor, //图标颜色 primaryIconTheme: theme.primaryIconTheme.copyWith(color: Colors.white), - //状态栏 - primaryColorBrightness: Brightness.dark, - //文字主题 - textTheme: theme.textTheme.copyWith( - // 不生效 - // subtitle1: TextStyle(color: Colors.red, fontSize: 20.0), - headline1: theme.textTheme.headline1.copyWith(color: theme.primaryTextTheme.headline1.color), - subtitle1: TextStyle( - color: Colors.red, - fontWeight: FontWeight.bold, - fontSize: 18, - ), - ), - - // 不生效 - backgroundColor: theme.primaryColor, - + // AppBar主题颜色 + appBarTheme: theme.appBarTheme.copyWith(backgroundColor: theme.primaryColor), // hintStyle - inputDecorationTheme: InputDecorationTheme( + inputDecorationTheme: const InputDecorationTheme( hintStyle: TextStyle(color: Colors.white60), border: InputBorder.none, ), diff --git a/lib/pages/treeDetailPage.dart b/lib/pages/treeDetailPage.dart index caa6b2f..13dd0cf 100644 --- a/lib/pages/treeDetailPage.dart +++ b/lib/pages/treeDetailPage.dart @@ -16,7 +16,7 @@ class TreeDetailPage extends StatefulWidget { final int panelIndex; //一级分类选中下标 final int index; //二级分类选中下标 - TreeDetailPage({Key key, @required this.panelIndex, @required this.index}) : super(key: key); + const TreeDetailPage({Key? key, required this.panelIndex, required this.index}) : super(key: key); @override State createState() { @@ -25,12 +25,12 @@ class TreeDetailPage extends StatefulWidget { } class _TreeDetailPageState extends State with TickerProviderStateMixin { - TabController _controller; //tab控制器 + late TabController _controller; //tab控制器 int _currentIndex = 0; //选中下标 - List _datas = List(); //一级分类集合 - List _tabDatas = List(); //二级分类 即 tab集合 - List articleDatas = List(); //内容集合 + List _datas = []; //一级分类集合 + List _tabDatas = []; //二级分类 即 tab集合 + List articleDatas = []; //内容集合 String _title = "标题"; @@ -46,16 +46,17 @@ class _TreeDetailPageState extends State with TickerProviderStat Future getHttp() async { var response = await HttpUtil().get(Api.TREE); - Map userMap = json.decode(response.toString()); + Map userMap = json.decode(response.toString()); var treeEntity = TreeEntity.fromJson(userMap); setState(() { + // treeEntity.data 和 children 都是非空 List,去掉无效的空判默认值 _datas = treeEntity.data; - _tabDatas = _datas[widget.panelIndex].children; + _tabDatas = (_datas.isNotEmpty ? _datas[widget.panelIndex].children : []); _controller = TabController(vsync: this, length: _tabDatas.length); _currentIndex = widget.index; - _title = _datas[widget.panelIndex].name; + _title = (_datas.isNotEmpty ? (_datas[widget.panelIndex].name ?? '') : ''); }); //controller添加监听 @@ -70,7 +71,8 @@ class _TreeDetailPageState extends State with TickerProviderStat /// 滑动切换_controller.indexIsChanging一直返回false,所以这种判断方式不适用了 /// 修改如下 _onTabChanged() { - if (_controller.index.toDouble() == _controller.animation.value) { + final animValue = _controller.animation?.value; + if (_controller.index.toDouble() == (animValue ?? _controller.index.toDouble())) { //赋值 并更新数据 this.setState(() { _currentIndex = _controller.index; @@ -85,16 +87,17 @@ class _TreeDetailPageState extends State with TickerProviderStat this.setState(() { _page = 0; }); - var data = {"cid": _tabDatas[_currentIndex].id}; + var data = {"cid": _tabDatas[_currentIndex].id ?? 0}; var response = await HttpUtil().get(Api.ARTICLE_LIST + "$_page/json", data: data); - Map articleMap = json.decode(response.toString()); + Map articleMap = json.decode(response.toString()); var articleEntity = ArticleEntity.fromJson(articleMap); - if (0 == articleEntity.data.datas.length) { + final datas = articleEntity.data?.datas ?? []; + if (datas.isEmpty) { YToast.show(context: context, msg: "数据为空~"); } else { setState(() { - articleDatas = articleEntity.data.datas; + articleDatas = datas; }); } } @@ -117,7 +120,7 @@ class _TreeDetailPageState extends State with TickerProviderStat indicatorSize: TabBarIndicatorSize.label, tabs: _tabDatas.map((TreeDatachild choice) { return Tab( - text: choice.name, + text: choice.name ?? '', ); }).toList(), onTap: (int i) { @@ -127,10 +130,10 @@ class _TreeDetailPageState extends State with TickerProviderStat ), body: TabBarView( controller: _controller, - children: _tabDatas.map((TreeDatachild choice) { - return EasyRefresh( - header: TaurusHeader(), - footer: TaurusFooter(), + children: _tabDatas.map((TreeDatachild choice) { + return EasyRefresh( + header: TaurusHeader(), + footer: TaurusFooter(), onRefresh: () async { await Future.delayed(Duration(seconds: 1), () { setState(() { @@ -167,7 +170,7 @@ class _TreeDetailPageState extends State with TickerProviderStat padding: EdgeInsets.symmetric(vertical: 10, horizontal: 5), child: ListTile( leading: IconButton( - icon: articleDatas[i].collect + icon: (articleDatas[i].collect == true) ? Icon( Icons.favorite, color: Theme.of(context).primaryColor, @@ -175,15 +178,15 @@ class _TreeDetailPageState extends State with TickerProviderStat : Icon(Icons.favorite_border), tooltip: '收藏', onPressed: () { - if (articleDatas[i].collect) { - cancelCollect(articleDatas[i].id); + if (articleDatas[i].collect == true) { + cancelCollect(articleDatas[i].id ?? 0); } else { - addCollect(articleDatas[i].id); + addCollect(articleDatas[i].id ?? 0); } }, ), title: Text( - articleDatas[i].title, + articleDatas[i].title ?? '', maxLines: 2, overflow: TextOverflow.ellipsis, ), @@ -201,13 +204,13 @@ class _TreeDetailPageState extends State with TickerProviderStat borderRadius: BorderRadius.circular((20.0)), // 圆角度 ), child: Text( - articleDatas[i].superChapterName, + articleDatas[i].superChapterName ?? '', style: TextStyle(color: Theme.of(context).primaryColor), ), ), Container( margin: EdgeInsets.only(left: 10), - child: Text(articleDatas[i].author), + child: Text(articleDatas[i].author ?? ''), ), ], ), @@ -219,7 +222,10 @@ class _TreeDetailPageState extends State with TickerProviderStat Navigator.push( context, MaterialPageRoute( - builder: (context) => ArticleDetail(title: articleDatas[i].title, url: articleDatas[i].link), + builder: (context) => ArticleDetail( + title: articleDatas[i].title ?? '', + url: articleDatas[i].link ?? '', + ), ), ); }, @@ -228,7 +234,7 @@ class _TreeDetailPageState extends State with TickerProviderStat Future addCollect(int id) async { var collectResponse = await HttpUtil().post(Api.COLLECT + '$id/json'); - Map map = json.decode(collectResponse.toString()); + Map map = json.decode(collectResponse.toString()); var entity = CommonEntity.fromJson(map); if (entity.errorCode == -1001) { YToast.show(context: context, msg: entity.errorMsg); @@ -244,7 +250,7 @@ class _TreeDetailPageState extends State with TickerProviderStat Future cancelCollect(int id) async { var collectResponse = await HttpUtil().post(Api.UN_COLLECT_ORIGIN_ID + '$id/json'); - Map map = json.decode(collectResponse.toString()); + Map map = json.decode(collectResponse.toString()); var entity = CommonEntity.fromJson(map); if (entity.errorCode == -1001) { YToast.show(context: context, msg: entity.errorMsg); @@ -259,12 +265,12 @@ class _TreeDetailPageState extends State with TickerProviderStat } Future getMoreData() async { - var data = {"cid": _tabDatas[_currentIndex].id}; + var data = {"cid": _tabDatas[_currentIndex].id ?? 0}; var response = await HttpUtil().get(Api.ARTICLE_LIST + "$_page/json", data: data); - Map articleMap = json.decode(response.toString()); + Map articleMap = json.decode(response.toString()); var articleEntity = ArticleEntity.fromJson(articleMap); setState(() { - articleDatas.addAll(articleEntity.data.datas); + articleDatas.addAll(articleEntity.data?.datas ?? []); }); } diff --git a/lib/pages/treePage.dart b/lib/pages/treePage.dart index f410b85..0e229fc 100644 --- a/lib/pages/treePage.dart +++ b/lib/pages/treePage.dart @@ -17,7 +17,7 @@ class TreePage extends StatefulWidget { } class _TreePageState extends State { - List _datas = List(); + List _datas = []; ScrollController _scrollController = ScrollController(); int _panelIndex = 0; //展开下标 List _icons = [ @@ -48,7 +48,7 @@ class _TreePageState extends State { void getHttp() async { try { var response = await HttpUtil().get(Api.TREE); - Map userMap = json.decode(response.toString()); + Map userMap = json.decode(response.toString()); var treeEntity = TreeEntity.fromJson(userMap); //遍历赋值isExpanded标识,默认全部合并 @@ -92,7 +92,7 @@ class _TreePageState extends State { return ListTile( contentPadding: EdgeInsets.all(10.0), title: Text( - treeData.name, + treeData.name ?? '', style: TextStyle(color: Theme.of(context).primaryColor), ), //取随机icon @@ -111,7 +111,7 @@ class _TreePageState extends State { ), ), //是否展开 - isExpanded: treeData.isExpanded, + isExpanded: treeData.isExpanded ?? false, ); }).toList(), ), @@ -134,7 +134,7 @@ class _TreePageState extends State { padding: EdgeInsets.symmetric(horizontal: 5.0), child: ListTile( title: Text( - treeData.children[i].name, + treeData.children[i].name ?? '', style: TextStyle(color: YColors.color_999), ), trailing: Icon( diff --git a/lib/util/ToastUtil.dart b/lib/util/ToastUtil.dart index 7140bae..4b5033f 100644 --- a/lib/util/ToastUtil.dart +++ b/lib/util/ToastUtil.dart @@ -7,14 +7,14 @@ import 'package:fluttertoast/fluttertoast.dart'; /// class YToast { static show({ - @required BuildContext context, - @required String msg, - Toast toastLength, + required BuildContext context, + required String msg, + Toast? toastLength, int timeInSecForIos = 1, double fontSize = 16.0, - ToastGravity gravity, - Color backgroundColor, - Color textColor, + ToastGravity? gravity, + Color? backgroundColor, + Color? textColor, }) { Fluttertoast.showToast( msg: msg, @@ -27,14 +27,14 @@ class YToast { } static showBottom({ - @required BuildContext context, - @required String msg, - Toast toastLength, + required BuildContext context, + required String msg, + Toast? toastLength, int timeInSecForIos = 1, double fontSize = 16.0, - ToastGravity gravity, - Color backgroundColor, - Color textColor, + ToastGravity? gravity, + Color? backgroundColor, + Color? textColor, }) { Fluttertoast.showToast( msg: msg, diff --git a/lib/util/themeProvide.dart b/lib/util/themeProvide.dart index 4b11fb1..87c08b6 100644 --- a/lib/util/themeProvide.dart +++ b/lib/util/themeProvide.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; class ThemeProvide with ChangeNotifier { - int _themeIndex; + int? _themeIndex; - int get value => _themeIndex; + int? get value => _themeIndex; ThemeProvide(); diff --git a/pubspec.lock b/pubspec.lock index 2f8ee37..a7ccc14 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,127 +5,143 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 - url: "https://pub.flutter-io.cn" + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 + url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.12.0" boolean_selector: dependency: transitive description: name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.flutter-io.cn" + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" + card_swiper: + dependency: "direct main" + description: + name: card_swiper + sha256: "21e52a144decbf0054e7cfed8bbe46fc89635e6c86b767eaccfe7d5aeba32528" + url: "https://pub.dev" + source: hosted + version: "3.0.1" characters: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c - url: "https://pub.flutter-io.cn" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.4.0" clock: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.flutter-io.cn" + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" collection: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 - url: "https://pub.flutter-io.cn" + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.19.1" cookie_jar: dependency: transitive description: name: cookie_jar sha256: d1cc6516a190ba667941f722b6365d202caff3dacb38de24268b8d6ff1ec8a1d - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "3.0.1" - cupertino_icons: - dependency: "direct main" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "942a4791cd385a68ccb3b32c71c427aba508a1bb949b86dff2adbe4049f16239" + url: "https://pub.dev" + source: hosted + version: "0.3.5" + crypto: + dependency: transitive description: - name: cupertino_icons - sha256: a937da4c006989739ceb4d10e3bd6cce64ca85d0fe287fc5b2b9f6ee757dcee6 - url: "https://pub.flutter-io.cn" + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "3.0.7" dio: dependency: "direct main" description: name: dio - sha256: "0894a098594263fe1caaba3520e3016d8a855caeb010a882273189cca10f11e9" - url: "https://pub.flutter-io.cn" + sha256: d90ee57923d1828ac14e492ca49440f65477f4bb1263575900be731a3dac66a9 + url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "5.9.0" dio_cookie_manager: dependency: "direct main" description: name: dio_cookie_manager - sha256: "326f2940d2dc48428350615b53cbda6904934e0900fbf791d36be0c72e05e39f" - url: "https://pub.flutter-io.cn" + sha256: b45f11c2fcbccf39c5952ab68910b3a155486c4fa730ceb4ce867c4943169ea1 + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78" + url: "https://pub.dev" + source: hosted + version: "2.1.1" easy_refresh: dependency: "direct main" description: name: easy_refresh - sha256: "4bf1e3bea60ca21ece286fcde16cdd64bdb7383b4901422a683404f77708c644" - url: "https://pub.flutter-io.cn" + sha256: "486e30abfcaae66c0f2c2798a10de2298eb9dc5e0bb7e1dba9328308968cae0c" + url: "https://pub.dev" source: hosted - version: "3.3.1" + version: "3.4.0" fake_async: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.flutter-io.cn" + sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" ffi: dependency: transitive description: name: ffi - sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 - url: "https://pub.flutter-io.cn" + sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.4" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" - url: "https://pub.flutter-io.cn" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "1.1.1" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" - flutter_page_indicator: - dependency: transitive - description: - name: flutter_page_indicator - sha256: a5b2992228c2827b69faed3977681a3f5c313c7f13d72272decbb2923d1d7176 - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.0.3" - flutter_swiper: - dependency: "direct main" - description: - name: flutter_swiper - sha256: e52a0e894abfa4099a5d4e5098a00597f3b55e25617cdd19e6fe6be5d24858c7 - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.6" flutter_test: dependency: "direct dev" description: flutter @@ -136,316 +152,427 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_webview_plugin: - dependency: "direct main" - description: - path: "." - ref: HEAD - resolved-ref: f85db45aedefeab4c1df75cfc4c35f62d3c1c629 - url: "https://github.com/nuc134r/flutter_webview_plugin.git" - source: git - version: "0.3.11" fluttertoast: dependency: "direct main" description: name: fluttertoast - sha256: "2f9c4d3f4836421f7067a28f8939814597b27614e021da9d63e5d3fb6e212d25" - url: "https://pub.flutter-io.cn" + sha256: "90778fe0497fe3a09166e8cf2e0867310ff434b794526589e77ec03cf08ba8e8" + url: "https://pub.dev" source: hosted - version: "8.2.1" + version: "8.2.14" http_parser: dependency: transitive description: name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.flutter-io.cn" + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + url: "https://pub.dev" source: hosted - version: "4.0.2" - js: + version: "10.0.8" + leak_tracker_flutter_testing: dependency: transitive description: - name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" - url: "https://pub.flutter-io.cn" + name: leak_tracker_flutter_testing + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "3.0.9" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" matcher: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" - url: "https://pub.flutter-io.cn" + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.17" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 - url: "https://pub.flutter-io.cn" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" - url: "https://pub.flutter-io.cn" + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.16.0" mime: dependency: transitive description: name: mime - sha256: "5041f313f4e30fbd70dee7c0403785a4ee270f75830f590e5983960fddf743e4" - url: "https://pub.flutter-io.cn" + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" source: hosted - version: "0.9.7" + version: "2.0.0" nested: dependency: transitive description: name: nested sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.0" path: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b - url: "https://pub.flutter-io.cn" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.9.1" path_drawing: dependency: transitive description: name: path_drawing sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977 - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "1.0.1" path_parsing: dependency: transitive description: name: path_parsing - sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf - url: "https://pub.flutter-io.cn" + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "3b4c1fc3aa55ddc9cd4aa6759984330d5c8e66aa7702a6223c61540dc6380c37" + url: "https://pub.dev" + source: hosted + version: "2.2.19" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd" + url: "https://pub.dev" + source: hosted + version: "2.4.2" path_provider_linux: dependency: transitive description: name: path_provider_linux - sha256: "2ae08f2216225427e64ad224a24354221c2c7907e448e6e0e8b57b1eb9f10ad1" - url: "https://pub.flutter-io.cn" + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" source: hosted - version: "2.1.10" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" - url: "https://pub.flutter-io.cn" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" source: hosted - version: "2.0.6" + version: "2.1.2" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: f53720498d5a543f9607db4b0e997c4b5438884de25b0f73098cc2671a51b130 - url: "https://pub.flutter-io.cn" + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.3.0" platform: dependency: transitive description: name: platform - sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" - url: "https://pub.flutter-io.cn" + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.6" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" - url: "https://pub.flutter-io.cn" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" source: hosted - version: "2.1.4" - process: - dependency: transitive - description: - name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" - url: "https://pub.flutter-io.cn" - source: hosted - version: "4.2.4" + version: "2.1.8" provider: dependency: "direct main" description: name: provider - sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f - url: "https://pub.flutter-io.cn" + sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" + url: "https://pub.dev" source: hosted - version: "6.0.5" - share: + version: "6.1.5+1" + share_plus: dependency: "direct main" description: - name: share - sha256: fc1647d0c3a8eb648dc6d91d2207e7976c1d941e2165a09cba7c805b0c24467e - url: "https://pub.flutter-io.cn" + name: share_plus + sha256: fce43200aa03ea87b91ce4c3ac79f0cecd52e2a7a56c7a4185023c271fbfa6da + url: "https://pub.dev" source: hosted - version: "0.6.5+4" + version: "10.1.4" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + sha256: cc012a23fc2d479854e6c80150696c4a5f5bb62cb89af4de1c505cf78d0a5d0b + url: "https://pub.dev" + source: hosted + version: "5.0.2" shared_preferences: dependency: "direct main" description: name: shared_preferences - sha256: "78528fd87d0d08ffd3e69551173c026e8eacc7b7079c82eb6a77413957b7e394" - url: "https://pub.flutter-io.cn" + sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" + url: "https://pub.dev" source: hosted - version: "2.0.20" + version: "2.5.3" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: ad423a80fe7b4e48b50d6111b3ea1027af0e959e49d485712e134863d9c1c521 - url: "https://pub.flutter-io.cn" + sha256: bd14436108211b0d4ee5038689a56d4ae3620fd72fd6036e113bf1345bc74d9e + url: "https://pub.dev" source: hosted - version: "2.0.17" + version: "2.4.13" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "1e755f8583229f185cfca61b1d80fb2344c9d660e1c69ede5450d8f478fa5310" - url: "https://pub.flutter-io.cn" + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.5.4" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "3a59ed10890a8409ad0faad7bb2957dab4b92b8fbe553257b05d30ed8af2c707" - url: "https://pub.flutter-io.cn" + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: fb5cf25c0235df2d0640ac1b1174f6466bd311f621574997ac59018a6664548d - url: "https://pub.flutter-io.cn" + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.4.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: "0dc2633f215a3d4aa3184c9b2c5766f4711e4e5a6b256e62aafee41f89f1bfb8" - url: "https://pub.flutter-io.cn" + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" source: hosted - version: "2.0.6" + version: "2.4.3" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "71bcd669bb9cdb6b39f22c4a7728b6d49e934f6cba73157ffa5a54f1eed67436" - url: "https://pub.flutter-io.cn" + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.4.1" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.flutter-io.cn" + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.1" stack_trace: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 - url: "https://pub.flutter-io.cn" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" - url: "https://pub.flutter-io.cn" + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.4" string_scanner: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.flutter-io.cn" + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.4.1" term_glyph: dependency: transitive description: name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.flutter-io.cn" + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.2.2" test_api: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 - url: "https://pub.flutter-io.cn" + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" source: hosted - version: "0.4.16" - transformer_page_view: + version: "0.7.4" + typed_data: dependency: transitive description: - name: transformer_page_view - sha256: "2210531bc4148831061c575070173f32693415be8bbbf5bd2159a38f2adff61c" - url: "https://pub.flutter-io.cn" + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" source: hosted - version: "0.1.6" - typed_data: + version: "1.4.0" + url_launcher_linux: dependency: transitive description: - name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" - url: "https://pub.flutter-io.cn" + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" + url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "2.4.1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + uuid: + dependency: transitive + description: + name: uuid + sha256: a11b666489b1954e01d992f3d601b1804a33937b5a8fe677bd26b8a9f96f96e8 + url: "https://pub.dev" + source: hosted + version: "4.5.2" vector_math: dependency: transitive description: name: vector_math sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.flutter-io.cn" + url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" + url: "https://pub.dev" + source: hosted + version: "14.3.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + webview_flutter: + dependency: "direct main" + description: + name: webview_flutter + sha256: c3e4fe614b1c814950ad07186007eff2f2e5dd2935eba7b9a9a1af8e5885f1ba + url: "https://pub.dev" + source: hosted + version: "4.13.0" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + sha256: "9a25f6b4313978ba1c2cda03a242eea17848174912cfb4d2d8ee84a556f248e3" + url: "https://pub.dev" + source: hosted + version: "4.10.1" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + sha256: "63d26ee3aca7256a83ccb576a50272edd7cfc80573a4305caa98985feb493ee0" + url: "https://pub.dev" + source: hosted + version: "2.14.0" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + sha256: fb46db8216131a3e55bcf44040ca808423539bc6732e7ed34fb6d8044e3d512f + url: "https://pub.dev" + source: hosted + version: "3.23.0" win32: dependency: transitive description: name: win32 - sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 - url: "https://pub.flutter-io.cn" + sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba" + url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "5.13.0" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 - url: "https://pub.flutter-io.cn" + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.1.0" sdks: - dart: ">=2.18.0 <3.0.0" - flutter: ">=3.0.0" + dart: ">=3.7.0 <4.0.0" + flutter: ">=3.29.0" diff --git a/pubspec.yaml b/pubspec.yaml index 05e7436..fc01340 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,7 @@ description: wanandroid_flutter version: 1.0.0+1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: flutter: @@ -22,7 +22,6 @@ 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 # https://github.com/PonnamKarthik/FlutterToast fluttertoast: ^8.2.1 @@ -33,16 +32,14 @@ dependencies: # https://pub.dev/packages/dio_cookie_manager dio_cookie_manager: ^2.0.0 - # https://pub.dev/packages/flutter_webview_plugin#-readme-tab -# flutter_webview_/\plugin: ^0.4.0 - flutter_webview_plugin: - git: https://github.com/nuc134r/flutter_webview_plugin.git + # WebView (null-safety) + webview_flutter: ^4.8.0 - # https://github.com/best-flutter/flutter_swiper - flutter_swiper: ^1.1.6 + # Swiper (null-safety replacement) + card_swiper: ^3.0.1 - # https://github.com/flutter/plugins/tree/master/packages/share - share: ^0.6.1+1 + # Share (null-safety replacement) + share_plus: ^10.0.0 # https://github.com/google/flutter-provide # provide: ^1.0.2 diff --git a/screenshot/ios/1.png b/screenshot/ios/1.png old mode 100755 new mode 100644 diff --git a/screenshot/ios/2.png b/screenshot/ios/2.png old mode 100755 new mode 100644 diff --git a/screenshot/ios/3.png b/screenshot/ios/3.png old mode 100755 new mode 100644 diff --git a/screenshot/ios/4.png b/screenshot/ios/4.png old mode 100755 new mode 100644 diff --git a/screenshot/ios/5.png b/screenshot/ios/5.png old mode 100755 new mode 100644 diff --git a/screenshot/ios/6.png b/screenshot/ios/6.png old mode 100755 new mode 100644 diff --git a/screenshot/ios/7.png b/screenshot/ios/7.png old mode 100755 new mode 100644 diff --git a/screenshot/ios/8.png b/screenshot/ios/8.png old mode 100755 new mode 100644 diff --git a/test/test/widget_test.dart b/test/test/widget_test.dart new file mode 100644 index 0000000..26e690e --- /dev/null +++ b/test/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility that Flutter provides. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:wanandroid_flutter/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(MyApp(0)); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +}