├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── dio_wanandroid
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
├── lib
├── api
│ └── api.dart
├── config
│ ├── key.dart
│ └── routeConfig.dart
├── constant
│ └── cdn_image.dart
├── dio_util
│ ├── base_response_entity.dart
│ ├── dio_cache_interceptors.dart
│ ├── dio_interceptors.dart
│ ├── dio_method.dart
│ ├── dio_response.dart
│ ├── dio_token_interceptors.dart
│ ├── dio_transformer.dart
│ └── dio_util.dart
├── generated
│ └── json
│ │ ├── article_list_entity.g.dart
│ │ ├── banner_home_entity.g.dart
│ │ └── base
│ │ ├── json_convert_content.dart
│ │ └── json_field.dart
├── main.dart
├── model
│ ├── article_list_entity.dart
│ └── banner_home_entity.dart
├── pages
│ ├── home
│ │ ├── Home.dart
│ │ └── components
│ │ │ ├── ArticleList.dart
│ │ │ └── Banner.dart
│ ├── profile
│ │ └── Profile.dart
│ └── webview
│ │ └── web_view.dart
├── utils
│ ├── color.dart
│ ├── cpoyPaste.dart
│ ├── fluro_convert.dart
│ ├── fontSize.dart
│ ├── log_util.dart
│ ├── navigator_util.dart
│ └── system_util.dart
└── widget
│ ├── cacheImage
│ └── cacheImageNetwork.dart
│ ├── empty.dart
│ ├── footer.dart
│ ├── labelFiled.dart
│ └── testGridView.dart
├── linux
├── .gitignore
├── CMakeLists.txt
├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── main.cc
├── my_application.cc
└── my_application.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── app_icon_1024.png
│ │ ├── app_icon_128.png
│ │ ├── app_icon_16.png
│ │ ├── app_icon_256.png
│ │ ├── app_icon_32.png
│ │ ├── app_icon_512.png
│ │ └── app_icon_64.png
│ ├── Base.lproj
│ └── MainMenu.xib
│ ├── Configs
│ ├── AppInfo.xcconfig
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
├── pubspec.lock
├── pubspec.yaml
├── test
└── widget_test.dart
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── index.html
└── manifest.json
└── windows
├── .gitignore
├── CMakeLists.txt
├── flutter
├── CMakeLists.txt
├── generated_plugin_registrant.cc
├── generated_plugin_registrant.h
└── generated_plugins.cmake
└── runner
├── CMakeLists.txt
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── resources
└── app_icon.ico
├── runner.exe.manifest
├── utils.cpp
├── utils.h
├── win32_window.cpp
└── win32_window.h
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: 9944297138845a94256f1cf37beb88ff9a8e811a
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
17 | base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
18 | - platform: android
19 | create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
20 | base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
21 | - platform: ios
22 | create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
23 | base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
24 | - platform: linux
25 | create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
26 | base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
27 | - platform: macos
28 | create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
29 | base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
30 | - platform: web
31 | create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
32 | base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
33 | - platform: windows
34 | create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
35 | base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # dio_wanandroid
2 |
3 | ## apifox mock 示例项目:https://github.com/TopAlien/flutter_stu
4 |
5 | ## 笔记📒 https://www.yuque.com/danengmao-vljms/neng/ivxgtz
6 |
7 | ## 滚动多个Scrollable
8 | - 使用CustomScrollView
9 | - 禁用一个滚动 physics: const NeverScrollableScrollPhysics()
10 | - 列表高度固定,或者 shrinkWrap设置为true
11 | - 要将普通widget加入可以使用 SliverToBoxAdapter 适配
12 | `
13 | CustomScrollView 组合 Sliver 的原理是为所有子 Sliver 提供一个共享的 Scrollable,然后统一处理指定滑动方向的滑动事件。
14 | CustomScrollView 和 ListView、GridView、PageView 一样,都是完整的可滚动组件(同时拥有 Scrollable、Viewport、Sliver)。
15 | CustomScrollView 只能组合 Sliver,如果有孩子也是一个完整的可滚动组件(通过 SliverToBoxAdapter 嵌入)且它们的滑动方向一致时便不能正常工作。
16 | `
17 |
18 | ## 返回上一层setState时内存泄露,除非[mount]为true,否则调用[setState]是错误的 使用:
19 | `
20 | if (mounted) {
21 | }
22 | `
23 |
24 | ## ios使用webView 时 info.plist 中注册
25 | `
26 | io.flutter.embedded_views_preview
27 | YES
28 | `
29 |
30 | ## 实体类使用 FlutterJsonBeanFactory 生成
31 | ### 接口使用 https://www.wanandroid.com/blog/show/2 模拟
32 | - [x] Dio请求封装
33 | - [x] Getx路由配置
34 | - [x] webView跳转
35 | - [x] TabBar状态保存
36 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion flutter.compileSdkVersion
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "com.example.dio_wanandroid"
48 | // You can update the following values to match your application needs.
49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
50 | minSdkVersion flutter.minSdkVersion
51 | targetSdkVersion flutter.targetSdkVersion
52 | versionCode flutterVersionCode.toInteger()
53 | versionName flutterVersionName
54 | }
55 |
56 | buildTypes {
57 | release {
58 | // TODO: Add your own signing config for the release build.
59 | // Signing with the debug keys for now, so `flutter run --release` works.
60 | signingConfig signingConfigs.debug
61 | }
62 | }
63 | }
64 |
65 | flutter {
66 | source '../..'
67 | }
68 |
69 | dependencies {
70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
71 | }
72 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/dio_wanandroid/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.dio_wanandroid
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.2.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - path_provider_foundation (0.0.1):
4 | - Flutter
5 | - FlutterMacOS
6 | - shared_preferences_foundation (0.0.1):
7 | - Flutter
8 | - FlutterMacOS
9 | - webview_flutter_wkwebview (0.0.1):
10 | - Flutter
11 |
12 | DEPENDENCIES:
13 | - Flutter (from `Flutter`)
14 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
15 | - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
16 | - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
17 |
18 | EXTERNAL SOURCES:
19 | Flutter:
20 | :path: Flutter
21 | path_provider_foundation:
22 | :path: ".symlinks/plugins/path_provider_foundation/ios"
23 | shared_preferences_foundation:
24 | :path: ".symlinks/plugins/shared_preferences_foundation/ios"
25 | webview_flutter_wkwebview:
26 | :path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
27 |
28 | SPEC CHECKSUMS:
29 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
30 | path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9
31 | shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
32 | webview_flutter_wkwebview: d08f59cde5e8402c345c0bdda35ac0031352dcae
33 |
34 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
35 |
36 | COCOAPODS: 1.11.2
37 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TopAlien/Flutter_DIO/1b4fae51a51769a8317ec78b6d140942a2896fec/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Dio Wanandroid
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | dio_wanandroid
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 | io.flutter.embedded_views_preview
51 | YES
52 |
53 |
54 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/api/api.dart:
--------------------------------------------------------------------------------
1 | class Api {
2 | static String BASE_URL = "https://www.wanandroid.com";
3 |
4 | /// 文章列表 - 参数:页码,拼接在连接中,从0开始。
5 | static String articleApi = "/article/list/0/json";
6 |
7 | /// 置顶文章
8 | static String topArticleApi = "/article/top/json";
9 |
10 | /// 首页Banner
11 | static String bannerApi = "/banner/json";
12 |
13 | /// 常用网站
14 | static String everySiteApi = "/friend/json";
15 |
16 | /// 搜索热词
17 | static String hotkeyApi = "/hotkey/json";
18 |
19 | /// 体系数据
20 | static String treeApi = "/tree/json";
21 |
22 | /// 体系下的文章 - cid 分类的id,上述二级目录的id;页码:拼接在链接上,从0开始
23 | static String tree2ArticleApi = "/article/list/0/json?cid=60";
24 |
25 | /// 根据作者搜索文章 - 页码:拼接在链接上,从0开始; author:作者昵称,不支持模糊匹配。
26 | static String articleByAuthorApi = "/article/list/0/json?author=鸿洋";
27 |
28 | }
--------------------------------------------------------------------------------
/lib/config/key.dart:
--------------------------------------------------------------------------------
1 | class AppKey {
2 | /// 极光appKey
3 | static const String jPushAppKey = 'd44a4c3dc0eefc075bbcdbaa';
4 |
5 | /// MobTech appKey
6 | static const String mobTechAppKey = '367d785a92f96';
7 |
8 | /// MobTech app Secret
9 | static const String mobTechAppSecret = '9365a81c13dca4fa30020ab808eaec59';
10 | }
11 |
--------------------------------------------------------------------------------
/lib/config/routeConfig.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio_wanandroid/pages/profile/Profile.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:get/get.dart';
4 | import 'package:dio_wanandroid/pages/home/Home.dart';
5 | import 'package:dio_wanandroid/pages/webview/web_view.dart';
6 |
7 | abstract class RouteConfig {
8 | /// webView
9 | ///
10 | /// Get.arguments { webUrl }
11 | static const webView = '/webView';
12 |
13 | /// 404页面
14 | // static final unknownPage = GetPage(name: '/notFound', page: () => const UnknownPage());
15 |
16 | static List tabPages = [const HomePage(), const Profile()];
17 |
18 | static List tabItems = [
19 | const BottomNavigationBarItem(
20 | icon: Icon(
21 | Icons.home,
22 | ),
23 | label: "首页",
24 | ),
25 | const BottomNavigationBarItem(
26 | icon: Icon(
27 | Icons.accessibility,
28 | ),
29 | label: "我的",
30 | ),
31 | ];
32 |
33 | /// 路由
34 | static final routes = [
35 | GetPage(
36 | name: webView,
37 | page: () => const MyWebView(),
38 | ),
39 | ];
40 |
41 | static jumpWebView(String webUrl) {
42 | Get.toNamed(webView, arguments: {"webUrl": webUrl});
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/lib/constant/cdn_image.dart:
--------------------------------------------------------------------------------
1 | class CdnImage {
2 | /// 分享海报图
3 | static const String posterImgFormaldehyde = '';
4 |
5 | /// 底部Logo
6 | static const String bottomLogo = '';
7 | }
8 |
--------------------------------------------------------------------------------
/lib/dio_util/base_response_entity.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 | import 'package:dio_wanandroid/generated/json/base/json_convert_content.dart';
3 |
4 | class BaseResponseEntity {
5 |
6 | late T data;
7 | late int errorCode;
8 | late String errorMsg;
9 |
10 | BaseResponseEntity();
11 |
12 | factory BaseResponseEntity.fromJson(Map json) => $BaseResponseEntityFromJson(json);
13 |
14 | Map toJson() => $BaseResponseEntityToJson(this);
15 |
16 | BaseResponseEntity copyWith({T? data, int? errorCode, String? errorMsg}) {
17 | return BaseResponseEntity()..data= data ?? this.data
18 | ..errorCode= errorCode ?? this.errorCode
19 | ..errorMsg= errorMsg ?? this.errorMsg;
20 | }
21 |
22 | @override
23 | String toString() {
24 | return jsonEncode(this);
25 | }
26 | }
27 |
28 | BaseResponseEntity $BaseResponseEntityFromJson(Map json) {
29 | final BaseResponseEntity baseResponseEntity = BaseResponseEntity();
30 | final T? data = JsonConvert.fromJsonAsT(json['data']);
31 | if (data != null) {
32 | baseResponseEntity.data = data;
33 | }
34 | final int? errorCode = jsonConvert.convert(json['errorCode']);
35 | if (errorCode != null) {
36 | baseResponseEntity.errorCode = errorCode;
37 | }
38 | final String? errorMsg = jsonConvert.convert(json['errorMsg']);
39 | if (errorMsg != null) {
40 | baseResponseEntity.errorMsg = errorMsg;
41 | }
42 | return baseResponseEntity;
43 | }
44 |
45 | Map $BaseResponseEntityToJson(BaseResponseEntity entity) {
46 | final Map data = {};
47 | data['data'] = entity.data;
48 | data['errorCode'] = entity.errorCode;
49 | data['errorMsg'] = entity.errorMsg;
50 | return data;
51 | }
--------------------------------------------------------------------------------
/lib/dio_util/dio_cache_interceptors.dart:
--------------------------------------------------------------------------------
1 | import 'dart:collection';
2 | import 'package:dio/dio.dart';
3 | import 'package:dio_wanandroid/dio_util/dio_util.dart';
4 | import 'package:shared_preferences/shared_preferences.dart';
5 |
6 | class CacheObject {
7 | CacheObject(this.response)
8 | : timeStamp = DateTime.now().millisecondsSinceEpoch;
9 | Response response;
10 | int timeStamp;
11 |
12 | @override
13 | bool operator ==(other) {
14 | return response.hashCode == other.hashCode;
15 | }
16 |
17 | @override
18 | int get hashCode => response.realUri.hashCode;
19 | }
20 |
21 | class DioCacheInterceptors extends Interceptor {
22 | // 为确保迭代器顺序和对象插入时间一致顺序一致,我们使用LinkedHashMap
23 | var cache = LinkedHashMap();
24 | // sp
25 | SharedPreferences? preferences;
26 |
27 | @override
28 | void onRequest(
29 | RequestOptions options, RequestInterceptorHandler handler) async {
30 | if (!DioUtil.CACHE_ENABLE) return super.onRequest(options, handler);
31 | // 是否刷新缓存
32 | bool refresh = options.extra["refresh"] == true;
33 |
34 | if (refresh) {
35 | // 删除本地缓存
36 | delete(options.uri.toString());
37 | }
38 | // 只有get请求才开启缓存
39 | if (options.extra["noCache"] != true &&
40 | options.method.toLowerCase() == 'get') {
41 | String key = options.extra["cacheKey"] ?? options.uri.toString();
42 | var ob = cache[key];
43 | if (ob != null) {
44 | // 内存缓存
45 | if ((DateTime.now().millisecondsSinceEpoch - ob.timeStamp) / 1000 <
46 | DioUtil.MAX_CACHE_AGE) {
47 | return handler.resolve(cache[key]!.response);
48 | } else {
49 | //若已过期则删除缓存,继续向服务器请求
50 | cache.remove(key);
51 | }
52 |
53 | // 磁盘缓存
54 | }
55 | }
56 | super.onRequest(options, handler);
57 | }
58 |
59 | @override
60 | void onResponse(Response response, ResponseInterceptorHandler handler) {
61 | // 把响应的数据保存到缓存
62 | if (DioUtil.CACHE_ENABLE) {
63 | _saveCache(response);
64 | }
65 |
66 | super.onResponse(response, handler);
67 | }
68 |
69 | @override
70 | void onError(DioError err, ErrorInterceptorHandler handler) {
71 | // TODO: implement onError
72 | super.onError(err, handler);
73 | }
74 |
75 | _saveCache(Response object) {
76 | RequestOptions options = object.requestOptions;
77 | if (options.extra["noCache"] != true &&
78 | options.method.toLowerCase() == "get") {
79 | // 如果缓存数量超过最大数量限制,则先移除最早的一条记录
80 | if (cache.length == DioUtil.MAX_CACHE_COUNT) {
81 | cache.remove(cache[cache.keys.first]);
82 | }
83 | String key = options.extra["cacheKey"] ?? options.uri.toString();
84 | cache[key] = CacheObject(object);
85 | }
86 | }
87 |
88 | void delete(String key) {
89 | cache.remove(key);
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/lib/dio_util/dio_interceptors.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:dio/dio.dart';
4 |
5 | class DioInterceptors extends Interceptor {
6 | @override
7 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
8 | // 对非open的接口的请求参数全部增加userId
9 | // if (!options.path.contains("open")) {
10 | // options.queryParameters["userId"] = "xxx";
11 | // }
12 |
13 | // 头部添加token
14 | options.headers["token"] = "xxx";
15 |
16 | super.onRequest(options, handler);
17 | }
18 |
19 | @override
20 | void onResponse(Response response, ResponseInterceptorHandler handler) async {
21 | // 请求成功是对数据做基本处理 例子: 统一格式,增加默认值
22 | // if (response.statusCode == 200) {
23 | // response.data = DioResponse(code: 0, msg: "请求成功啦", data: response.data);
24 | // } else {
25 | // response.data = DioResponse(code: 1, msg: "请求失败啦", data: response.data);
26 | // }
27 |
28 | // 对某些单独的url返回数据做特殊处理
29 | // if (response.requestOptions.baseUrl.contains("???????")) {
30 | // //....
31 | // }
32 |
33 | // 根据公司的业务需求进行定制化处理
34 | super.onResponse(response, handler);
35 | }
36 |
37 | @override
38 | void onError(DioError err, ErrorInterceptorHandler handler) {
39 | switch (err.type) {
40 | // 连接服务器超时
41 | case DioErrorType.connectionTimeout:
42 | {
43 | // 根据自己的业务需求来设定该如何操作,可以是弹出框提示/或者做一些路由跳转处理
44 | }
45 | break;
46 | // 响应超时
47 | case DioErrorType.receiveTimeout:
48 | {
49 | // 根据自己的业务需求来设定该如何操作,可以是弹出框提示/或者做一些路由跳转处理
50 | }
51 | break;
52 | // 发送超时
53 | case DioErrorType.sendTimeout:
54 | {
55 | // 根据自己的业务需求来设定该如何操作,可以是弹出框提示/或者做一些路由跳转处理
56 | }
57 | break;
58 | // 请求取消
59 | case DioErrorType.cancel:
60 | {
61 | // 根据自己的业务需求来设定该如何操作,可以是弹出框提示/或者做一些路由跳转处理
62 | }
63 | break;
64 | // 404/503错误
65 | case DioErrorType.badResponse:
66 | {
67 | // 根据自己的业务需求来设定该如何操作,可以是弹出框提示/或者做一些路由跳转处理
68 | }
69 | break;
70 | case DioErrorType.badCertificate:
71 | {}
72 | break;
73 | case DioErrorType.connectionError:
74 | {}
75 | break;
76 | // other 其他错误类型
77 | case DioErrorType.unknown:
78 | {}
79 | break;
80 | }
81 | super.onError(err, handler);
82 | }
83 | }
84 |
85 | Map parseData(String data) {
86 | return json.decode(data) as Map;
87 | }
88 |
--------------------------------------------------------------------------------
/lib/dio_util/dio_method.dart:
--------------------------------------------------------------------------------
1 | enum DioMethod {
2 | get,
3 | post,
4 | put,
5 | delete,
6 | patch,
7 | head,
8 | }
9 |
--------------------------------------------------------------------------------
/lib/dio_util/dio_response.dart:
--------------------------------------------------------------------------------
1 | class DioResponse {
2 | /// 消息(例如成功消息文字/错误消息文字)
3 | final String? msg;
4 |
5 | /// 自定义code(可根据内部定义方式)
6 | final int? code;
7 |
8 | /// 接口返回的数据
9 | final T? data;
10 |
11 | /// 需要添加更多
12 | /// .........
13 |
14 | DioResponse({
15 | this.msg,
16 | this.data,
17 | this.code,
18 | });
19 |
20 | @override
21 | String toString() {
22 | StringBuffer sb = StringBuffer('{');
23 | sb.write("\"message\":\"$msg\"");
24 | sb.write(",\"errorMsg\":\"$code\"");
25 | sb.write(",\"data\":\"$data\"");
26 | sb.write('}');
27 | return sb.toString();
28 | }
29 | }
30 |
31 | class DioResponseCode {
32 | /// 成功
33 | static const int SUCCESS = 0;
34 |
35 | /// 错误
36 | static const int ERROR = 1;
37 |
38 | /// 更多
39 | }
40 |
--------------------------------------------------------------------------------
/lib/dio_util/dio_token_interceptors.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:dio_wanandroid/dio_util/dio_util.dart';
3 |
4 | class DioTokenInterceptors extends Interceptor {
5 | @override
6 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
7 | if (options.headers['refreshToken'] == null) {
8 | // DioUtil.getInstance()?.dio.lock();
9 | Dio tokenDio = Dio();
10 | // tokenDio..get("http://localhost:8080/getRefreshToken").then((d) {
11 | // options.headers['refreshToken'] = d;
12 | // handler.next(options);
13 | // }).catchError((error, stackTrace) {
14 | // handler.reject(error, true);
15 | // }) .whenComplete(() {
16 | // DioUtil.getInstance()?.dio.unlock();
17 | // }); // unlock the dio
18 | } else {
19 | options.headers['refreshToken'] = options.headers['refreshToken'];
20 | handler.next(options);
21 | }
22 | }
23 |
24 | @override
25 | void onResponse(Response response, ResponseInterceptorHandler handler) async {
26 | // 响应前需要做刷新token的操作
27 |
28 | super.onResponse(response, handler);
29 | }
30 |
31 | @override
32 | void onError(DioError err, ErrorInterceptorHandler handler) {
33 | super.onError(err, handler);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/lib/dio_util/dio_transformer.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:dio/dio.dart';
3 |
4 | class DioTransformer extends DefaultTransformer {
5 | @override
6 | Future transformRequest(RequestOptions options) async {
7 | // 如果请求的数据接口是List那我们直接抛出异常
8 | if (options.data is List) {
9 | throw DioError(
10 | error: "你不能直接发送List数据到服务器",
11 | requestOptions: options,
12 | );
13 | } else {
14 | return super.transformRequest(options);
15 | }
16 | }
17 |
18 | @override
19 | Future transformResponse(
20 | RequestOptions options, ResponseBody response) async {
21 | // 例如我们响应选项里面没有自定义某些头部数据,那我们就可以自行添加
22 | options.extra['myHeader'] = 'abc';
23 | return super.transformResponse(options, response);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/lib/dio_util/dio_util.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:dio/dio.dart';
4 | import 'package:dio_wanandroid/api/api.dart';
5 | import 'package:dio_wanandroid/dio_util/dio_interceptors.dart';
6 | import 'package:dio_wanandroid/dio_util/dio_method.dart';
7 | import 'package:dio_wanandroid/dio_util/base_response_entity.dart';
8 | import 'package:pretty_dio_logger/pretty_dio_logger.dart';
9 |
10 | class DioUtil {
11 | /// 连接超时时间
12 | static const int CONNECT_TIMEOUT = 6;
13 |
14 | /// 响应超时时间
15 | static const int RECEIVE_TIMEOUT = 6;
16 |
17 | /// 请求的URL前缀
18 | static String BASE_URL = Api.BASE_URL;
19 |
20 | /// 是否开启网络缓存,默认false
21 | static bool CACHE_ENABLE = false;
22 |
23 | /// 最大缓存时间(按秒), 默认缓存七天,可自行调节
24 | static int MAX_CACHE_AGE = 7 * 24 * 60 * 60;
25 |
26 | /// 最大缓存条数(默认一百条)
27 | static int MAX_CACHE_COUNT = 100;
28 |
29 | static DioUtil? _instance;
30 | static Dio _dio = Dio();
31 | Dio get dio => _dio;
32 |
33 | DioUtil._internal() {
34 | _instance = this;
35 | _instance!._init();
36 | }
37 |
38 | factory DioUtil() => _instance ?? DioUtil._internal();
39 |
40 | static DioUtil? getInstance() {
41 | _instance ?? DioUtil._internal();
42 | return _instance;
43 | }
44 |
45 | /// 取消请求token
46 | final CancelToken _cancelToken = CancelToken();
47 |
48 | /// cookie
49 | // CookieJar cookieJar = CookieJar();
50 |
51 | _init() {
52 | /// 初始化基本选项
53 | BaseOptions options = BaseOptions(
54 | baseUrl: BASE_URL,
55 | connectTimeout: const Duration(seconds: CONNECT_TIMEOUT),
56 | receiveTimeout: const Duration(seconds: RECEIVE_TIMEOUT),
57 | );
58 |
59 | /// 初始化dio
60 | _dio = Dio(options);
61 |
62 | /// 添加拦截器
63 | _dio.interceptors.add(DioInterceptors());
64 | // openLog();
65 |
66 | /// 添加转换器
67 | // _dio.transformer = DioTransformer();
68 |
69 | // /// 添加cookie管理器
70 | // _dio.interceptors.add(CookieManager(cookieJar));
71 | //
72 | // /// 刷新token拦截器(lock/unlock)
73 | // _dio.interceptors.add(DioTokenInterceptors());
74 | //
75 | // /// 添加缓存拦截器
76 | // _dio.interceptors.add(DioCacheInterceptors());
77 | }
78 |
79 | /// 设置Http代理(设置即开启)
80 | // void setProxy({
81 | // String? proxyAddress,
82 | // bool enable = false
83 | // }) {
84 | // if (enable) {
85 | // (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
86 | // (HttpClient client) {
87 | // client.findProxy = (uri) {
88 | // return proxyAddress ?? "";
89 | // };
90 | // client.badCertificateCallback =
91 | // (X509Certificate cert, String host, int port) => true;
92 | // };
93 | // }
94 | // }
95 |
96 | /// 设置https证书校验
97 | // void setHttpsCertificateVerification({
98 | // String? pem,
99 | // bool enable = false
100 | // }) {
101 | // if (enable) {
102 | // (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
103 | // client.badCertificateCallback=(X509Certificate cert, String host, int port){
104 | // if(cert.pem==pem){ // 验证证书
105 | // return true;
106 | // }
107 | // return false;
108 | // };
109 | // };
110 | // }
111 | // }
112 |
113 | /// 开启日志打印
114 | void openLog() {
115 | _dio.interceptors.add(PrettyDioLogger(
116 | requestBody: true,
117 | requestHeader: true,
118 | responseBody: true,
119 | error: true,
120 | // responseHeader: true,
121 | // compact: true,
122 | ));
123 | }
124 |
125 | /// 请求类
126 | Future request(
127 | String path, {
128 | DioMethod method = DioMethod.get,
129 | Map? params,
130 | data,
131 | CancelToken? cancelToken,
132 | Options? options,
133 | ProgressCallback? onSendProgress,
134 | ProgressCallback? onReceiveProgress,
135 | }) async {
136 | const _methodValues = {
137 | DioMethod.get: 'get',
138 | DioMethod.post: 'post',
139 | DioMethod.put: 'put',
140 | DioMethod.delete: 'delete',
141 | DioMethod.patch: 'patch',
142 | DioMethod.head: 'head'
143 | };
144 |
145 | options ??= Options(method: _methodValues[method]);
146 |
147 | try {
148 | Response response;
149 | response = await _dio.request(
150 | path,
151 | data: data,
152 | queryParameters: params,
153 | cancelToken: cancelToken ?? _cancelToken,
154 | options: options,
155 | onSendProgress: onSendProgress,
156 | onReceiveProgress: onReceiveProgress,
157 | );
158 |
159 | BaseResponseEntity apiResponse =
160 | BaseResponseEntity.fromJson(response.data);
161 |
162 | return apiResponse.data;
163 | } on DioError catch (e) {
164 | throw e;
165 | }
166 | }
167 |
168 | /// 取消网络请求
169 | void cancelRequests({CancelToken? token}) {
170 | token ?? _cancelToken.cancel("cancelled");
171 | }
172 | }
173 |
174 | Map parseData(String data) {
175 | return json.decode(data) as Map;
176 | }
177 |
--------------------------------------------------------------------------------
/lib/generated/json/article_list_entity.g.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio_wanandroid/generated/json/base/json_convert_content.dart';
2 | import 'package:dio_wanandroid/model/article_list_entity.dart';
3 |
4 | ArticleListEntity $ArticleListEntityFromJson(Map json) {
5 | final ArticleListEntity articleListEntity = ArticleListEntity();
6 | final int? curPage = jsonConvert.convert(json['curPage']);
7 | if (curPage != null) {
8 | articleListEntity.curPage = curPage;
9 | }
10 | final List? datas = jsonConvert.convertListNotNull(json['datas']);
11 | if (datas != null) {
12 | articleListEntity.datas = datas;
13 | }
14 | final int? offset = jsonConvert.convert(json['offset']);
15 | if (offset != null) {
16 | articleListEntity.offset = offset;
17 | }
18 | final bool? over = jsonConvert.convert(json['over']);
19 | if (over != null) {
20 | articleListEntity.over = over;
21 | }
22 | final int? pageCount = jsonConvert.convert(json['pageCount']);
23 | if (pageCount != null) {
24 | articleListEntity.pageCount = pageCount;
25 | }
26 | final int? size = jsonConvert.convert(json['size']);
27 | if (size != null) {
28 | articleListEntity.size = size;
29 | }
30 | final int? total = jsonConvert.convert(json['total']);
31 | if (total != null) {
32 | articleListEntity.total = total;
33 | }
34 | return articleListEntity;
35 | }
36 |
37 | Map $ArticleListEntityToJson(ArticleListEntity entity) {
38 | final Map data = {};
39 | data['curPage'] = entity.curPage;
40 | data['datas'] = entity.datas.map((v) => v.toJson()).toList();
41 | data['offset'] = entity.offset;
42 | data['over'] = entity.over;
43 | data['pageCount'] = entity.pageCount;
44 | data['size'] = entity.size;
45 | data['total'] = entity.total;
46 | return data;
47 | }
48 |
49 | ArticleListDatas $ArticleListDatasFromJson(Map json) {
50 | final ArticleListDatas articleListDatas = ArticleListDatas();
51 | final bool? adminAdd = jsonConvert.convert(json['adminAdd']);
52 | if (adminAdd != null) {
53 | articleListDatas.adminAdd = adminAdd;
54 | }
55 | final String? apkLink = jsonConvert.convert(json['apkLink']);
56 | if (apkLink != null) {
57 | articleListDatas.apkLink = apkLink;
58 | }
59 | final int? audit = jsonConvert.convert(json['audit']);
60 | if (audit != null) {
61 | articleListDatas.audit = audit;
62 | }
63 | final String? author = jsonConvert.convert(json['author']);
64 | if (author != null) {
65 | articleListDatas.author = author;
66 | }
67 | final bool? canEdit = jsonConvert.convert(json['canEdit']);
68 | if (canEdit != null) {
69 | articleListDatas.canEdit = canEdit;
70 | }
71 | final int? chapterId = jsonConvert.convert(json['chapterId']);
72 | if (chapterId != null) {
73 | articleListDatas.chapterId = chapterId;
74 | }
75 | final String? chapterName = jsonConvert.convert(json['chapterName']);
76 | if (chapterName != null) {
77 | articleListDatas.chapterName = chapterName;
78 | }
79 | final bool? collect = jsonConvert.convert(json['collect']);
80 | if (collect != null) {
81 | articleListDatas.collect = collect;
82 | }
83 | final int? courseId = jsonConvert.convert(json['courseId']);
84 | if (courseId != null) {
85 | articleListDatas.courseId = courseId;
86 | }
87 | final String? desc = jsonConvert.convert(json['desc']);
88 | if (desc != null) {
89 | articleListDatas.desc = desc;
90 | }
91 | final String? descMd = jsonConvert.convert(json['descMd']);
92 | if (descMd != null) {
93 | articleListDatas.descMd = descMd;
94 | }
95 | final String? envelopePic = jsonConvert.convert(json['envelopePic']);
96 | if (envelopePic != null) {
97 | articleListDatas.envelopePic = envelopePic;
98 | }
99 | final bool? fresh = jsonConvert.convert(json['fresh']);
100 | if (fresh != null) {
101 | articleListDatas.fresh = fresh;
102 | }
103 | final String? host = jsonConvert.convert(json['host']);
104 | if (host != null) {
105 | articleListDatas.host = host;
106 | }
107 | final int? id = jsonConvert.convert(json['id']);
108 | if (id != null) {
109 | articleListDatas.id = id;
110 | }
111 | final bool? isAdminAdd = jsonConvert.convert(json['isAdminAdd']);
112 | if (isAdminAdd != null) {
113 | articleListDatas.isAdminAdd = isAdminAdd;
114 | }
115 | final String? link = jsonConvert.convert(json['link']);
116 | if (link != null) {
117 | articleListDatas.link = link;
118 | }
119 | final String? niceDate = jsonConvert.convert(json['niceDate']);
120 | if (niceDate != null) {
121 | articleListDatas.niceDate = niceDate;
122 | }
123 | final String? niceShareDate = jsonConvert.convert(json['niceShareDate']);
124 | if (niceShareDate != null) {
125 | articleListDatas.niceShareDate = niceShareDate;
126 | }
127 | final String? origin = jsonConvert.convert(json['origin']);
128 | if (origin != null) {
129 | articleListDatas.origin = origin;
130 | }
131 | final String? prefix = jsonConvert.convert(json['prefix']);
132 | if (prefix != null) {
133 | articleListDatas.prefix = prefix;
134 | }
135 | final String? projectLink = jsonConvert.convert(json['projectLink']);
136 | if (projectLink != null) {
137 | articleListDatas.projectLink = projectLink;
138 | }
139 | final int? publishTime = jsonConvert.convert(json['publishTime']);
140 | if (publishTime != null) {
141 | articleListDatas.publishTime = publishTime;
142 | }
143 | final int? realSuperChapterId = jsonConvert.convert(json['realSuperChapterId']);
144 | if (realSuperChapterId != null) {
145 | articleListDatas.realSuperChapterId = realSuperChapterId;
146 | }
147 | final bool? route = jsonConvert.convert(json['route']);
148 | if (route != null) {
149 | articleListDatas.route = route;
150 | }
151 | final int? selfVisible = jsonConvert.convert(json['selfVisible']);
152 | if (selfVisible != null) {
153 | articleListDatas.selfVisible = selfVisible;
154 | }
155 | final int? shareDate = jsonConvert.convert(json['shareDate']);
156 | if (shareDate != null) {
157 | articleListDatas.shareDate = shareDate;
158 | }
159 | final String? shareUser = jsonConvert.convert(json['shareUser']);
160 | if (shareUser != null) {
161 | articleListDatas.shareUser = shareUser;
162 | }
163 | final int? superChapterId = jsonConvert.convert(json['superChapterId']);
164 | if (superChapterId != null) {
165 | articleListDatas.superChapterId = superChapterId;
166 | }
167 | final String? superChapterName = jsonConvert.convert(json['superChapterName']);
168 | if (superChapterName != null) {
169 | articleListDatas.superChapterName = superChapterName;
170 | }
171 | final List? tags = jsonConvert.convertListNotNull(json['tags']);
172 | if (tags != null) {
173 | articleListDatas.tags = tags;
174 | }
175 | final String? title = jsonConvert.convert(json['title']);
176 | if (title != null) {
177 | articleListDatas.title = title;
178 | }
179 | final int? type = jsonConvert.convert(json['type']);
180 | if (type != null) {
181 | articleListDatas.type = type;
182 | }
183 | final int? userId = jsonConvert.convert(json['userId']);
184 | if (userId != null) {
185 | articleListDatas.userId = userId;
186 | }
187 | final int? visible = jsonConvert.convert(json['visible']);
188 | if (visible != null) {
189 | articleListDatas.visible = visible;
190 | }
191 | final int? zan = jsonConvert.convert(json['zan']);
192 | if (zan != null) {
193 | articleListDatas.zan = zan;
194 | }
195 | return articleListDatas;
196 | }
197 |
198 | Map $ArticleListDatasToJson(ArticleListDatas entity) {
199 | final Map data = {};
200 | data['adminAdd'] = entity.adminAdd;
201 | data['apkLink'] = entity.apkLink;
202 | data['audit'] = entity.audit;
203 | data['author'] = entity.author;
204 | data['canEdit'] = entity.canEdit;
205 | data['chapterId'] = entity.chapterId;
206 | data['chapterName'] = entity.chapterName;
207 | data['collect'] = entity.collect;
208 | data['courseId'] = entity.courseId;
209 | data['desc'] = entity.desc;
210 | data['descMd'] = entity.descMd;
211 | data['envelopePic'] = entity.envelopePic;
212 | data['fresh'] = entity.fresh;
213 | data['host'] = entity.host;
214 | data['id'] = entity.id;
215 | data['isAdminAdd'] = entity.isAdminAdd;
216 | data['link'] = entity.link;
217 | data['niceDate'] = entity.niceDate;
218 | data['niceShareDate'] = entity.niceShareDate;
219 | data['origin'] = entity.origin;
220 | data['prefix'] = entity.prefix;
221 | data['projectLink'] = entity.projectLink;
222 | data['publishTime'] = entity.publishTime;
223 | data['realSuperChapterId'] = entity.realSuperChapterId;
224 | data['route'] = entity.route;
225 | data['selfVisible'] = entity.selfVisible;
226 | data['shareDate'] = entity.shareDate;
227 | data['shareUser'] = entity.shareUser;
228 | data['superChapterId'] = entity.superChapterId;
229 | data['superChapterName'] = entity.superChapterName;
230 | data['tags'] = entity.tags.map((v) => v.toJson()).toList();
231 | data['title'] = entity.title;
232 | data['type'] = entity.type;
233 | data['userId'] = entity.userId;
234 | data['visible'] = entity.visible;
235 | data['zan'] = entity.zan;
236 | return data;
237 | }
238 |
239 | ArticleListDatasTags $ArticleListDatasTagsFromJson(Map json) {
240 | final ArticleListDatasTags articleListDatasTags = ArticleListDatasTags();
241 | final String? name = jsonConvert.convert(json['name']);
242 | if (name != null) {
243 | articleListDatasTags.name = name;
244 | }
245 | final String? url = jsonConvert.convert(json['url']);
246 | if (url != null) {
247 | articleListDatasTags.url = url;
248 | }
249 | return articleListDatasTags;
250 | }
251 |
252 | Map $ArticleListDatasTagsToJson(ArticleListDatasTags entity) {
253 | final Map data = {};
254 | data['name'] = entity.name;
255 | data['url'] = entity.url;
256 | return data;
257 | }
--------------------------------------------------------------------------------
/lib/generated/json/banner_home_entity.g.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio_wanandroid/generated/json/base/json_convert_content.dart';
2 | import 'package:dio_wanandroid/model/banner_home_entity.dart';
3 |
4 | BannerHomeEntity $BannerHomeEntityFromJson(Map json) {
5 | final BannerHomeEntity bannerHomeEntity = BannerHomeEntity();
6 | final String? desc = jsonConvert.convert(json['desc']);
7 | if (desc != null) {
8 | bannerHomeEntity.desc = desc;
9 | }
10 | final double? id = jsonConvert.convert(json['id']);
11 | if (id != null) {
12 | bannerHomeEntity.id = id;
13 | }
14 | final String? imagePath = jsonConvert.convert(json['imagePath']);
15 | if (imagePath != null) {
16 | bannerHomeEntity.imagePath = imagePath;
17 | }
18 | final double? isVisible = jsonConvert.convert(json['isVisible']);
19 | if (isVisible != null) {
20 | bannerHomeEntity.isVisible = isVisible;
21 | }
22 | final double? order = jsonConvert.convert(json['order']);
23 | if (order != null) {
24 | bannerHomeEntity.order = order;
25 | }
26 | final String? title = jsonConvert.convert(json['title']);
27 | if (title != null) {
28 | bannerHomeEntity.title = title;
29 | }
30 | final double? type = jsonConvert.convert(json['type']);
31 | if (type != null) {
32 | bannerHomeEntity.type = type;
33 | }
34 | final String? url = jsonConvert.convert(json['url']);
35 | if (url != null) {
36 | bannerHomeEntity.url = url;
37 | }
38 | return bannerHomeEntity;
39 | }
40 |
41 | Map $BannerHomeEntityToJson(BannerHomeEntity entity) {
42 | final Map data = {};
43 | data['desc'] = entity.desc;
44 | data['id'] = entity.id;
45 | data['imagePath'] = entity.imagePath;
46 | data['isVisible'] = entity.isVisible;
47 | data['order'] = entity.order;
48 | data['title'] = entity.title;
49 | data['type'] = entity.type;
50 | data['url'] = entity.url;
51 | return data;
52 | }
--------------------------------------------------------------------------------
/lib/generated/json/base/json_convert_content.dart:
--------------------------------------------------------------------------------
1 | // ignore_for_file: non_constant_identifier_names
2 | // ignore_for_file: camel_case_types
3 | // ignore_for_file: prefer_single_quotes
4 |
5 | // This file is automatically generated. DO NOT EDIT, all your changes would be lost.
6 | import 'package:flutter/material.dart' show debugPrint;
7 | import 'package:dio_wanandroid/model/article_list_entity.dart';
8 | import 'package:dio_wanandroid/model/banner_home_entity.dart';
9 |
10 | JsonConvert jsonConvert = JsonConvert();
11 | typedef JsonConvertFunction = T Function(Map json);
12 | typedef EnumConvertFunction = T Function(String value);
13 |
14 | class JsonConvert {
15 | static final Map convertFuncMap = {
16 | (ArticleListEntity).toString(): ArticleListEntity.fromJson,
17 | (ArticleListDatas).toString(): ArticleListDatas.fromJson,
18 | (ArticleListDatasTags).toString(): ArticleListDatasTags.fromJson,
19 | (BannerHomeEntity).toString(): BannerHomeEntity.fromJson
20 | };
21 |
22 | T? convert(dynamic value, {EnumConvertFunction? enumConvert}) {
23 | if (value == null) {
24 | return null;
25 | }
26 | if (value is T) {
27 | return value;
28 | }
29 | try {
30 | return _asT(value, enumConvert: enumConvert);
31 | } catch (e, stackTrace) {
32 | debugPrint('asT<$T> $e $stackTrace');
33 | return null;
34 | }
35 | }
36 |
37 | List? convertList(List? value, {EnumConvertFunction? enumConvert}) {
38 | if (value == null) {
39 | return null;
40 | }
41 | try {
42 | return value.map((dynamic e) => _asT(e,enumConvert: enumConvert)).toList();
43 | } catch (e, stackTrace) {
44 | debugPrint('asT<$T> $e $stackTrace');
45 | return [];
46 | }
47 | }
48 |
49 | List? convertListNotNull(dynamic value, {EnumConvertFunction? enumConvert}) {
50 | if (value == null) {
51 | return null;
52 | }
53 | try {
54 | return (value as List).map((dynamic e) => _asT(e,enumConvert: enumConvert)!).toList();
55 | } catch (e, stackTrace) {
56 | debugPrint('asT<$T> $e $stackTrace');
57 | return [];
58 | }
59 | }
60 |
61 | T? _asT(dynamic value,
62 | {EnumConvertFunction? enumConvert}) {
63 | final String type = T.toString();
64 | final String valueS = value.toString();
65 | if (enumConvert != null) {
66 | return enumConvert(valueS) as T;
67 | } else if (type == "String") {
68 | return valueS as T;
69 | } else if (type == "int") {
70 | final int? intValue = int.tryParse(valueS);
71 | if (intValue == null) {
72 | return double.tryParse(valueS)?.toInt() as T?;
73 | } else {
74 | return intValue as T;
75 | }
76 | } else if (type == "double") {
77 | return double.parse(valueS) as T;
78 | } else if (type == "DateTime") {
79 | return DateTime.parse(valueS) as T;
80 | } else if (type == "bool") {
81 | if (valueS == '0' || valueS == '1') {
82 | return (valueS == '1') as T;
83 | }
84 | return (valueS == 'true') as T;
85 | } else if (type == "Map" || type.startsWith("Map<")) {
86 | return value as T;
87 | } else {
88 | if (convertFuncMap.containsKey(type)) {
89 | return convertFuncMap[type]!(Map.from(value)) as T;
90 | } else {
91 | throw UnimplementedError('$type unimplemented');
92 | }
93 | }
94 | }
95 |
96 | //list is returned by type
97 | static M? _getListChildType(List