├── .gitignore
├── .metadata
├── LICENSE
├── README.md
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── flutter_templete_mini
│ │ │ │ └── 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
├── assets
├── icons
│ └── iconfont.ttf
├── images
│ ├── docs
│ │ ├── login_dark.jpg
│ │ └── login_light.jpg
│ └── login
│ │ ├── logo.png
│ │ └── unpany.png
└── jsons
│ └── demo.json
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── 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
├── common
│ ├── my_color.dart
│ ├── my_init.dart
│ └── my_state.dart
├── db
│ └── my_sp.dart
├── http
│ ├── api.dart
│ └── request.dart
├── main.dart
├── models
│ └── demo_model.dart
├── navigator
│ └── my_navigator.dart
├── pages
│ ├── detail_page.dart
│ ├── home_page.dart
│ ├── login_page.dart
│ ├── me_page.dart
│ └── navigator_page.dart
├── provider
│ ├── my_provider.dart
│ └── theme_provider.dart
├── utils
│ ├── device_util.dart
│ └── string_util.dart
└── widgets
│ └── login_input.dart
├── pubspec.lock
└── pubspec.yaml
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | .vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Android Studio will place build artifacts here
44 | /android/app/debug
45 | /android/app/profile
46 | /android/app/release
47 |
--------------------------------------------------------------------------------
/.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 and should not be manually edited.
5 |
6 | version:
7 | revision: 18116933e77adc82f80866c928266a5b4f1ed645
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 UNPany
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## 简介
2 |
3 | 一个 APP 项目 mini 模板,提供 HTTP、路由、本地缓存等常用功能的封装
4 |
5 | ## 效果图
6 |
7 | 
8 | 
9 |
10 | ## 功能
11 |
12 | ```text
13 | - 身份认证
14 | - 登录
15 | - 登出
16 |
17 | - HTTP
18 | - 基于三方库 Dio 封装
19 | - 响应拦截
20 |
21 | - 路由
22 | - 封装 Navigator 1.0
23 | - 路由拦截
24 |
25 | - 状态管理
26 | - 基于三方库 provider
27 | - 黑暗模式
28 |
29 | - 本地缓存
30 | - 基于三方库 shared_preferences 的封装
31 |
32 | - 其他
33 | - 项目预初始化
34 | - 两次返回确认
35 | ```
36 |
37 | ## 目录结构
38 |
39 | ```
40 | # flutter_template_mini
41 | ├─ assets # 静态资源
42 | │ ├─ icons # 字体图标
43 | │ ├─ images # 图片
44 | │ ├─ jsons # json 文件
45 | ├─ lib
46 | │ ├─ common # 全局公共类、方法、变量等
47 | │ ├─ db # 本地缓存
48 | │ ├─ http # http
49 | │ │ ├─ api
50 | │ │ └─ request
51 | │ ├─ models # model 层
52 | │ ├─ navigator # Navigator 1.0
53 | │ ├─ pages # 所有页面
54 | │ ├─ provider # 状态管理
55 | │ ├─ utils # 工具类
56 | ├─ └─ main.dart # 入口
57 | └─ pubspec.yaml # 包管理
58 | ```
59 |
60 | ## 开发
61 |
62 | ```bash
63 | # 安装依赖
64 | flutter packages get 或 flutter pub get
65 |
66 | # 分析代码
67 | flutter analyze
68 |
69 | # 运行项目
70 | flutter run
71 |
72 | # 如果遇到着色器渲染错误(Shader compilation error),可以运行 clean 后再 run
73 | flutter clean
74 |
75 | # 安卓真机调试
76 | flutter devices
77 | flutter run
78 |
79 | # 安卓打包
80 | flutter build apk
81 | ```
82 |
83 | ## 开发环境
84 |
85 | 1. Flutter version 2.8.0
86 | 2. Dart version 2.15.0
87 | 3. Android SDK version 31.0.0
88 |
89 | ## 开发工具
90 |
91 | 1. 编辑器 Visual Studio Code
92 | 2. 插件 Dart
93 | 3. 插件 Flutter
94 | 4. 插件 Flutter Widget Snippets
95 |
96 | ## Git 提交规范
97 |
98 | - `feat` 增加新功能
99 | - `fix` 修复问题/BUG
100 | - `style` 代码风格相关无影响运行结果的
101 | - `perf` 优化/性能提升
102 | - `refactor` 重构
103 | - `revert` 撤销修改
104 | - `test` 测试相关
105 | - `docs` 文档/注释
106 | - `chore` 依赖更新/脚手架配置修改等
107 | - `workflow` 工作流改进
108 | - `ci` 持续集成
109 | - `types` 类型定义文件更改
110 | - `wip` 开发中
111 | - `mod` 不确定分类的修改
112 |
113 | ## ❓ 关于 JSON 转 Dart Model 类
114 |
115 | 1. 纯手写实体类(不推荐)
116 | 2. **用网页自动生成工具: 根据 JSON 自动生成实体类,并 copy 到项目中(所有项目都通用)**
117 | 3. 使用插件 json_serializable(更适合大型项目)
118 |
119 | **该脚手架采用第二种方案**
120 |
121 | 这里随便提供一个自动生成的网址:[json_to_dart](https://javiercbk.github.io/json_to_dart/)
122 |
123 | *JSON <——> Map <——> Dart Model 三者之间的转化是常用的技巧*
124 |
125 | ## ❓ 关于路由
126 |
127 | 1. **官方的 Navigator 1.0**
128 | 2. 官方的 Navigator 2.0 (Flutter 1.22 推出)
129 | 3. 三方插件 fluro
130 |
131 | **该脚手架采用第一种方案,并对其封装**
132 |
133 | *Navigator 2.0 的概念有一定的难度*
134 |
135 | ## ❓ 关于 flutter_template_plus 和 flutter_template_mini 和 flutter-bruno-getx
136 |
137 | 1. mini 版的路由采用 Navigator 1.0,逻辑简单易懂,而 plus 版则采用更加强大,但难以理解的 Navigator 2.0
138 | 2. mini 版的 HTTP 层直接基于 Dio 进行封装,代码结构清晰简单,而 plus 版则书写一方库 MyNet,通过适配器集成 Dio,更加灵活、可插拔
139 | 3. mini 版的 db 层直接基于 shared_preferences 进行封装,而 plus 版则基于 shared_preferences 书写一方库 MyCache
140 | 4. mini 版的封装方式更贴近现代**前端工程**,而 plus 版则更加**面向对象**
141 | 5. flutter-bruno-getx 则完全基于 mini 版,并采用了最新的 SDK、Bruno UI 框架、GetX 状态管理器
142 |
143 | ## 不同版本
144 |
145 | 1. [flutter_template_plus](https://github.com/un-pany/flutter-template-plus)
146 | 2. [flutter_template_mini](https://github.com/un-pany/flutter-template-mini)
147 | 3. [flutter-bruno-getx](https://github.com/un-pany/flutter-bruno-getx)
148 |
149 | ## 📚 入门 Flutter 系列文章
150 |
151 | 1. [Flutter 从 0 到 1](https://juejin.cn/column/6995160230476644366)
152 | 2. [移动端学习小记](https://juejin.cn/column/6991310785871872007)
153 |
154 | ## 📄 License
155 |
156 | [MIT](https://github.com/un-pany/flutter-template-mini/blob/main/LICENSE)
157 |
158 | Copyright (c) 2021 UNPany
159 |
--------------------------------------------------------------------------------
/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 31
30 |
31 | compileOptions {
32 | sourceCompatibility JavaVersion.VERSION_1_8
33 | targetCompatibility JavaVersion.VERSION_1_8
34 | }
35 |
36 | kotlinOptions {
37 | jvmTarget = '1.8'
38 | }
39 |
40 | sourceSets {
41 | main.java.srcDirs += 'src/main/kotlin'
42 | }
43 |
44 | defaultConfig {
45 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
46 | applicationId "com.example.flutter_template_mini"
47 | minSdkVersion 22
48 | targetSdkVersion 31
49 | versionCode flutterVersionCode.toInteger()
50 | versionName flutterVersionName
51 | }
52 |
53 | buildTypes {
54 | release {
55 | // TODO: Add your own signing config for the release build.
56 | // Signing with the debug keys for now, so `flutter run --release` works.
57 | signingConfig signingConfigs.debug
58 | }
59 | }
60 | }
61 |
62 | flutter {
63 | source '../..'
64 | }
65 |
66 | dependencies {
67 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
68 | }
69 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
14 |
18 |
22 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
38 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_templete_mini/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_template_mini
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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.3.50'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:4.1.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 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/assets/icons/iconfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/assets/icons/iconfont.ttf
--------------------------------------------------------------------------------
/assets/images/docs/login_dark.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/assets/images/docs/login_dark.jpg
--------------------------------------------------------------------------------
/assets/images/docs/login_light.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/assets/images/docs/login_light.jpg
--------------------------------------------------------------------------------
/assets/images/login/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/assets/images/login/logo.png
--------------------------------------------------------------------------------
/assets/images/login/unpany.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/assets/images/login/unpany.png
--------------------------------------------------------------------------------
/assets/jsons/demo.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pany",
3 | "mail": "939630029@qq.com"
4 | }
--------------------------------------------------------------------------------
/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 | 9.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
16 | /* End PBXBuildFile section */
17 |
18 | /* Begin PBXCopyFilesBuildPhase section */
19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
20 | isa = PBXCopyFilesBuildPhase;
21 | buildActionMask = 2147483647;
22 | dstPath = "";
23 | dstSubfolderSpec = 10;
24 | files = (
25 | );
26 | name = "Embed Frameworks";
27 | runOnlyForDeploymentPostprocessing = 0;
28 | };
29 | /* End PBXCopyFilesBuildPhase section */
30 |
31 | /* Begin PBXFileReference section */
32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
45 | /* End PBXFileReference section */
46 |
47 | /* Begin PBXFrameworksBuildPhase section */
48 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
49 | isa = PBXFrameworksBuildPhase;
50 | buildActionMask = 2147483647;
51 | files = (
52 | );
53 | runOnlyForDeploymentPostprocessing = 0;
54 | };
55 | /* End PBXFrameworksBuildPhase section */
56 |
57 | /* Begin PBXGroup section */
58 | 9740EEB11CF90186004384FC /* Flutter */ = {
59 | isa = PBXGroup;
60 | children = (
61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
65 | );
66 | name = Flutter;
67 | sourceTree = "";
68 | };
69 | 97C146E51CF9000F007C117D = {
70 | isa = PBXGroup;
71 | children = (
72 | 9740EEB11CF90186004384FC /* Flutter */,
73 | 97C146F01CF9000F007C117D /* Runner */,
74 | 97C146EF1CF9000F007C117D /* Products */,
75 | );
76 | sourceTree = "";
77 | };
78 | 97C146EF1CF9000F007C117D /* Products */ = {
79 | isa = PBXGroup;
80 | children = (
81 | 97C146EE1CF9000F007C117D /* Runner.app */,
82 | );
83 | name = Products;
84 | sourceTree = "";
85 | };
86 | 97C146F01CF9000F007C117D /* Runner */ = {
87 | isa = PBXGroup;
88 | children = (
89 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
92 | 97C147021CF9000F007C117D /* Info.plist */,
93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
97 | );
98 | path = Runner;
99 | sourceTree = "";
100 | };
101 | /* End PBXGroup section */
102 |
103 | /* Begin PBXNativeTarget section */
104 | 97C146ED1CF9000F007C117D /* Runner */ = {
105 | isa = PBXNativeTarget;
106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
107 | buildPhases = (
108 | 9740EEB61CF901F6004384FC /* Run Script */,
109 | 97C146EA1CF9000F007C117D /* Sources */,
110 | 97C146EB1CF9000F007C117D /* Frameworks */,
111 | 97C146EC1CF9000F007C117D /* Resources */,
112 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
114 | );
115 | buildRules = (
116 | );
117 | dependencies = (
118 | );
119 | name = Runner;
120 | productName = Runner;
121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
122 | productType = "com.apple.product-type.application";
123 | };
124 | /* End PBXNativeTarget section */
125 |
126 | /* Begin PBXProject section */
127 | 97C146E61CF9000F007C117D /* Project object */ = {
128 | isa = PBXProject;
129 | attributes = {
130 | LastUpgradeCheck = 1020;
131 | ORGANIZATIONNAME = "";
132 | TargetAttributes = {
133 | 97C146ED1CF9000F007C117D = {
134 | CreatedOnToolsVersion = 7.3.1;
135 | LastSwiftMigration = 1100;
136 | };
137 | };
138 | };
139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
140 | compatibilityVersion = "Xcode 9.3";
141 | developmentRegion = en;
142 | hasScannedForEncodings = 0;
143 | knownRegions = (
144 | en,
145 | Base,
146 | );
147 | mainGroup = 97C146E51CF9000F007C117D;
148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
149 | projectDirPath = "";
150 | projectRoot = "";
151 | targets = (
152 | 97C146ED1CF9000F007C117D /* Runner */,
153 | );
154 | };
155 | /* End PBXProject section */
156 |
157 | /* Begin PBXResourcesBuildPhase section */
158 | 97C146EC1CF9000F007C117D /* Resources */ = {
159 | isa = PBXResourcesBuildPhase;
160 | buildActionMask = 2147483647;
161 | files = (
162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
166 | );
167 | runOnlyForDeploymentPostprocessing = 0;
168 | };
169 | /* End PBXResourcesBuildPhase section */
170 |
171 | /* Begin PBXShellScriptBuildPhase section */
172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
173 | isa = PBXShellScriptBuildPhase;
174 | buildActionMask = 2147483647;
175 | files = (
176 | );
177 | inputPaths = (
178 | );
179 | name = "Thin Binary";
180 | outputPaths = (
181 | );
182 | runOnlyForDeploymentPostprocessing = 0;
183 | shellPath = /bin/sh;
184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
185 | };
186 | 9740EEB61CF901F6004384FC /* Run Script */ = {
187 | isa = PBXShellScriptBuildPhase;
188 | buildActionMask = 2147483647;
189 | files = (
190 | );
191 | inputPaths = (
192 | );
193 | name = "Run Script";
194 | outputPaths = (
195 | );
196 | runOnlyForDeploymentPostprocessing = 0;
197 | shellPath = /bin/sh;
198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
199 | };
200 | /* End PBXShellScriptBuildPhase section */
201 |
202 | /* Begin PBXSourcesBuildPhase section */
203 | 97C146EA1CF9000F007C117D /* Sources */ = {
204 | isa = PBXSourcesBuildPhase;
205 | buildActionMask = 2147483647;
206 | files = (
207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
209 | );
210 | runOnlyForDeploymentPostprocessing = 0;
211 | };
212 | /* End PBXSourcesBuildPhase section */
213 |
214 | /* Begin PBXVariantGroup section */
215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
216 | isa = PBXVariantGroup;
217 | children = (
218 | 97C146FB1CF9000F007C117D /* Base */,
219 | );
220 | name = Main.storyboard;
221 | sourceTree = "";
222 | };
223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
224 | isa = PBXVariantGroup;
225 | children = (
226 | 97C147001CF9000F007C117D /* Base */,
227 | );
228 | name = LaunchScreen.storyboard;
229 | sourceTree = "";
230 | };
231 | /* End PBXVariantGroup section */
232 |
233 | /* Begin XCBuildConfiguration section */
234 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
235 | isa = XCBuildConfiguration;
236 | buildSettings = {
237 | ALWAYS_SEARCH_USER_PATHS = NO;
238 | CLANG_ANALYZER_NONNULL = YES;
239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
240 | CLANG_CXX_LIBRARY = "libc++";
241 | CLANG_ENABLE_MODULES = YES;
242 | CLANG_ENABLE_OBJC_ARC = YES;
243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
244 | CLANG_WARN_BOOL_CONVERSION = YES;
245 | CLANG_WARN_COMMA = YES;
246 | CLANG_WARN_CONSTANT_CONVERSION = YES;
247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
249 | CLANG_WARN_EMPTY_BODY = YES;
250 | CLANG_WARN_ENUM_CONVERSION = YES;
251 | CLANG_WARN_INFINITE_RECURSION = YES;
252 | CLANG_WARN_INT_CONVERSION = YES;
253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
258 | CLANG_WARN_STRICT_PROTOTYPES = YES;
259 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
260 | CLANG_WARN_UNREACHABLE_CODE = YES;
261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
263 | COPY_PHASE_STRIP = NO;
264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
265 | ENABLE_NS_ASSERTIONS = NO;
266 | ENABLE_STRICT_OBJC_MSGSEND = YES;
267 | GCC_C_LANGUAGE_STANDARD = gnu99;
268 | GCC_NO_COMMON_BLOCKS = YES;
269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
271 | GCC_WARN_UNDECLARED_SELECTOR = YES;
272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
273 | GCC_WARN_UNUSED_FUNCTION = YES;
274 | GCC_WARN_UNUSED_VARIABLE = YES;
275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
276 | MTL_ENABLE_DEBUG_INFO = NO;
277 | SDKROOT = iphoneos;
278 | SUPPORTED_PLATFORMS = iphoneos;
279 | TARGETED_DEVICE_FAMILY = "1,2";
280 | VALIDATE_PRODUCT = YES;
281 | };
282 | name = Profile;
283 | };
284 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
285 | isa = XCBuildConfiguration;
286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
287 | buildSettings = {
288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
289 | CLANG_ENABLE_MODULES = YES;
290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
291 | ENABLE_BITCODE = NO;
292 | INFOPLIST_FILE = Runner/Info.plist;
293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
294 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutter_template_mini;
295 | PRODUCT_NAME = "$(TARGET_NAME)";
296 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
297 | SWIFT_VERSION = 5.0;
298 | VERSIONING_SYSTEM = "apple-generic";
299 | };
300 | name = Profile;
301 | };
302 | 97C147031CF9000F007C117D /* Debug */ = {
303 | isa = XCBuildConfiguration;
304 | buildSettings = {
305 | ALWAYS_SEARCH_USER_PATHS = NO;
306 | CLANG_ANALYZER_NONNULL = YES;
307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
308 | CLANG_CXX_LIBRARY = "libc++";
309 | CLANG_ENABLE_MODULES = YES;
310 | CLANG_ENABLE_OBJC_ARC = YES;
311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
312 | CLANG_WARN_BOOL_CONVERSION = YES;
313 | CLANG_WARN_COMMA = YES;
314 | CLANG_WARN_CONSTANT_CONVERSION = YES;
315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
317 | CLANG_WARN_EMPTY_BODY = YES;
318 | CLANG_WARN_ENUM_CONVERSION = YES;
319 | CLANG_WARN_INFINITE_RECURSION = YES;
320 | CLANG_WARN_INT_CONVERSION = YES;
321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
326 | CLANG_WARN_STRICT_PROTOTYPES = YES;
327 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
328 | CLANG_WARN_UNREACHABLE_CODE = YES;
329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
331 | COPY_PHASE_STRIP = NO;
332 | DEBUG_INFORMATION_FORMAT = dwarf;
333 | ENABLE_STRICT_OBJC_MSGSEND = YES;
334 | ENABLE_TESTABILITY = YES;
335 | GCC_C_LANGUAGE_STANDARD = gnu99;
336 | GCC_DYNAMIC_NO_PIC = NO;
337 | GCC_NO_COMMON_BLOCKS = YES;
338 | GCC_OPTIMIZATION_LEVEL = 0;
339 | GCC_PREPROCESSOR_DEFINITIONS = (
340 | "DEBUG=1",
341 | "$(inherited)",
342 | );
343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
345 | GCC_WARN_UNDECLARED_SELECTOR = YES;
346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
347 | GCC_WARN_UNUSED_FUNCTION = YES;
348 | GCC_WARN_UNUSED_VARIABLE = YES;
349 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
350 | MTL_ENABLE_DEBUG_INFO = YES;
351 | ONLY_ACTIVE_ARCH = YES;
352 | SDKROOT = iphoneos;
353 | TARGETED_DEVICE_FAMILY = "1,2";
354 | };
355 | name = Debug;
356 | };
357 | 97C147041CF9000F007C117D /* Release */ = {
358 | isa = XCBuildConfiguration;
359 | buildSettings = {
360 | ALWAYS_SEARCH_USER_PATHS = NO;
361 | CLANG_ANALYZER_NONNULL = YES;
362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
363 | CLANG_CXX_LIBRARY = "libc++";
364 | CLANG_ENABLE_MODULES = YES;
365 | CLANG_ENABLE_OBJC_ARC = YES;
366 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
367 | CLANG_WARN_BOOL_CONVERSION = YES;
368 | CLANG_WARN_COMMA = YES;
369 | CLANG_WARN_CONSTANT_CONVERSION = YES;
370 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
372 | CLANG_WARN_EMPTY_BODY = YES;
373 | CLANG_WARN_ENUM_CONVERSION = YES;
374 | CLANG_WARN_INFINITE_RECURSION = YES;
375 | CLANG_WARN_INT_CONVERSION = YES;
376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
381 | CLANG_WARN_STRICT_PROTOTYPES = YES;
382 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
383 | CLANG_WARN_UNREACHABLE_CODE = YES;
384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
386 | COPY_PHASE_STRIP = NO;
387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
388 | ENABLE_NS_ASSERTIONS = NO;
389 | ENABLE_STRICT_OBJC_MSGSEND = YES;
390 | GCC_C_LANGUAGE_STANDARD = gnu99;
391 | GCC_NO_COMMON_BLOCKS = YES;
392 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
393 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
394 | GCC_WARN_UNDECLARED_SELECTOR = YES;
395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
396 | GCC_WARN_UNUSED_FUNCTION = YES;
397 | GCC_WARN_UNUSED_VARIABLE = YES;
398 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
399 | MTL_ENABLE_DEBUG_INFO = NO;
400 | SDKROOT = iphoneos;
401 | SUPPORTED_PLATFORMS = iphoneos;
402 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
403 | TARGETED_DEVICE_FAMILY = "1,2";
404 | VALIDATE_PRODUCT = YES;
405 | };
406 | name = Release;
407 | };
408 | 97C147061CF9000F007C117D /* Debug */ = {
409 | isa = XCBuildConfiguration;
410 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
411 | buildSettings = {
412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
413 | CLANG_ENABLE_MODULES = YES;
414 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
415 | ENABLE_BITCODE = NO;
416 | INFOPLIST_FILE = Runner/Info.plist;
417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
418 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutter_template_mini;
419 | PRODUCT_NAME = "$(TARGET_NAME)";
420 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
421 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
422 | SWIFT_VERSION = 5.0;
423 | VERSIONING_SYSTEM = "apple-generic";
424 | };
425 | name = Debug;
426 | };
427 | 97C147071CF9000F007C117D /* Release */ = {
428 | isa = XCBuildConfiguration;
429 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
430 | buildSettings = {
431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
432 | CLANG_ENABLE_MODULES = YES;
433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
434 | ENABLE_BITCODE = NO;
435 | INFOPLIST_FILE = Runner/Info.plist;
436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
437 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutter_template_mini;
438 | PRODUCT_NAME = "$(TARGET_NAME)";
439 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
440 | SWIFT_VERSION = 5.0;
441 | VERSIONING_SYSTEM = "apple-generic";
442 | };
443 | name = Release;
444 | };
445 | /* End XCBuildConfiguration section */
446 |
447 | /* Begin XCConfigurationList section */
448 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
449 | isa = XCConfigurationList;
450 | buildConfigurations = (
451 | 97C147031CF9000F007C117D /* Debug */,
452 | 97C147041CF9000F007C117D /* Release */,
453 | 249021D3217E4FDB00AE95B9 /* Profile */,
454 | );
455 | defaultConfigurationIsVisible = 0;
456 | defaultConfigurationName = Release;
457 | };
458 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
459 | isa = XCConfigurationList;
460 | buildConfigurations = (
461 | 97C147061CF9000F007C117D /* Debug */,
462 | 97C147071CF9000F007C117D /* Release */,
463 | 249021D4217E4FDB00AE95B9 /* Profile */,
464 | );
465 | defaultConfigurationIsVisible = 0;
466 | defaultConfigurationName = Release;
467 | };
468 | /* End XCConfigurationList section */
469 | };
470 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
471 | }
472 |
--------------------------------------------------------------------------------
/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 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/un-pany/flutter-template-mini/df503e95e68760ccf9713f168d12f522f1c83b7f/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 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_template_mini
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/common/my_color.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 全局颜色
4 |
5 | class MyColor {
6 | // 主题色
7 | static const MaterialColor primary = Colors.indigo;
8 |
9 | // 纯白色
10 | static const MaterialColor white = const MaterialColor(
11 | 0xFFFFFFFF,
12 | {
13 | 50: Color(0xFFFFFFFF),
14 | 100: Color(0xFFFFFFFF),
15 | 200: Color(0xFFFFFFFF),
16 | 300: Color(0xFFFFFFFF),
17 | 400: Color(0xFFFFFFFF),
18 | 500: Color(0xFFFFFFFF),
19 | 600: Color(0xFFFFFFFF),
20 | 700: Color(0xFFFFFFFF),
21 | 800: Color(0xFFFFFFFF),
22 | 900: Color(0xFFFFFFFF),
23 | },
24 | );
25 |
26 | // Dark Mode 相关
27 | static const Color light_red = Color(0xFFFF4759);
28 | static const Color dark_red = Color(0xFFE03E4E);
29 | static const Color dark_bg = Color(0xFF18191A);
30 | }
31 |
--------------------------------------------------------------------------------
/lib/common/my_init.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_easyloading/flutter_easyloading.dart';
2 | import 'package:flutter_template_mini/db/my_sp.dart';
3 |
4 | /// 全局初始化数据
5 |
6 | class MyInit {
7 | static Future init() async {
8 | // 初始化 SharedPreferences
9 | await MySP.init();
10 |
11 | // 配置 EasyLoading 单例
12 | EasyLoading.instance
13 | ..displayDuration = const Duration(milliseconds: 2000)
14 | // 期间是否允许用户操作
15 | ..userInteractions = false
16 | // 点击背景是否关闭
17 | ..dismissOnTap = false
18 | // 遮蔽层
19 | ..maskType = EasyLoadingMaskType.black
20 | // Toast 出现的位置
21 | ..toastPosition = EasyLoadingToastPosition.bottom;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/common/my_state.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 页面状态异常管理
4 | /// 主要解决页面销毁后,调用了 setState 导致控制台警告的问题
5 | /// 该脚手架暂时未用到
6 | abstract class MyState extends State {
7 | @override
8 | void setState(fn) {
9 | if (mounted) {
10 | // 页面已装载
11 | super.setState(fn);
12 | } else {
13 | print('MyState: 页面已销毁,本次 setState 不执行: ${toString()}');
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/lib/db/my_sp.dart:
--------------------------------------------------------------------------------
1 | import 'package:shared_preferences/shared_preferences.dart';
2 |
3 | // SharedPreferences
4 | class MySP {
5 | static SharedPreferences? prefs;
6 |
7 | // 初始化
8 | static Future init() async {
9 | prefs = await SharedPreferences.getInstance();
10 | return true;
11 | }
12 |
13 | // token
14 | static String? getToken() {
15 | return prefs?.getString('token');
16 | }
17 |
18 | static Future setToken(string) async {
19 | return await prefs?.setString('token', string);
20 | }
21 |
22 | static Future removeToken() async {
23 | return await prefs?.remove('token');
24 | }
25 |
26 | // Theme Mode
27 | static String? getThemeMode() {
28 | return prefs?.getString('theme-mode');
29 | }
30 |
31 | static Future setThemeMode(string) async {
32 | return await prefs?.setString('theme-mode', string);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/lib/http/api.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_template_mini/http/request.dart';
2 |
3 | class Api {
4 | // 登录
5 | static login(data) {
6 | return Request.post(
7 | "/users/login",
8 | data: data,
9 | );
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/lib/http/request.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:flutter/foundation.dart';
3 | import 'package:flutter_easyloading/flutter_easyloading.dart';
4 |
5 | class Request {
6 | static BaseOptions _options = BaseOptions(
7 | baseUrl:
8 | 'https://vue-typescript-admin-mock-server-armour.vercel.app/mock-api/v1/',
9 | connectTimeout: 5000,
10 | receiveTimeout: 3000,
11 | // contentType: 'application/json; charset=utf-8',
12 | // headers: {
13 | // 'OS': 'Android'
14 | // }
15 | );
16 |
17 | static Dio dio = Dio(_options);
18 |
19 | static Future _request(String path,
20 | {required String method, Map? params, data}) async {
21 | // restful请求处理
22 | if (params != null) {
23 | params.forEach((key, value) {
24 | if (path.indexOf(key) != -1) {
25 | path = path.replaceAll(":$key", value.toString());
26 | }
27 | });
28 | }
29 | debugPrint('发送的数据为: $data');
30 | try {
31 | Response response =
32 | await dio.request(path, data: data, options: Options(method: method));
33 | if (response.statusCode == 200 || response.statusCode == 201) {
34 | try {
35 | if (response.data['code'] != 20000) {
36 | EasyLoading.showInfo('服务器错误,状态码为: ${response.data['status']}');
37 | return Future.error(response.data['msg']);
38 | } else {
39 | debugPrint('响应的数据为: ${response.data}');
40 | if (response.data is Map) {
41 | return response.data;
42 | } else {
43 | // return json.decode(response.data.toString());
44 | return response.data;
45 | }
46 | }
47 | } catch (e) {
48 | debugPrint('解析响应数据异常: $e');
49 | return Future.error('解析响应数据异常');
50 | }
51 | } else {
52 | EasyLoading.showInfo('HTTP错误,状态码为: ${response.statusCode}');
53 | _handleHttpError(response.statusCode);
54 | return Future.error('HTTP错误');
55 | }
56 | } on DioError catch (e) {
57 | EasyLoading.showInfo(_dioError(e));
58 | return Future.error(_dioError(e));
59 | } catch (e) {
60 | debugPrint('未知异常: $e');
61 | return Future.error('未知异常');
62 | }
63 | }
64 |
65 | // 处理Dio异常
66 | static String _dioError(DioError error) {
67 | switch (error.type) {
68 | case DioErrorType.connectTimeout:
69 | return "网络连接超时,请检查网络设置";
70 | case DioErrorType.sendTimeout:
71 | return "网络连接超时,请检查网络设置";
72 | case DioErrorType.receiveTimeout:
73 | return "接收数据超时,请稍后重试";
74 | case DioErrorType.response:
75 | return "服务器异常,请稍后重试";
76 | case DioErrorType.cancel:
77 | return "请求被取消,请重新请求";
78 | case DioErrorType.other:
79 | return "未知错误,请检查网络等原因";
80 | default:
81 | return "未知错误";
82 | }
83 | }
84 |
85 | // 处理Http错误码
86 | static void _handleHttpError(int? errorCode) {
87 | String message;
88 | switch (errorCode) {
89 | case 400:
90 | message = '请求语法错误';
91 | break;
92 | case 401:
93 | message = '未授权,请登录';
94 | break;
95 | case 403:
96 | message = '拒绝访问';
97 | break;
98 | case 404:
99 | message = '请求出错';
100 | break;
101 | case 408:
102 | message = '请求超时';
103 | break;
104 | case 500:
105 | message = '服务器异常';
106 | break;
107 | case 501:
108 | message = '服务未实现';
109 | break;
110 | case 502:
111 | message = '网关错误';
112 | break;
113 | case 503:
114 | message = '服务不可用';
115 | break;
116 | case 504:
117 | message = '网关超时';
118 | break;
119 | case 505:
120 | message = 'HTTP版本不受支持';
121 | break;
122 | default:
123 | message = '请求失败,错误码: $errorCode';
124 | }
125 | EasyLoading.showError(message);
126 | }
127 |
128 | // 这里只写了 get 和 post,其他的类型,比如 put,可自行添加
129 | static Future get(String path, {Map? params}) {
130 | return _request(path, method: 'get', params: params);
131 | }
132 |
133 | static Future post(String path, {Map? params, data}) {
134 | return _request(path, method: 'post', params: params, data: data);
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_easyloading/flutter_easyloading.dart';
3 | import 'package:flutter_localizations/flutter_localizations.dart';
4 | import 'package:flutter_template_mini/common/my_init.dart';
5 | import 'package:flutter_template_mini/navigator/my_navigator.dart';
6 | import 'package:flutter_template_mini/provider/my_provider.dart';
7 | import 'package:flutter_template_mini/provider/theme_provider.dart';
8 | import 'package:provider/provider.dart';
9 |
10 | void main() {
11 | // 网格线
12 | // debugPaintSizeEnabled = true;
13 | // Flutter 版本 (1.12.13+hotfix.5) 后,初始化插件必须加 ensureInitialized
14 | WidgetsFlutterBinding.ensureInitialized();
15 | // 应用入口
16 | runApp(MyApp());
17 | }
18 |
19 | class MyApp extends StatefulWidget {
20 | const MyApp({Key? key}) : super(key: key);
21 |
22 | @override
23 | _MyAppState createState() => _MyAppState();
24 | }
25 |
26 | class _MyAppState extends State {
27 | @override
28 | Widget build(BuildContext context) {
29 | return FutureBuilder(
30 | // 进行项目的预初始化
31 | future: MyInit.init(),
32 | builder: (BuildContext context, AsyncSnapshot snapshot) {
33 | if (snapshot.connectionState == ConnectionState.done) {
34 | // 初始化完成
35 | return MultiProvider(
36 | providers: topProviders,
37 | // 这里通过 Consumer 读取数据,灵活度高
38 | // 还有其他的读取方式,比如 context.read()
39 | child: Consumer(
40 | builder: (
41 | BuildContext context,
42 | ThemeProvider themeProvider,
43 | Widget? child,
44 | ) {
45 | return MaterialApp(
46 | title: 'flutter_template_mini',
47 | theme: themeProvider.getTheme(),
48 | darkTheme: themeProvider.getTheme(isDarkMode: true),
49 | themeMode: themeProvider.getThemeMode(),
50 | localizationsDelegates: [
51 | // 本地化的代理类
52 | GlobalMaterialLocalizations.delegate,
53 | GlobalWidgetsLocalizations.delegate,
54 | ],
55 | supportedLocales: [
56 | const Locale('en', 'US'), // 美国英语
57 | const Locale('zh', 'CH'), // 中文简体
58 | ],
59 | builder: EasyLoading.init(),
60 | initialRoute: 'navigator',
61 | onGenerateRoute: MyNavigator.getInstance().onGenerateRoute,
62 | );
63 | },
64 | ),
65 | );
66 | } else {
67 | // 初始化未完成时,显示 loading 动画
68 | return MaterialApp(
69 | home: Scaffold(
70 | body: Center(
71 | child: CircularProgressIndicator(),
72 | ),
73 | ),
74 | );
75 | }
76 | },
77 | );
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/lib/models/demo_model.dart:
--------------------------------------------------------------------------------
1 | class DemoModel {
2 | String? name;
3 | String? mail;
4 |
5 | DemoModel({this.name, this.mail});
6 |
7 | DemoModel.fromJson(Map json) {
8 | name = json['name'];
9 | mail = json['mail'];
10 | }
11 |
12 | Map toJson() {
13 | final Map data = new Map();
14 | data['name'] = this.name;
15 | data['mail'] = this.mail;
16 | return data;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/lib/navigator/my_navigator.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_template_mini/db/my_sp.dart';
3 | import 'package:flutter_template_mini/pages/login_page.dart';
4 | import 'package:flutter_template_mini/pages/navigator_page.dart';
5 |
6 | class MyNavigator {
7 | static MyNavigator? _instance;
8 |
9 | MyNavigator._();
10 |
11 | // 单例模式
12 | static MyNavigator getInstance() {
13 | if (_instance == null) {
14 | _instance = MyNavigator._();
15 | }
16 | return _instance!;
17 | }
18 |
19 | // 路由钩子(能监听到命名路由跳转,但是手机自带的物理返回按钮不行)
20 | Route onGenerateRoute(RouteSettings settings) {
21 | String? routeName;
22 | routeName = routeBeforeHook(settings);
23 | return MaterialPageRoute(builder: (context) {
24 | /// 注意:如果路由的形式为: '/a/b/c'
25 | /// 那么将依次检索 '/' -> '/a' -> '/a/b' -> '/a/b/c'
26 | /// 所以,这里的路由命名最好避免使用 '/xxx' 形式
27 | switch (routeName) {
28 | case "login":
29 | return LoginPage();
30 | case "navigator":
31 | return NavigatorPage();
32 | default:
33 | return Scaffold(
34 | body: Center(
35 | child: Text("页面不存在"),
36 | ),
37 | );
38 | }
39 | });
40 | }
41 |
42 | // 路由拦截器
43 | String? routeBeforeHook(RouteSettings settings) {
44 | final token = MySP.getToken() ?? '';
45 | if (token != '') {
46 | if (settings.name == 'login') {
47 | return 'navigator';
48 | }
49 | return settings.name;
50 | }
51 | return 'login';
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/lib/pages/detail_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class DetailPage extends StatefulWidget {
4 | final int id;
5 |
6 | const DetailPage({Key? key, required this.id}) : super(key: key);
7 |
8 | @override
9 | _DetailPageState createState() => _DetailPageState();
10 | }
11 |
12 | class _DetailPageState extends State {
13 | @override
14 | Widget build(BuildContext context) {
15 | return Scaffold(
16 | appBar: AppBar(
17 | title: Text('详情'),
18 | ),
19 | body: Center(
20 | child: Text('传递过来的id数据: ${widget.id}'),
21 | ),
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/lib/pages/home_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class HomePage extends StatefulWidget {
4 | const HomePage({Key? key}) : super(key: key);
5 |
6 | @override
7 | _HomePageState createState() => _HomePageState();
8 | }
9 |
10 | class _HomePageState extends State {
11 | @override
12 | Widget build(BuildContext context) {
13 | return Scaffold(
14 | appBar: AppBar(
15 | title: Text('首页'),
16 | ),
17 | body: Center(
18 | child: ElevatedButton(
19 | child: Text("跳转到详情"),
20 | onPressed: () {
21 | Navigator.of(context).pushNamed('detail');
22 | },
23 | ),
24 | ),
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/lib/pages/login_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_easyloading/flutter_easyloading.dart';
3 | import 'package:flutter_template_mini/db/my_sp.dart';
4 | import 'package:flutter_template_mini/http/api.dart';
5 | import 'package:flutter_template_mini/widgets/login_input.dart';
6 |
7 | class LoginPage extends StatefulWidget {
8 | LoginPage({Key? key}) : super(key: key);
9 |
10 | @override
11 | _LoginPageState createState() => _LoginPageState();
12 | }
13 |
14 | class _LoginPageState extends State {
15 | final GlobalKey _formKey = GlobalKey();
16 | TextEditingController _userController = TextEditingController(text: 'admin');
17 | TextEditingController _passwordController =
18 | TextEditingController(text: '12345678');
19 | // '记住密码' 复选框
20 | bool? _savePassword = false;
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return Scaffold(
25 | // ListView 可以自适应键盘,防止键盘弹起后遮挡
26 | body: ListView(
27 | padding: EdgeInsets.only(
28 | top: 70,
29 | left: 35,
30 | right: 35,
31 | ),
32 | children: [
33 | Image.asset(
34 | 'assets/images/login/logo.png',
35 | width: 200,
36 | height: 200,
37 | ),
38 | _form(),
39 | _save(),
40 | _button(),
41 | ],
42 | ),
43 | );
44 | }
45 |
46 | // 表单
47 | Widget _form() {
48 | return Form(
49 | // 设置 globalKey,用于后面获取 FormState
50 | key: _formKey,
51 | // 不开启自动校验表单,而是选择在点击登录按钮时校验
52 | autovalidateMode: AutovalidateMode.disabled,
53 | child: Column(
54 | children: [
55 | Padding(
56 | padding: EdgeInsets.only(
57 | bottom: 20,
58 | ),
59 | child: LoginInput(
60 | '请输入用户名',
61 | Icon(Icons.perm_identity),
62 | _userController,
63 | validator: (value) {
64 | return value!.trim().length > 0 ? null : "用户名不能为空";
65 | },
66 | ),
67 | ),
68 | Padding(
69 | padding: EdgeInsets.only(
70 | bottom: 20,
71 | ),
72 | child: LoginInput(
73 | '请输入密码',
74 | Icon(Icons.lock_outline),
75 | _passwordController,
76 | obscureText: true,
77 | validator: (value) {
78 | return value!.trim().length >= 8 ? null : "密码不能少于8位";
79 | },
80 | ),
81 | ),
82 | ],
83 | ),
84 | );
85 | }
86 |
87 | // 记住密码
88 | _save() {
89 | return Padding(
90 | padding: EdgeInsets.only(
91 | bottom: 50,
92 | ),
93 | child: Row(
94 | mainAxisAlignment: MainAxisAlignment.end,
95 | children: [
96 | Checkbox(
97 | value: _savePassword,
98 | onChanged: (value) {
99 | setState(() {
100 | _savePassword = value;
101 | });
102 | },
103 | ),
104 | Text("记住密码"),
105 | ],
106 | ),
107 | );
108 | }
109 |
110 | // 登录按钮
111 | Widget _button() {
112 | return FractionallySizedBox(
113 | // 子元素占父元素的宽度比例
114 | widthFactor: 0.6,
115 | child: SizedBox(
116 | height: 45,
117 | child: ElevatedButton(
118 | child: Text("登录"),
119 | style: ElevatedButton.styleFrom(
120 | // 圆角
121 | shape: StadiumBorder(),
122 | ),
123 | onPressed: () async {
124 | if ((_formKey.currentState as FormState).validate()) {
125 | // 验证通过提交数据
126 | EasyLoading.show();
127 | var res = await Api.login({
128 | 'username': _userController.text.trim(),
129 | 'password': _passwordController.text.trim(),
130 | });
131 | // 保存登录令牌
132 | MySP.setToken(res['data']['accessToken']);
133 | EasyLoading.dismiss();
134 | Navigator.of(context).pushNamedAndRemoveUntil(
135 | 'navigator',
136 | (route) => false,
137 | );
138 | }
139 | },
140 | ),
141 | ),
142 | );
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/lib/pages/me_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_template_mini/db/my_sp.dart';
3 | import 'package:flutter_template_mini/provider/theme_provider.dart';
4 | import 'package:provider/provider.dart';
5 |
6 | class MePage extends StatefulWidget {
7 | const MePage({Key? key}) : super(key: key);
8 |
9 | @override
10 | _MePageState createState() => _MePageState();
11 | }
12 |
13 | class _MePageState extends State {
14 | @override
15 | Widget build(BuildContext context) {
16 | return Scaffold(
17 | appBar: AppBar(
18 | title: Text('我的'),
19 | ),
20 | body: ListView(
21 | padding: EdgeInsets.only(
22 | left: 35,
23 | right: 35,
24 | ),
25 | children: [
26 | OutlinedButton(
27 | child: Text("亮色模式"),
28 | onPressed: () {
29 | context.read().setThemeMode(ThemeMode.light);
30 | },
31 | ),
32 | OutlinedButton(
33 | child: Text("黑暗模式"),
34 | onPressed: () {
35 | context.read().setThemeMode(ThemeMode.dark);
36 | },
37 | ),
38 | OutlinedButton(
39 | child: Text("跟随系统"),
40 | onPressed: () {
41 | context.read().setThemeMode(ThemeMode.system);
42 | },
43 | ),
44 | ElevatedButton(
45 | child: Text("退出登录"),
46 | onPressed: () {
47 | MySP.removeToken();
48 | Navigator.of(context).pushNamedAndRemoveUntil(
49 | 'login',
50 | (route) => false,
51 | );
52 | },
53 | ),
54 | ],
55 | ),
56 | );
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/lib/pages/navigator_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_easyloading/flutter_easyloading.dart';
3 | import 'package:flutter_template_mini/pages/home_page.dart';
4 | import 'package:flutter_template_mini/pages/me_page.dart';
5 | import 'package:flutter_template_mini/common/my_color.dart';
6 |
7 | class NavigatorPage extends StatefulWidget {
8 | const NavigatorPage({Key? key}) : super(key: key);
9 |
10 | @override
11 | _NavigatorPageState createState() => _NavigatorPageState();
12 | }
13 |
14 | class _NavigatorPageState extends State {
15 | // 默认的颜色
16 | final _defaultColor = Colors.grey;
17 | // 选中后的颜色
18 | final _activeColor = MyColor.primary;
19 | // 当前索引
20 | int _currentIndex = 0;
21 | // 页面
22 | final List _pages = [
23 | HomePage(),
24 | MePage(),
25 | ];
26 | // 上次点击时间
27 | DateTime? _lastPressedAt;
28 |
29 | @override
30 | Widget build(BuildContext context) {
31 | return Scaffold(
32 | body: WillPopScope(
33 | onWillPop: exitApp,
34 | child: _pages[_currentIndex],
35 | ),
36 | bottomNavigationBar: BottomNavigationBar(
37 | currentIndex: _currentIndex,
38 | type: BottomNavigationBarType.fixed,
39 | selectedItemColor: _activeColor,
40 | items: [
41 | _bottomItem('首页', Icons.home_outlined),
42 | _bottomItem('我的', Icons.person_outline),
43 | ],
44 | onTap: (index) {
45 | setState(() {
46 | _currentIndex = index;
47 | });
48 | },
49 | ),
50 | );
51 | }
52 |
53 | // 底部 Item
54 | BottomNavigationBarItem _bottomItem(String label, IconData icon) {
55 | return BottomNavigationBarItem(
56 | label: label,
57 | icon: Icon(icon, color: _defaultColor),
58 | activeIcon: Icon(icon, color: _activeColor),
59 | );
60 | }
61 |
62 | // 退出 app
63 | Future exitApp() async {
64 | if (_lastPressedAt == null ||
65 | DateTime.now().difference(_lastPressedAt!) > Duration(seconds: 2)) {
66 | EasyLoading.showToast('再点一次退出');
67 | // 两次点击间隔超过2秒则重新计时
68 | _lastPressedAt = DateTime.now();
69 | return Future.value(false);
70 | }
71 | return Future.value(true);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/lib/provider/my_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_template_mini/provider/theme_provider.dart';
2 | import 'package:provider/provider.dart';
3 | import 'package:provider/single_child_widget.dart';
4 |
5 | List topProviders = [
6 | ChangeNotifierProvider(create: (_) => ThemeProvider())
7 | ];
--------------------------------------------------------------------------------
/lib/provider/theme_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/scheduler.dart';
3 | import 'package:flutter_template_mini/common/my_color.dart';
4 | import 'package:flutter_template_mini/db/my_sp.dart';
5 |
6 | /// 扩展 ThemeMode
7 | extension ThemeModeExtension on ThemeMode {
8 | // 这样就是可以通过 value 属性,获取对应的 String
9 | String get value => ['System', 'Light', 'Dark'][index];
10 | }
11 |
12 | /// 主题状态管理
13 | class ThemeProvider extends ChangeNotifier {
14 | ThemeMode? _themeMode;
15 |
16 | // 判断是否是 Dark Mode(该方法用于页面上判断是否为 Dark Mode,然后切换样式)
17 | bool isDark() {
18 | if (_themeMode == ThemeMode.system) {
19 | // 获取系统的 Dark Mode
20 | return SchedulerBinding.instance?.window.platformBrightness ==
21 | Brightness.dark;
22 | }
23 | return _themeMode == ThemeMode.dark;
24 | }
25 |
26 | // 获取主题模式
27 | ThemeMode getThemeMode() {
28 | String? themeMode = MySP.getThemeMode();
29 | switch (themeMode) {
30 | case 'System':
31 | _themeMode = ThemeMode.system;
32 | break;
33 | case 'Dark':
34 | _themeMode = ThemeMode.dark;
35 | break;
36 | default:
37 | _themeMode = ThemeMode.light;
38 | break;
39 | }
40 | return _themeMode!;
41 | }
42 |
43 | // 设置主题模式
44 | void setThemeMode(ThemeMode themeMode) {
45 | MySP.setThemeMode(themeMode.value);
46 | // 主题模式改变后,需要通知所有订阅者
47 | notifyListeners();
48 | }
49 |
50 | // 获取主题
51 | ThemeData getTheme({bool isDarkMode = false}) {
52 | var themeData = ThemeData(
53 | // 主题色
54 | primarySwatch: MyColor.primary,
55 | // 主色调(决定导航栏等颜色)
56 | // primaryColor: isDarkMode ? MyColor.dark_bg : MyColor.primary,
57 | // 亮度(深色还是浅色)
58 | brightness: isDarkMode ? Brightness.dark : Brightness.light,
59 | // 错误状态颜色(如输入框错误提示文字)
60 | errorColor: isDarkMode ? MyColor.dark_red : MyColor.light_red,
61 | // 文字强调色(前景色,也决定 ListView 的默认阴影颜色)
62 | accentColor: isDarkMode ? MyColor.white : MyColor.primary,
63 | // Tab 指示器的颜色
64 | // indicatorColor: isDarkMode ? MyColor.primary[50] : MyColor.white,
65 | // 页面背景色
66 | scaffoldBackgroundColor: isDarkMode ? MyColor.dark_bg : MyColor.white,
67 | // 用于突出显示切换 Widget(如 Switch,Radio 和 Checkbox)
68 | toggleableActiveColor: MyColor.primary,
69 | );
70 | return themeData;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/utils/device_util.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 | import 'package:flutter/foundation.dart';
3 |
4 | /// https://medium.com/gskinner-team/flutter-simplify-platform-screen-size-detection-4cb6fc4f7ed1
5 | /// 判断设备
6 | class DeviceUtil {
7 | static bool get isDesktop => !isWeb && (isWindows || isLinux || isMacOS);
8 | static bool get isMobile => isAndroid || isIOS;
9 | static bool get isWeb => kIsWeb;
10 |
11 | static bool get isWindows => Platform.isWindows;
12 | static bool get isLinux => Platform.isLinux;
13 | static bool get isMacOS => Platform.isMacOS;
14 | static bool get isAndroid => Platform.isAndroid;
15 | static bool get isFuchsia => Platform.isFuchsia;
16 | static bool get isIOS => Platform.isIOS;
17 | }
18 |
--------------------------------------------------------------------------------
/lib/utils/string_util.dart:
--------------------------------------------------------------------------------
1 | /// 字符串工具类
2 | class StringUtil {
3 | // 判断字符串是否不为空
4 | static bool isNotEmpty(String? text) {
5 | return text?.isNotEmpty ?? false;
6 | }
7 |
8 | // 判断字符串是否为空
9 | static bool isEmpty(String? text) {
10 | return text?.isEmpty ?? true;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/lib/widgets/login_input.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 登录输入框
4 | class LoginInput extends StatelessWidget {
5 | // 提示文字
6 | final String hintText;
7 | // 前缀图标
8 | final Widget? prefixIcon;
9 | // 控制器
10 | final TextEditingController controller;
11 | // 最多输入数,有值后右下角就会有一个计数器
12 | final int maxLength;
13 | // 隐藏文本
14 | final bool obscureText;
15 | // 键盘类型
16 | final TextInputType keyboardType;
17 | // 校验规则
18 | final FormFieldValidator? validator;
19 |
20 | const LoginInput(
21 | this.hintText,
22 | this.prefixIcon,
23 | this.controller, {
24 | Key? key,
25 | this.maxLength = 18,
26 | this.obscureText = false,
27 | this.keyboardType = TextInputType.text,
28 | this.validator,
29 | }) : super(key: key);
30 |
31 | @override
32 | Widget build(BuildContext context) {
33 | // Form 的子元素必须是 TextFormField,TextFormField 具备 TextField 的所有属性
34 | return TextFormField(
35 | controller: controller,
36 | maxLength: maxLength,
37 | keyboardType: keyboardType,
38 | obscureText: obscureText,
39 | // decoration 设置输入框的样式
40 | decoration: InputDecoration(
41 | // 隐藏计数器
42 | counterText: '',
43 | hintText: hintText,
44 | prefixIcon: prefixIcon,
45 | // 填充背景色
46 | filled: true,
47 | border: OutlineInputBorder(
48 | // 圆角形
49 | borderRadius: BorderRadius.all(
50 | Radius.circular(32),
51 | ),
52 | // 去除边框
53 | borderSide: BorderSide.none,
54 | ),
55 | // 内容内边距
56 | contentPadding: EdgeInsets.only(
57 | top: 0,
58 | bottom: 0,
59 | ),
60 | ),
61 | // 校验
62 | validator: validator,
63 | );
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | async:
5 | dependency: transitive
6 | description:
7 | name: async
8 | url: "https://pub.flutter-io.cn"
9 | source: hosted
10 | version: "2.8.2"
11 | boolean_selector:
12 | dependency: transitive
13 | description:
14 | name: boolean_selector
15 | url: "https://pub.flutter-io.cn"
16 | source: hosted
17 | version: "2.1.0"
18 | characters:
19 | dependency: transitive
20 | description:
21 | name: characters
22 | url: "https://pub.flutter-io.cn"
23 | source: hosted
24 | version: "1.2.0"
25 | charcode:
26 | dependency: transitive
27 | description:
28 | name: charcode
29 | url: "https://pub.flutter-io.cn"
30 | source: hosted
31 | version: "1.3.1"
32 | clock:
33 | dependency: transitive
34 | description:
35 | name: clock
36 | url: "https://pub.flutter-io.cn"
37 | source: hosted
38 | version: "1.1.0"
39 | collection:
40 | dependency: transitive
41 | description:
42 | name: collection
43 | url: "https://pub.flutter-io.cn"
44 | source: hosted
45 | version: "1.15.0"
46 | dio:
47 | dependency: "direct main"
48 | description:
49 | name: dio
50 | url: "https://pub.flutter-io.cn"
51 | source: hosted
52 | version: "4.0.5-beta1"
53 | fake_async:
54 | dependency: transitive
55 | description:
56 | name: fake_async
57 | url: "https://pub.flutter-io.cn"
58 | source: hosted
59 | version: "1.2.0"
60 | ffi:
61 | dependency: transitive
62 | description:
63 | name: ffi
64 | url: "https://pub.flutter-io.cn"
65 | source: hosted
66 | version: "1.1.2"
67 | file:
68 | dependency: transitive
69 | description:
70 | name: file
71 | url: "https://pub.flutter-io.cn"
72 | source: hosted
73 | version: "6.1.2"
74 | flutter:
75 | dependency: "direct main"
76 | description: flutter
77 | source: sdk
78 | version: "0.0.0"
79 | flutter_easyloading:
80 | dependency: "direct main"
81 | description:
82 | name: flutter_easyloading
83 | url: "https://pub.flutter-io.cn"
84 | source: hosted
85 | version: "3.0.3"
86 | flutter_localizations:
87 | dependency: "direct main"
88 | description: flutter
89 | source: sdk
90 | version: "0.0.0"
91 | flutter_spinkit:
92 | dependency: transitive
93 | description:
94 | name: flutter_spinkit
95 | url: "https://pub.flutter-io.cn"
96 | source: hosted
97 | version: "5.1.0"
98 | flutter_test:
99 | dependency: "direct dev"
100 | description: flutter
101 | source: sdk
102 | version: "0.0.0"
103 | flutter_web_plugins:
104 | dependency: transitive
105 | description: flutter
106 | source: sdk
107 | version: "0.0.0"
108 | http_parser:
109 | dependency: transitive
110 | description:
111 | name: http_parser
112 | url: "https://pub.flutter-io.cn"
113 | source: hosted
114 | version: "4.0.0"
115 | intl:
116 | dependency: transitive
117 | description:
118 | name: intl
119 | url: "https://pub.flutter-io.cn"
120 | source: hosted
121 | version: "0.17.0"
122 | js:
123 | dependency: transitive
124 | description:
125 | name: js
126 | url: "https://pub.flutter-io.cn"
127 | source: hosted
128 | version: "0.6.3"
129 | matcher:
130 | dependency: transitive
131 | description:
132 | name: matcher
133 | url: "https://pub.flutter-io.cn"
134 | source: hosted
135 | version: "0.12.11"
136 | meta:
137 | dependency: transitive
138 | description:
139 | name: meta
140 | url: "https://pub.flutter-io.cn"
141 | source: hosted
142 | version: "1.7.0"
143 | nested:
144 | dependency: transitive
145 | description:
146 | name: nested
147 | url: "https://pub.flutter-io.cn"
148 | source: hosted
149 | version: "1.0.0"
150 | path:
151 | dependency: transitive
152 | description:
153 | name: path
154 | url: "https://pub.flutter-io.cn"
155 | source: hosted
156 | version: "1.8.0"
157 | path_provider_linux:
158 | dependency: transitive
159 | description:
160 | name: path_provider_linux
161 | url: "https://pub.flutter-io.cn"
162 | source: hosted
163 | version: "2.1.2"
164 | path_provider_platform_interface:
165 | dependency: transitive
166 | description:
167 | name: path_provider_platform_interface
168 | url: "https://pub.flutter-io.cn"
169 | source: hosted
170 | version: "2.0.1"
171 | path_provider_windows:
172 | dependency: transitive
173 | description:
174 | name: path_provider_windows
175 | url: "https://pub.flutter-io.cn"
176 | source: hosted
177 | version: "2.0.4"
178 | platform:
179 | dependency: transitive
180 | description:
181 | name: platform
182 | url: "https://pub.flutter-io.cn"
183 | source: hosted
184 | version: "3.0.2"
185 | plugin_platform_interface:
186 | dependency: transitive
187 | description:
188 | name: plugin_platform_interface
189 | url: "https://pub.flutter-io.cn"
190 | source: hosted
191 | version: "2.0.2"
192 | process:
193 | dependency: transitive
194 | description:
195 | name: process
196 | url: "https://pub.flutter-io.cn"
197 | source: hosted
198 | version: "4.2.4"
199 | provider:
200 | dependency: "direct main"
201 | description:
202 | name: provider
203 | url: "https://pub.flutter-io.cn"
204 | source: hosted
205 | version: "6.0.1"
206 | shared_preferences:
207 | dependency: "direct main"
208 | description:
209 | name: shared_preferences
210 | url: "https://pub.flutter-io.cn"
211 | source: hosted
212 | version: "2.0.11"
213 | shared_preferences_android:
214 | dependency: transitive
215 | description:
216 | name: shared_preferences_android
217 | url: "https://pub.flutter-io.cn"
218 | source: hosted
219 | version: "2.0.9"
220 | shared_preferences_ios:
221 | dependency: transitive
222 | description:
223 | name: shared_preferences_ios
224 | url: "https://pub.flutter-io.cn"
225 | source: hosted
226 | version: "2.0.8"
227 | shared_preferences_linux:
228 | dependency: transitive
229 | description:
230 | name: shared_preferences_linux
231 | url: "https://pub.flutter-io.cn"
232 | source: hosted
233 | version: "2.0.3"
234 | shared_preferences_macos:
235 | dependency: transitive
236 | description:
237 | name: shared_preferences_macos
238 | url: "https://pub.flutter-io.cn"
239 | source: hosted
240 | version: "2.0.2"
241 | shared_preferences_platform_interface:
242 | dependency: transitive
243 | description:
244 | name: shared_preferences_platform_interface
245 | url: "https://pub.flutter-io.cn"
246 | source: hosted
247 | version: "2.0.0"
248 | shared_preferences_web:
249 | dependency: transitive
250 | description:
251 | name: shared_preferences_web
252 | url: "https://pub.flutter-io.cn"
253 | source: hosted
254 | version: "2.0.2"
255 | shared_preferences_windows:
256 | dependency: transitive
257 | description:
258 | name: shared_preferences_windows
259 | url: "https://pub.flutter-io.cn"
260 | source: hosted
261 | version: "2.0.3"
262 | sky_engine:
263 | dependency: transitive
264 | description: flutter
265 | source: sdk
266 | version: "0.0.99"
267 | source_span:
268 | dependency: transitive
269 | description:
270 | name: source_span
271 | url: "https://pub.flutter-io.cn"
272 | source: hosted
273 | version: "1.8.1"
274 | stack_trace:
275 | dependency: transitive
276 | description:
277 | name: stack_trace
278 | url: "https://pub.flutter-io.cn"
279 | source: hosted
280 | version: "1.10.0"
281 | stream_channel:
282 | dependency: transitive
283 | description:
284 | name: stream_channel
285 | url: "https://pub.flutter-io.cn"
286 | source: hosted
287 | version: "2.1.0"
288 | string_scanner:
289 | dependency: transitive
290 | description:
291 | name: string_scanner
292 | url: "https://pub.flutter-io.cn"
293 | source: hosted
294 | version: "1.1.0"
295 | term_glyph:
296 | dependency: transitive
297 | description:
298 | name: term_glyph
299 | url: "https://pub.flutter-io.cn"
300 | source: hosted
301 | version: "1.2.0"
302 | test_api:
303 | dependency: transitive
304 | description:
305 | name: test_api
306 | url: "https://pub.flutter-io.cn"
307 | source: hosted
308 | version: "0.4.3"
309 | typed_data:
310 | dependency: transitive
311 | description:
312 | name: typed_data
313 | url: "https://pub.flutter-io.cn"
314 | source: hosted
315 | version: "1.3.0"
316 | vector_math:
317 | dependency: transitive
318 | description:
319 | name: vector_math
320 | url: "https://pub.flutter-io.cn"
321 | source: hosted
322 | version: "2.1.1"
323 | win32:
324 | dependency: transitive
325 | description:
326 | name: win32
327 | url: "https://pub.flutter-io.cn"
328 | source: hosted
329 | version: "2.3.1"
330 | xdg_directories:
331 | dependency: transitive
332 | description:
333 | name: xdg_directories
334 | url: "https://pub.flutter-io.cn"
335 | source: hosted
336 | version: "0.2.0"
337 | sdks:
338 | dart: ">=2.14.0 <3.0.0"
339 | flutter: ">=2.5.0"
340 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_template_mini
2 | description: flutter_template_mini
3 |
4 | publish_to: 'none'
5 |
6 | # 版本号
7 | version: 1.0.0+1
8 |
9 | environment:
10 | sdk: ">=2.12.0 <3.0.0"
11 |
12 | dependencies:
13 | flutter:
14 | sdk: flutter
15 | # 本地化
16 | flutter_localizations:
17 | sdk: flutter
18 | # 数据持久化
19 | shared_preferences: ^2.0.11
20 | # http
21 | dio: ^4.0.5-beta1
22 | # loading 遮盖层
23 | flutter_easyloading: ^3.0.3
24 | # 状态管理
25 | provider: ^6.0.1
26 |
27 | dev_dependencies:
28 | flutter_test:
29 | sdk: flutter
30 |
31 | # flutter 相关的配置选项
32 | flutter:
33 | # 默认的 Material Design 字体图标
34 | uses-material-design: true
35 |
36 | # 静态资源
37 | assets:
38 | - assets/images/login/
39 |
40 | # 自定义字体图标(该脚手架没有用这个,用的是 Flutter 自带的默认 Icons)
41 | # 使用教程 https://book.flutterchina.club/chapter3/img_and_icon.html#_3-3-2-icon
42 | fonts:
43 | - family: iconfont
44 | fonts:
45 | - asset: assets/icons/iconfont.ttf
46 |
--------------------------------------------------------------------------------