diff --git a/.gradle/buildOutputCleanup/built.bin b/.github/issue_template.md similarity index 100% rename from .gradle/buildOutputCleanup/built.bin rename to .github/issue_template.md diff --git a/lib/widgets/elements/Form/Slider/SliderComponentShape/index.dart b/.github/pull_request_template.md similarity index 100% rename from lib/widgets/elements/Form/Slider/SliderComponentShape/index.dart rename to .github/pull_request_template.md diff --git a/.gradle/3.5.1/file-changes/last-build.bin b/.gradle/3.5.1/file-changes/last-build.bin deleted file mode 100644 index f76dd238..00000000 Binary files a/.gradle/3.5.1/file-changes/last-build.bin and /dev/null differ diff --git a/.gradle/3.5.1/taskHistory/taskHistory.lock b/.gradle/3.5.1/taskHistory/taskHistory.lock deleted file mode 100644 index 1a1ada52..00000000 Binary files a/.gradle/3.5.1/taskHistory/taskHistory.lock and /dev/null differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties deleted file mode 100644 index 061d565e..00000000 --- a/.gradle/buildOutputCleanup/cache.properties +++ /dev/null @@ -1,2 +0,0 @@ -#Thu Nov 22 22:29:42 CST 2018 -gradle.version=3.5.1 diff --git a/.gradle/buildOutputCleanup/cache.properties.lock b/.gradle/buildOutputCleanup/cache.properties.lock deleted file mode 100644 index 40fdece9..00000000 --- a/.gradle/buildOutputCleanup/cache.properties.lock +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/LICENSE b/LICENSE index 266fb814..0d5ee6f4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,28 @@ -Copyright (c) 2018-present Alibaba Inc. +BSD License -Permission is granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Copyright (c) 2018-present, Alibaba Group Holding Limited. All rights reserved. -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: -THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", -WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE \ No newline at end of file + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of the copyright holder nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README-en.md b/README-en.md index 8d12ec7a..98a2683e 100644 --- a/README-en.md +++ b/README-en.md @@ -9,7 +9,11 @@ Android download URL: +<<<<<<< HEAD +======= + +>>>>>>> develop Iphone download URL: No diff --git a/README.md b/README.md index 48d3a671..076e714b 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,26 @@ Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en. ## Flutter Go ![https://img.alicdn.com/tfs/TB1OJkeHNYaK1RjSZFnXXa80pXa-229-229.png](https://img.alicdn.com/tfs/TB1OJkeHNYaK1RjSZFnXXa80pXa-229-229.png) +<<<<<<< HEAD +======= + +> 帮助开发者快速上手 Flutter **Flutter Go 1.0 Android版已正式发布** + +## 版本更新历史 +> 按时间顺序,展示重要的提交更新内容。 + +[地址](https://github.com/alibaba/flutter-go/blob/develop/CHANGE-LOG.md) + +## 开发规范 +> 由于类似 javascript, java, object-c,等开发者的语言习惯不同而产生歧义,我们依据官方提供的 [dart 语言规范](https://www.dartlang.org) 定制。 + +[<< Flutter Go 开发规范第一版 >>](https://github.com/alibaba/flutter-go/blob/develop/Flutter_Go%20%E4%BB%A3%E7%A0%81%E5%BC%80%E5%8F%91%E8%A7%84%E8%8C%83.md) + +## The Flutter-Go Roadmap(路线图) for 2019 +> 考虑到 Flutter 未来的变化和策略的可变性, roadmap 不排除有一定调整,但总体不会变化太大。 + + +>>>>>>> develop > 帮助开发者快速上手 Flutter **Flutter Go 1.0 Android版已正式发布** @@ -19,7 +39,11 @@ Language: [English](https://github.com/alibaba/flutter-go/blob/master/README-en. android下载地址: +<<<<<<< HEAD +======= + +>>>>>>> develop iphone下载地址: 暂无 @@ -52,7 +76,11 @@ flutter优点主要包括: #### Flutter Go 的优势 +<<<<<<< HEAD - 详解常用widget多达 **140+** 个 +======= +- 详解常用 widget 多达 **140+** 个 +>>>>>>> develop - 配套 Demo 详解 widget 常规用法 - 集中整合 widget 案例,一个 APP 搞定所有常用 widget 的用法 - 持续迭代 ‘追新’ 官方版本 @@ -96,7 +124,23 @@ flutter优点主要包括: +### 版权说明 +- 感谢大家对 `flutter go` 的支持和下载,但近期发现,有类似直接被发布到苹果 app store 上的行为,并未注明真实来源,copyright 和 项目的 github 地址,以及开发者的版权相关信息( 包括删除"首页栏的版权声明"和"关于我们"的行为 ); + +- 上述行为,打击了 `flutter go` 开发者的积极性,同时干扰了 flutter go app 的正常发布渠道,基于 app 开源项目的发布特殊性,特更新 [LICENSE](LICENSE) 「 开源许可证 」,由 MIT 协议 更改为 BSD 协议, 同时建议不要随意发布到公共渠道的应用商店,影响官方 `flutter go` 的app版本迭代; + +- 大家可以继续放心的开源使用,但是要求注意和遵守以下许可前提: +``` + * 版权声明样式 + //Copyright (c) 2018-present, Alibaba Group Holding Limited. All rights reserved. + + * 源代码的重新分发必须保留上述版权声明,条件清单和免责声明。 + + * 二进制形式的再分发必须复制上述版权声明,此条件列表以及文档中的以下免责声明和/或随分发提供的其他材料。 +``` +- 由于本开源项目是供大家学习和交流 flutter 之用,里面耗费了开发人员大量的心血,精力和热情,请尊重开发者的劳动成果,以及相关许可证之规定; + +- 大家的互相信任,尊重与支持,才是开源社区前进的动力和来源. + Powered by [阿里拍卖前端团队](https://github.com/alibaba-paimai-frontend) - - diff --git a/android/.gitignore b/android/.gitignore deleted file mode 100644 index 65b7315a..00000000 --- a/android/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -*.iml -*.class -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures -GeneratedPluginRegistrant.java diff --git a/android/.project b/android/.project deleted file mode 100644 index 3964dd3f..00000000 --- a/android/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - android - Project android created by Buildship. - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index e8895216..00000000 --- a/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir= -eclipse.preferences.version=1 diff --git a/android/app/.classpath b/android/app/.classpath deleted file mode 100644 index eb19361b..00000000 --- a/android/app/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/android/app/.project b/android/app/.project deleted file mode 100644 index ac485d7c..00000000 --- a/android/app/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - app - Project app created by Buildship. - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/android/app/.settings/org.eclipse.buildship.core.prefs b/android/app/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index b1886adb..00000000 --- a/android/app/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir=.. -eclipse.preferences.version=1 diff --git a/android/app/bin/build.gradle b/android/app/bin/build.gradle deleted file mode 100644 index 4b2420a5..00000000 --- a/android/app/bin/build.gradle +++ /dev/null @@ -1,61 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 27 - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.flutterrookiebook" - minSdkVersion 16 - targetSdkVersion 27 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' -} diff --git a/android/app/bin/src/main/AndroidManifest.xml b/android/app/bin/src/main/AndroidManifest.xml deleted file mode 100644 index d7921ff6..00000000 --- a/android/app/bin/src/main/AndroidManifest.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/android/app/bin/src/main/res/drawable/launch_background.xml b/android/app/bin/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 304732f8..00000000 --- a/android/app/bin/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/android/app/bin/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/bin/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4b..00000000 Binary files a/android/app/bin/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/bin/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/bin/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b79..00000000 Binary files a/android/app/bin/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/bin/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/bin/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d43914..00000000 Binary files a/android/app/bin/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/bin/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/bin/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d3..00000000 Binary files a/android/app/bin/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/bin/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/bin/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372ee..00000000 Binary files a/android/app/bin/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/android/app/bin/src/main/res/values/styles.xml b/android/app/bin/src/main/res/values/styles.xml deleted file mode 100644 index 00fa4417..00000000 --- a/android/app/bin/src/main/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/android/app/build.gradle b/android/app/build.gradle index 3eef3030..b723070c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -25,8 +25,19 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + + android { - compileSdkVersion 27 + compileSdkVersion 28 + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -38,21 +49,32 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). +<<<<<<< HEAD applicationId "com.ali.fluttergo" +======= + applicationId "com.alibaba.fluttergo" +>>>>>>> develop minSdkVersion 16 - targetSdkVersion 27 + targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } - buildTypes { + signingConfigs { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile file(keystoreProperties['storeFile']) + storePassword keystoreProperties['storePassword'] } } + buildTypes { + release { + signingConfig signingConfigs.release + } + } + } flutter { @@ -62,6 +84,20 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test:runner:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' + //firebase + implementation 'com.google.firebase:firebase-core:16.0.8' + //Crashlytics SDK + implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9' + // 性能监控 + ///implementation 'com.google.firebase:firebase-perf:16.2.3' + // 登陆 + ////implementation 'com.google.firebase:firebase-auth:16.0.3' } +//firebase +apply plugin: 'com.google.gms.google-services' +//Crashlytics SDK +apply plugin: 'io.fabric' +// 性能监控 +///apply plugin: 'com.google.firebase.firebase-perf' \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 00000000..06bce26c --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,40 @@ +{ + "project_info": { + "project_number": "611157827052", + "firebase_url": "https://alibaba-flutter-go.firebaseio.com", + "project_id": "alibaba-flutter-go", + "storage_bucket": "alibaba-flutter-go.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:611157827052:android:c6129e5eff2f125d", + "android_client_info": { + "package_name": "com.alibaba.fluttergo" + } + }, + "oauth_client": [ + { + "client_id": "611157827052-iiuevj8qu56alpqh47v37j9sd4e40di7.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyA9chxDIuds7gmPQTJPpDpoXyN9rDTdvhU" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "611157827052-iiuevj8qu56alpqh47v37j9sd4e40di7.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} diff --git a/android/app/release/output.json b/android/app/release/output.json new file mode 100644 index 00000000..16e1b0c5 --- /dev/null +++ b/android/app/release/output.json @@ -0,0 +1 @@ +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"0.0.5","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] \ No newline at end of file diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 6c60789b..3d7121ec 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,9 @@ +======= + package="com.alibaba.fluttergo"> +>>>>>>> develop diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 97b1e4ee..5d2aa0fb 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,9 @@ +======= + package="com.alibaba.fluttergo"> +>>>>>>> develop +======= + android:src="@drawable/splash" /> +>>>>>>> develop diff --git a/android/app/src/main/res/mipmap-xxxhdpi/spalsh.png b/android/app/src/main/res/mipmap-xxxhdpi/spalsh.png new file mode 100644 index 00000000..dc63fc0e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/spalsh.png differ diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 6c60789b..3d7121ec 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,9 @@ +======= + package="com.alibaba.fluttergo"> +>>>>>>> develop diff --git a/android/build.gradle b/android/build.gradle index 01352d98..b60a516d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,30 @@ buildscript { +<<<<<<< HEAD ext.kotlin_version = '1.2.71' +======= + ext.kotlin_version = '1.3.0' +>>>>>>> develop repositories { google() jcenter() + //Crashlytics SDK + maven { + url 'https://maven.fabric.io/public' + } } dependencies { +<<<<<<< HEAD classpath 'com.android.tools.build:gradle:3.2.0' +======= + classpath 'com.android.tools.build:gradle:3.3.0' + //firebase + classpath 'com.google.gms:google-services:4.2.0' + //Crashlytics SDK + classpath 'io.fabric.tools:gradle:1.26.1' + // 性能监控 + ///classpath 'com.google.firebase:firebase-plugins:1.1.5' +>>>>>>> develop classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -15,6 +33,10 @@ allprojects { repositories { google() jcenter() + //Crashlytics SDK + maven { + url 'https://maven.google.com/' + } } } diff --git a/android/gradle.properties b/android/gradle.properties index 8bd86f68..678cd624 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1 +1,3 @@ org.gradle.jvmargs=-Xmx1536M +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 03824124..c2bcac0e 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/android/key.properties b/android/key.properties new file mode 100644 index 00000000..0be86790 --- /dev/null +++ b/android/key.properties @@ -0,0 +1,4 @@ +storePassword=fluttergo123 +keyPassword=fluttergo123 +keyAlias=key +storeFile=/Users/xj.deng/key.jks \ No newline at end of file diff --git a/assets/images/ali_connors.png b/assets/images/ali_connors.png new file mode 100644 index 00000000..b7e34322 Binary files /dev/null and b/assets/images/ali_connors.png differ diff --git a/flutter_01.png b/flutter_01.png new file mode 100644 index 00000000..16a118fc Binary files /dev/null and b/flutter_01.png differ diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 8c3f0e89..5f24a571 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 94722E5B22511D3600F63900 /* GoogleService-Info.plist */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; @@ -78,6 +79,7 @@ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 94722E5B22511D3600F63900 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; @@ -87,6 +89,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A9941E6EA19A9CEF6B117A70 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + CBA6E34746642008D95A119D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; DDA792F029EDD7A11295D192 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -129,6 +133,8 @@ 0C172CA58CDB230D5DA80034 /* Pods */ = { isa = PBXGroup; children = ( + CBA6E34746642008D95A119D /* Pods-Runner.debug.xcconfig */, + A9941E6EA19A9CEF6B117A70 /* Pods-Runner.release.xcconfig */, ); name = Pods; sourceTree = ""; @@ -178,6 +184,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 94722E5B22511D3600F63900 /* GoogleService-Info.plist */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 97C146FA1CF9000F007C117D /* Main.storyboard */, @@ -236,7 +243,8 @@ TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = RDJKXT446D; + DevelopmentTeam = 4WLT68XRNA; + ProvisioningStyle = Manual; }; }; }; @@ -245,6 +253,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -282,6 +291,10 @@ 0828E49B220692B500A59437 /* iPad Landscape@2x.png in Resources */, 0828E495220692B500A59437 /* iPhone Portrait-Retina 4.png in Resources */, 0828E498220692B500A59437 /* iPhone XS Max Portrait.png in Resources */, +<<<<<<< HEAD +======= + 94722E5C22511D3600F63900 /* GoogleService-Info.plist in Resources */, +>>>>>>> develop 0828E496220692B500A59437 /* iPad Portrait.png in Resources */, 0828E49C220692B500A59437 /* iPhone Landscape-Retina HD 5.5.png in Resources */, ); @@ -309,15 +322,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${PODS_PODFILE_DIR_PATH}/Podfile.lock", "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); outputPaths = ( "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); @@ -345,15 +354,11 @@ buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", ); name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - ); outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", ); @@ -509,8 +514,12 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2; +<<<<<<< HEAD +======= + CODE_SIGN_STYLE = Manual; +>>>>>>> develop CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = RDJKXT446D; + DEVELOPMENT_TEAM = 4WLT68XRNA; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -522,8 +531,13 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); +<<<<<<< HEAD PRODUCT_BUNDLE_IDENTIFIER = com.ali.flutterRookieBook; +======= + PRODUCT_BUNDLE_IDENTIFIER = com.alibaba.fluttergo; +>>>>>>> develop PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = "FlutterGO-alibaba-develop"; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; @@ -534,8 +548,13 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Launch2; +<<<<<<< HEAD +======= + CODE_SIGN_IDENTITY = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; +>>>>>>> develop CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = RDJKXT446D; + DEVELOPMENT_TEAM = 4WLT68XRNA; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -547,8 +566,13 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); +<<<<<<< HEAD PRODUCT_BUNDLE_IDENTIFIER = com.ali.flutterRookieBook; +======= + PRODUCT_BUNDLE_IDENTIFIER = com.alibaba.fluttergo; +>>>>>>> develop PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = FlutterGO_alibaba_distribution_ad_hoc; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index ba1a9822..04305270 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -42,7 +42,7 @@ - - - - IDEDidComputeMac32BitWarning - - - diff --git a/ios/Runner/AppDelegate.m b/ios/Runner/AppDelegate.m index 7feb3d13..7474c39b 100644 --- a/ios/Runner/AppDelegate.m +++ b/ios/Runner/AppDelegate.m @@ -1,10 +1,15 @@ #include "AppDelegate.h" #include "GeneratedPluginRegistrant.h" +@import Firebase;//增加 firebase 支持 + @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + + [FIRApp configure];//增加 firebase 支持 + [GeneratedPluginRegistrant registerWithRegistry:self]; // Override point for customization after application launch. [NSThread sleepForTimeInterval:2]; diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024*1024@as.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024*1024@as.png new file mode 100644 index 00000000..08914f3d Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024*1024@as.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x-1.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x-1.png new file mode 100644 index 00000000..055f3bcd Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x-1.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x.png new file mode 100644 index 00000000..055f3bcd Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120*120@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/152*152.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/152*152.png new file mode 100644 index 00000000..943f238d Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/152*152.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/167*167.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/167*167.png new file mode 100644 index 00000000..32cd3ce8 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/167*167.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/180*180@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/180*180@3x.png new file mode 100644 index 00000000..d9e78f38 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/180*180@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/20*20.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/20*20.png new file mode 100644 index 00000000..647ecd69 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/20*20.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x-2.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x-2.png new file mode 100644 index 00000000..6e15bb66 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x-2.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x.png new file mode 100644 index 00000000..6e15bb66 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29*29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-1.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-1.png new file mode 100644 index 00000000..d2feff96 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-1.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-2.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-2.png new file mode 100644 index 00000000..d2feff96 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x-2.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x.png new file mode 100644 index 00000000..d2feff96 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40*40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x-1.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x-1.png new file mode 100644 index 00000000..dc39ef7d Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x-1.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x.png new file mode 100644 index 00000000..dc39ef7d Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58*58@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/60*60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/60*60@3x.png new file mode 100644 index 00000000..962f2ef7 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/60*60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/76*76.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/76*76.png new file mode 100644 index 00000000..e2dbdfbb Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/76*76.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x-1.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x-1.png new file mode 100644 index 00000000..97274408 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x-1.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x.png new file mode 100644 index 00000000..97274408 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80*80@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/87*87.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/87*87.png new file mode 100644 index 00000000..5cce3c2f Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/87*87.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d36b1fab..7fbfe11e 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -3,115 +3,115 @@ { "size" : "20x20", "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", + "filename" : "40*40@1x.png", "scale" : "2x" }, { "size" : "20x20", "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", + "filename" : "60*60@3x.png", "scale" : "3x" }, { "size" : "29x29", "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", + "filename" : "29*29@1x.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", + "filename" : "58*58@2x.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", + "filename" : "87*87.png", "scale" : "3x" }, { "size" : "40x40", "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", + "filename" : "80*80@2x.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", + "filename" : "120*120@2x.png", "scale" : "3x" }, { "size" : "60x60", "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", + "filename" : "120*120@2x-1.png", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", + "filename" : "180*180@3x.png", "scale" : "3x" }, { "size" : "20x20", "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", + "filename" : "20*20.png", "scale" : "1x" }, { "size" : "20x20", "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", + "filename" : "40*40@1x-2.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", + "filename" : "29*29@1x-2.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", + "filename" : "58*58@2x-1.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", + "filename" : "40*40@1x-1.png", "scale" : "1x" }, { "size" : "40x40", "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", + "filename" : "80*80@2x-1.png", "scale" : "2x" }, { "size" : "76x76", "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", + "filename" : "76*76.png", "scale" : "1x" }, { "size" : "76x76", "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", + "filename" : "152*152.png", "scale" : "2x" }, { "size" : "83.5x83.5", "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", + "filename" : "167*167.png", "scale" : "2x" }, { "size" : "1024x1024", "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", + "filename" : "1024*1024@as.png", "scale" : "1x" } ], @@ -119,4 +119,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index 3d43d11e..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 28c6bf03..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index f091b6b0..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 4cde1211..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index d0ef06e7..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index dcdc2306..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index c8f9ed8f..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index 75b2d164..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index c4df70d3..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 6a84f41e..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index d0e1f585..00000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist new file mode 100644 index 00000000..4f83dfab --- /dev/null +++ b/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,36 @@ + + + + + CLIENT_ID + 611157827052-0n777p43lrtr2dpo7gco5o3lffu7a7r4.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.611157827052-0n777p43lrtr2dpo7gco5o3lffu7a7r4 + API_KEY + AIzaSyDztt5Q9D7plAc8VqNtHumAci6BaoOiTg4 + GCM_SENDER_ID + 611157827052 + PLIST_VERSION + 1 + BUNDLE_ID + com.alibaba.fluttergo + PROJECT_ID + alibaba-flutter-go + STORAGE_BUCKET + alibaba-flutter-go.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:611157827052:ios:c6129e5eff2f125d + DATABASE_URL + https://alibaba-flutter-go.firebaseio.com + + \ No newline at end of file diff --git a/ios/Runner/Images.xcassets/LaunchImage-2.launchimage/Contents.json b/ios/Runner/Images.xcassets/LaunchImage-2.launchimage/Contents.json index 5a296668..8c30dd6e 100644 --- a/ios/Runner/Images.xcassets/LaunchImage-2.launchimage/Contents.json +++ b/ios/Runner/Images.xcassets/LaunchImage-2.launchimage/Contents.json @@ -3,6 +3,7 @@ { "orientation" : "portrait", "idiom" : "ipad", +<<<<<<< HEAD "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "2x" @@ -12,11 +13,16 @@ "idiom" : "ipad", "minimum-system-version" : "7.0", "extent" : "full-screen", +======= + "extent" : "full-screen", + "minimum-system-version" : "7.0", +>>>>>>> develop "scale" : "1x" }, { "orientation" : "landscape", "idiom" : "ipad", +<<<<<<< HEAD "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "2x" @@ -40,6 +46,25 @@ "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "1x" +======= + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" +>>>>>>> develop } ], "info" : { diff --git a/lib/blocs/bak/search_api.dart b/lib/blocs/bak/search_api.dart new file mode 100644 index 00000000..0548d34e --- /dev/null +++ b/lib/blocs/bak/search_api.dart @@ -0,0 +1,35 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 3:20 PM + * email: zhu.yan@alibaba-inc.com + * tartget: FlatButton 的示例 + */ +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'dart:convert'; +import './search_result.dart'; +import 'package:html/parser.dart' show parse; + +var dio = new Dio(); +class Api { + Future> search(name) async { + print('=========>>>'); + var response = await dio.get("https://www.so.com/s?ie=utf-8&q=$name"); +// var document = parse(response.data); +// var app = document.querySelectorAll('.res-title a'); + List res = []; +// app.forEach((f) { +// res.add( +// SearchResult( +// title: f.text, +// source: f.attributes["data-url"] ?? f.attributes["href"], +// ), +// ); +// }); + return res; + } +} + +Api api = Api(); \ No newline at end of file diff --git a/lib/blocs/bak/search_bloc.dart b/lib/blocs/bak/search_bloc.dart new file mode 100644 index 00000000..08d526c8 --- /dev/null +++ b/lib/blocs/bak/search_bloc.dart @@ -0,0 +1,35 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 7:17 PM + * email: zhu.yan@alibaba-inc.com + * tartget: + */ +import 'dart:async'; +import 'package:bloc/bloc.dart'; + +import './search_event.dart'; +import './search_state.dart'; +import './search_api.dart'; + + +/// 这里导入api类与上面的SearchEvent与SearchState文件 + +class SearchBloc extends Bloc { + @override + SearchState get initialState => SearchUninitialized(); + + @override + Stream mapEventToState(SearchEvent event,) async* { + if (event is SearchFetch) { + try { + yield SearchLoading(); + final res = await api.search(event.query); + yield SearchLoaded(res: res); + } catch (_) { + yield SearchError(); + } + } + } +} \ No newline at end of file diff --git a/lib/blocs/bak/search_event.dart b/lib/blocs/bak/search_event.dart new file mode 100644 index 00000000..0ecc0b44 --- /dev/null +++ b/lib/blocs/bak/search_event.dart @@ -0,0 +1,18 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 7:18 PM + * email: zhu.yan@alibaba-inc.com + * tartget: + */ +abstract class SearchEvent {} + +class SearchFetch extends SearchEvent { + final String query; + + SearchFetch({this.query}); + + @override + String toString() => 'SearchFetch:获取搜索结果事件'; +} \ No newline at end of file diff --git a/lib/blocs/bak/search_result.dart b/lib/blocs/bak/search_result.dart new file mode 100644 index 00000000..8001e49a --- /dev/null +++ b/lib/blocs/bak/search_result.dart @@ -0,0 +1,14 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 7:11 PM + * email: zhu.yan@alibaba-inc.com + * tartget: + */ +class SearchResult { + String title; + String source; + + SearchResult({this.title, this.source}); +} \ No newline at end of file diff --git a/lib/blocs/bak/search_state.dart b/lib/blocs/bak/search_state.dart new file mode 100644 index 00000000..85d85791 --- /dev/null +++ b/lib/blocs/bak/search_state.dart @@ -0,0 +1,37 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 7:13 PM + * email: zhu.yan@alibaba-inc.com + * tartget: + */ +import './search_result.dart'; + +abstract class SearchState {} + +class SearchError extends SearchState { + @override + String toString() => 'SearchError:获取失败'; +} + +class SearchUninitialized extends SearchState { + @override + String toString() => 'SearchUninitialized:未初始化'; +} + +class SearchLoading extends SearchState { + @override + String toString() => 'SearchLoading :正在加载'; +} + +class SearchLoaded extends SearchState { + final List res; + + SearchLoaded({ + this.res, + }); + + @override + String toString() => 'SearchLoaded:加载完毕'; +} \ No newline at end of file diff --git a/lib/blocs/bak/search_widget.dart b/lib/blocs/bak/search_widget.dart new file mode 100644 index 00000000..1e29848a --- /dev/null +++ b/lib/blocs/bak/search_widget.dart @@ -0,0 +1,80 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 7:19 PM + * email: zhu.yan@alibaba-inc.com + * tartget: + */ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +//import 'package:suiyi/blocs/search/bloc.dart'; +import './search_event.dart'; +import './search_state.dart'; +import './search_bloc.dart'; + + +class SearchWidget extends StatefulWidget { + final SearchDelegate delegate; + final String query; + SearchWidget({this.delegate, this.query}); + @override + _SearchWidgetState createState() => _SearchWidgetState(); +} + +class _SearchWidgetState extends State { + final SearchBloc _search = SearchBloc(); + String old; + @override + void dispose() { + _search.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + print('1:${old}'); + print('2:${widget.query}'); + if (old != widget.query) { + _search.dispatch(SearchFetch(query: widget.query)); + old = widget.query; + } + return BlocBuilder( + bloc: _search, + builder: (BuildContext context, SearchState state) { + print('-------${state}'); + if (state is SearchUninitialized || state is SearchLoading) { + return Center( + child: CircularProgressIndicator(), + ); + } else if (state is SearchError) { + return Center( + child: Text('获取失败'), + ); + } else if (state is SearchLoaded) { + return ListView.builder( + itemBuilder: (BuildContext context, int index) { + return ListTile( + dense: true, + leading: Icon( + Icons.bookmark_border, + size: 32, + ), + title: Text( + state.res[index].title, + overflow: TextOverflow.ellipsis, + ), + subtitle: Text(state.res[index].source), + onTap: () { + // 在这里对选中的结果进行解析,因为我目前是用golang实现的,所以就没贴代码了。 + print(state.res[index].source); + }, + ); + }, + itemCount: state.res.length, + ); + } + }, + ); + } +} \ No newline at end of file diff --git a/lib/blocs/industry_api.dart b/lib/blocs/industry_api.dart new file mode 100644 index 00000000..fc8b2967 --- /dev/null +++ b/lib/blocs/industry_api.dart @@ -0,0 +1,71 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 3:20 PM + * email: zhu.yan@alibaba-inc.com + * tartget: FlatButton 的示例 + */ +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'dart:convert'; +import 'package:html/parser.dart' show parse; +import './industry_model.dart'; +import './search_result.dart'; + +var dio = new Dio(); +//class Api2 { +// /// 关键字提示(起点) +// Future> suggestion(String query) async { +//// http.Response response = await http.get( +//// "https://www.qidian.com/ajax/Search/AutoComplete?siteid=1&query=$query"); +// var response = await dio.get("https://www.qidian.com/ajax/Search/AutoComplete?siteid=1&query=$query", data: {}); +// //var response = await dio.get("https://www.so.com/s?ie=utf-8&q=$query"); +// print('1=====>${query}'); +// print('2=====>${response.data}'); +// //var data = Suggestion.fromJson(json.decode(response.body)); +// //var data = Suggestion.fromJson(json.decode(response.data)); +// var data = Suggestion.fromJson(json.decode(response.data)); +// List suggestion = []; +// data.suggestions.forEach((k) { +// //print('=====>${k.value}'); +// suggestion.add(k.value); +// }); +// +// return Future.delayed(Duration(seconds:2), () { +// return suggestion; +// }); +// //return suggestion; +// } +//} +class Api { + /// 关键字提示(起点) + Future> suggestion(String query) async { +// http.Response response = await http.get( +// "https://www.qidian.com/ajax/Search/AutoComplete?siteid=1&query=$query"); + /// var response = await dio.get("https://www.qidian.com/ajax/Search/AutoComplete?siteid=1&query=$query", data: {}); + var response = await dio.get("https://www.so.com/s?ie=utf-8&q=$query flutter"); + var document = parse(response.data); + var app = document.querySelectorAll('.res-title a'); + ///print('1=====>${query}'); + ///print('2=====>${response.data}'); + ////print('3=====>${app}'); + List res = []; + app.forEach((f) { + ///print('f==>${f}'); + res.add( + SearchResult( + title: f.text, + source: f.attributes["data-url"] ?? f.attributes["href"], + ), + ); + }); + + return Future.delayed(Duration(seconds:2), () { + return res; + }); + //return suggestion; + } +} + +Api api = Api(); \ No newline at end of file diff --git a/lib/blocs/industry_bloc.dart b/lib/blocs/industry_bloc.dart new file mode 100644 index 00000000..3bcd464c --- /dev/null +++ b/lib/blocs/industry_bloc.dart @@ -0,0 +1,41 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 5:19 PM + * email: zhu.yan@alibaba-inc.com + * tartget: + */ +import 'dart:async'; +import 'package:bloc/bloc.dart'; +import './industry_api.dart'; +import './industry_event.dart'; +import './industry_state.dart'; + +class SuggestionBloc extends Bloc { + @override + SuggestionState get initialState => SuggestionUninitialized(); + @override + Stream mapEventToState(SuggestionEvent event)async* { + //Stream mapEventToState(SuggestionState currentState, SuggestionEvent event,) async* { + if (event is SuggestionFetch) { + //print('event==>${event}'); + try { + yield SuggestionLoading(); + final res = await api.suggestion(event.query); + print('res====>${res}'); + yield SuggestionLoaded(res: res); + } catch (_) { + yield SuggestionError(); + } + } + if (event is SuggestionClearFetch) { + //print('event==>${event}'); + try { + yield SuggestionUninitialized(); + } catch (_) { + yield SuggestionError(); + } + } + } +} diff --git a/lib/blocs/industry_event.dart b/lib/blocs/industry_event.dart new file mode 100644 index 00000000..641720b2 --- /dev/null +++ b/lib/blocs/industry_event.dart @@ -0,0 +1,26 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 3:35 PM + * email: zhu.yan@alibaba-inc.com + */ +abstract class SuggestionEvent {} + +class SuggestionFetch extends SuggestionEvent { + final String query; + + SuggestionFetch({this.query}); + + @override + String toString() => 'SuggestionFetch:获取关键字提示事件'; +} + +class SuggestionClearFetch extends SuggestionEvent { + final String query; + + SuggestionClearFetch({this.query}); + + @override + String toString() => 'SuggestionClearFetch:清空界面'; +} \ No newline at end of file diff --git a/lib/blocs/industry_main.dart b/lib/blocs/industry_main.dart new file mode 100644 index 00000000..22dfbc0a --- /dev/null +++ b/lib/blocs/industry_main.dart @@ -0,0 +1,79 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 3:52 PM + * email: zhu.yan@alibaba-inc.com + */ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import './industry_bloc.dart'; +import './industry_event.dart'; +import './industry_state.dart'; + +final SuggestionBloc suggestion = SuggestionBloc(); + +class IndustryPage extends StatefulWidget { + final Function itemTitle; + IndustryPage({Key key,this.itemTitle}) : super(key: key); + + @override + _IndustryState createState() => _IndustryState(); +} + +class _IndustryState extends State { + @override + Widget build(BuildContext context) { + return Material( + child: Column( + children: [ +// TextField( +// autofocus: true, +// textAlign: TextAlign.center, +// onSubmitted: (text) { +// print('onSubmitted:${text}'); +// suggestion.dispatch(SuggestionFetch(query: text)); +// }, +// ), + Expanded( + child: BlocBuilder( + bloc: suggestion, + builder: (BuildContext context, SuggestionState state) { + print('BlocBuilder----${state}'); + if (state is SuggestionUninitialized) { + return Center( + child: Text('暂无内容'), + ); + } else if (state is SuggestionLoading) { + return Center( + child: CircularProgressIndicator(), + ); + } else if (state is SuggestionError) { + return Center( + child: Text('出现错误'), + ); + } else if (state is SuggestionLoaded) { + if (state.res.length == 0) { + return Center( + child: Text('没有适合的结果,更换查询条件试试'), + ); + }else { + if (widget.itemTitle is Function) { + return widget.itemTitle(state); + } + } + } + }, + ), + ), + ], + ), + ); + } + + @override + void dispose() { + //suggestion.dispose();//添加这个第二次进入会失灵 + super.dispose(); + } +} \ No newline at end of file diff --git a/lib/blocs/industry_model.dart b/lib/blocs/industry_model.dart new file mode 100644 index 00000000..ea6cb081 --- /dev/null +++ b/lib/blocs/industry_model.dart @@ -0,0 +1,72 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 3:19 PM + * email: zhu.yan@alibaba-inc.com + */ +class Suggestion { + String query; + List suggestions; + int code; + + Suggestion({this.query, this.suggestions, this.code}); + + Suggestion.fromJson(Map json) { + query = json['query']; + if (json['suggestions'] != null) { + suggestions = new List(); + json['suggestions'].forEach((v) { + suggestions.add(new Suggestions.fromJson(v)); + }); + } + code = json['code']; + } + + Map toJson() { + final Map data = new Map(); + data['query'] = this.query; + if (this.suggestions != null) { + data['suggestions'] = this.suggestions.map((v) => v.toJson()).toList(); + } + data['code'] = this.code; + return data; + } +} + +class Suggestions { + Data data; + String value; + + Suggestions({this.data, this.value}); + + Suggestions.fromJson(Map json) { + data = json['data'] != null ? new Data.fromJson(json['data']) : null; + value = json['value']; + } + + Map toJson() { + final Map data = new Map(); + if (this.data != null) { + data['data'] = this.data.toJson(); + } + data['value'] = this.value; + return data; + } +} + +class Data { + String category; + + Data({this.category}); + + Data.fromJson(Map json) { + category = json['category']; + } + + Map toJson() { + final Map data = new Map(); + data['category'] = this.category; + return data; + } +} \ No newline at end of file diff --git a/lib/blocs/industry_state.dart b/lib/blocs/industry_state.dart new file mode 100644 index 00000000..b129830c --- /dev/null +++ b/lib/blocs/industry_state.dart @@ -0,0 +1,34 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 3:37 PM + * email: zhu.yan@alibaba-inc.com + */ +abstract class SuggestionState {} + +class SuggestionError extends SuggestionState { + @override + String toString() => 'SuggestionError:获取失败'; +} + +class SuggestionUninitialized extends SuggestionState { + @override + String toString() => 'SuggestionUninitialized:未初始化'; +} + +class SuggestionLoading extends SuggestionState { + @override + String toString() => 'SuggestionLoading :正在加载'; +} + +class SuggestionLoaded extends SuggestionState { + final List res; + + SuggestionLoaded({ + this.res, + }); + + @override + String toString() => 'SuggestionLoaded:加载完毕'; +} diff --git a/lib/blocs/search_result.dart b/lib/blocs/search_result.dart new file mode 100644 index 00000000..8001e49a --- /dev/null +++ b/lib/blocs/search_result.dart @@ -0,0 +1,14 @@ +/** + * Created with Android Studio. + * User: 一晟 + * Date: 2019/4/28 + * Time: 7:11 PM + * email: zhu.yan@alibaba-inc.com + * tartget: + */ +class SearchResult { + String title; + String source; + + SearchResult({this.title, this.source}); +} \ No newline at end of file diff --git a/lib/common/Style.dart b/lib/common/Style.dart deleted file mode 100644 index 31d9bb8d..00000000 --- a/lib/common/Style.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/material.dart'; - -//颜色配置 -class AppColor{ - static const int white = 0xFFFFFFFF; - static const int mainTextColor = 0xFF121917; - static const int subTextColor = 0xff959595; -} - -//文本设置 -class AppText{ - static const middleSize = 16.0; - - static const middleText = TextStyle( - color: Color(AppColor.mainTextColor), - fontSize: middleSize, - ); - - static const middleSubText = TextStyle( - color: Color(AppColor.subTextColor), - fontSize: middleSize, - ); -} -class WidgetDemoColor { - static const int fontColor = 0xFF607173; - static const int iconColor = 0xFF607173; - static const int borderColor = 0xFFEFEFEF; - -} diff --git a/lib/common/event_bus.dart b/lib/common/event_bus.dart deleted file mode 100644 index faf20edc..00000000 --- a/lib/common/event_bus.dart +++ /dev/null @@ -1,8 +0,0 @@ -import 'package:event_bus/event_bus.dart'; - -EventBus eventBus = new EventBus(); - -class MyEvent { - String text; - MyEvent(this.text); -} diff --git a/lib/common/example_code_parser.dart b/lib/common/example_code_parser.dart deleted file mode 100644 index a045816d..00000000 --- a/lib/common/example_code_parser.dart +++ /dev/null @@ -1,43 +0,0 @@ -/* - * @Author: 一凨 - * @Date: 2019-01-14 11:42:36 - * @Last Modified by: 一凨 - * @Last Modified time: 2019-01-14 16:53:11 - */ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'dart:async'; -import '../routers/application.dart'; -import 'package:flutter/services.dart'; -import 'package:url_launcher/url_launcher.dart'; -import 'package:flutter/material.dart'; - - -Map _exampleCode; -String _code; - -void _launchURL(String url) async { - if (await canLaunch(url)) { - await launch(url); - } else { - throw 'Could not launch $url'; - } -} - -Future getExampleCode(context,String filePath, AssetBundle bundle) async { - if (_exampleCode == null) await _parseExampleCode(context,filePath, bundle); - return _code; -} - -Future _parseExampleCode(context,String filePath, AssetBundle bundle) async { - String code; - try { - code = await bundle.loadString('lib/widgets/$filePath'); - } catch (err) { - Navigator.of(context).pop(); - _launchURL(Application.github['widgetsURL'] + filePath); - } - _code = code; -} diff --git a/lib/common/full_screen_code_dialog.dart b/lib/common/full_screen_code_dialog.dart deleted file mode 100644 index ee098740..00000000 --- a/lib/common/full_screen_code_dialog.dart +++ /dev/null @@ -1,73 +0,0 @@ -/* - * @Author: 一凨 - * @Date: 2019-01-14 11:42:32 - * @Last Modified by: 一凨 - * @Last Modified time: 2019-01-14 14:42:00 - */ -import 'package:flutter/material.dart'; -import 'example_code_parser.dart'; -import 'syntax_highlighter.dart'; - -class FullScreenCodeDialog extends StatefulWidget { - const FullScreenCodeDialog({this.filePath}); - - final String filePath; - _FullScreenCodeDialogState createState() => _FullScreenCodeDialogState(); -} - -class _FullScreenCodeDialogState extends State { - String _exampleCode; - - @override - void didChangeDependencies() { - getExampleCode(context,'${widget.filePath}', DefaultAssetBundle.of(context)) - .then((String code) { - if (mounted) { - setState(() { - _exampleCode = code ?? 'Example code not found'; - }); - } - }); - super.didChangeDependencies(); - } - - @override - Widget build(BuildContext context) { - final SyntaxHighlighterStyle style = - Theme.of(context).brightness == Brightness.dark - ? SyntaxHighlighterStyle.darkThemeStyle() - : SyntaxHighlighterStyle.lightThemeStyle(); - - Widget body; - if (_exampleCode == null) { - body = const Center(child: CircularProgressIndicator()); - } else { - body = SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: RichText( - text: TextSpan( - style: const TextStyle(fontFamily: 'monospace', fontSize: 10.0), - children: [ - DartSyntaxHighlighter(style).format(_exampleCode) - ]), - ), - ), - ); - } - - return Scaffold( - appBar: AppBar( - leading: IconButton( - icon: const Icon( - Icons.clear, - semanticLabel: 'Close', - ), - onPressed: () { - Navigator.pop(context); - }), - title: const Text('Example code'), - ), - body: body); - } -} diff --git a/lib/common/high_light_code.dart b/lib/common/high_light_code.dart deleted file mode 100644 index 1ac0fdcd..00000000 --- a/lib/common/high_light_code.dart +++ /dev/null @@ -1,359 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; -import 'package:string_scanner/string_scanner.dart'; - -/// final SyntaxHighlighterStyle style = SyntaxHighlighterStyle.lightThemeStyle(); -/// DartSyntaxHighlighter(style).format(source) - -class SyntaxHighlighterStyle { - SyntaxHighlighterStyle({ - this.baseStyle, - this.numberStyle, - this.commentStyle, - this.keywordStyle, - this.stringStyle, - this.punctuationStyle, - this.classStyle, - this.constantStyle - }); - - static SyntaxHighlighterStyle lightThemeStyle() { - return SyntaxHighlighterStyle( - baseStyle: const TextStyle(color: Color(0xFF000000)), - numberStyle: const TextStyle(color: Color(0xFF1565C0)), - commentStyle: const TextStyle(color: Color(0xFF9E9E9E)), - keywordStyle: const TextStyle(color: Color(0xFF9C27B0)), - stringStyle: const TextStyle(color: Color(0xFF43A047)), - punctuationStyle: const TextStyle(color: Color(0xFF000000)), - classStyle: const TextStyle(color: Color(0xFF512DA8)), - constantStyle: const TextStyle(color: Color(0xFF795548)) - ); - } - - static SyntaxHighlighterStyle darkThemeStyle() { - return SyntaxHighlighterStyle( - baseStyle: const TextStyle(color: Color(0xFFFFFFFF)), - numberStyle: const TextStyle(color: Color(0xFF1565C0)), - commentStyle: const TextStyle(color: Color(0xFF9E9E9E)), - keywordStyle: const TextStyle(color: Color(0xFF80CBC4)), - stringStyle: const TextStyle(color: Color(0xFF009688)), - punctuationStyle: const TextStyle(color: Color(0xFFFFFFFF)), - classStyle: const TextStyle(color: Color(0xFF009688)), - constantStyle: const TextStyle(color: Color(0xFF795548)) - ); - } - - final TextStyle baseStyle; - final TextStyle numberStyle; - final TextStyle commentStyle; - final TextStyle keywordStyle; - final TextStyle stringStyle; - final TextStyle punctuationStyle; - final TextStyle classStyle; - final TextStyle constantStyle; -} - -abstract class Highlighter { // ignore: one_member_abstracts - TextSpan format(String src); -} - -class DartSyntaxHighlighter extends Highlighter { - DartSyntaxHighlighter([this._style]) { - _spans = <_HighlightSpan>[]; - _style ??= SyntaxHighlighterStyle.darkThemeStyle(); - } - - SyntaxHighlighterStyle _style; - - static const List _keywords = [ - 'abstract', 'as', 'assert', 'async', 'await', 'break', 'case', 'catch', - 'class', 'const', 'continue', 'default', 'deferred', 'do', 'dynamic', 'else', - 'enum', 'export', 'external', 'extends', 'factory', 'false', 'final', - 'finally', 'for', 'get', 'if', 'implements', 'import', 'in', 'is', 'library', - 'new', 'null', 'operator', 'part', 'rethrow', 'return', 'set', 'static', - 'super', 'switch', 'sync', 'this', 'throw', 'true', 'try', 'typedef', 'var', - 'void', 'while', 'with', 'yield' - ]; - - static const List _builtInTypes = [ - 'int', 'double', 'num', 'bool' - ]; - - String _src; - StringScanner _scanner; - - List<_HighlightSpan> _spans; - - @override - TextSpan format(String src) { - _src = src; - _scanner = StringScanner(_src); - - if (_generateSpans()) { - // Successfully parsed the code - final List formattedText = []; - int currentPosition = 0; - - for (_HighlightSpan span in _spans) { - if (currentPosition != span.start) - formattedText.add(TextSpan(text: _src.substring(currentPosition, span.start))); - - formattedText.add(TextSpan(style: span.textStyle(_style), text: span.textForSpan(_src))); - - currentPosition = span.end; - } - - if (currentPosition != _src.length) - formattedText.add(TextSpan(text: _src.substring(currentPosition, _src.length))); - - return TextSpan(style: _style.baseStyle, children: formattedText); - } else { - // Parsing failed, return with only basic formatting - return TextSpan(style: _style.baseStyle, text: src); - } - } - - bool _generateSpans() { - int lastLoopPosition = _scanner.position; - - while (!_scanner.isDone) { - // Skip White space - _scanner.scan(RegExp(r'\s+')); - - // Block comments - if (_scanner.scan(RegExp(r'/\*(.|\n)*\*/'))) { - _spans.add(_HighlightSpan( - _HighlightType.comment, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Line comments - if (_scanner.scan('//')) { - final int startComment = _scanner.lastMatch.start; - - bool eof = false; - int endComment; - if (_scanner.scan(RegExp(r'.*\n'))) { - endComment = _scanner.lastMatch.end - 1; - } else { - eof = true; - endComment = _src.length; - } - - _spans.add(_HighlightSpan( - _HighlightType.comment, - startComment, - endComment - )); - - if (eof) - break; - - continue; - } - - // Raw r"String" - if (_scanner.scan(RegExp(r'r".*"'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Raw r'String' - if (_scanner.scan(RegExp(r"r'.*'"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Multiline """String""" - if (_scanner.scan(RegExp(r'"""(?:[^"\\]|\\(.|\n))*"""'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Multiline '''String''' - if (_scanner.scan(RegExp(r"'''(?:[^'\\]|\\(.|\n))*'''"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // "String" - if (_scanner.scan(RegExp(r'"(?:[^"\\]|\\.)*"'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // 'String' - if (_scanner.scan(RegExp(r"'(?:[^'\\]|\\.)*'"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Double - if (_scanner.scan(RegExp(r'\d+\.\d+'))) { - _spans.add(_HighlightSpan( - _HighlightType.number, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Integer - if (_scanner.scan(RegExp(r'\d+'))) { - _spans.add(_HighlightSpan( - _HighlightType.number, - _scanner.lastMatch.start, - _scanner.lastMatch.end) - ); - continue; - } - - // Punctuation - if (_scanner.scan(RegExp(r'[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]'))) { - _spans.add(_HighlightSpan( - _HighlightType.punctuation, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Meta data - if (_scanner.scan(RegExp(r'@\w+'))) { - _spans.add(_HighlightSpan( - _HighlightType.keyword, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Words - if (_scanner.scan(RegExp(r'\w+'))) { - _HighlightType type; - - String word = _scanner.lastMatch[0]; - if (word.startsWith('_')) - word = word.substring(1); - - if (_keywords.contains(word)) - type = _HighlightType.keyword; - else if (_builtInTypes.contains(word)) - type = _HighlightType.keyword; - else if (_firstLetterIsUpperCase(word)) - type = _HighlightType.klass; - else if (word.length >= 2 && word.startsWith('k') && _firstLetterIsUpperCase(word.substring(1))) - type = _HighlightType.constant; - - if (type != null) { - _spans.add(_HighlightSpan( - type, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - } - } - - // Check if this loop did anything - if (lastLoopPosition == _scanner.position) { - // Failed to parse this file, abort gracefully - return false; - } - lastLoopPosition = _scanner.position; - } - - _simplify(); - return true; - } - - void _simplify() { - for (int i = _spans.length - 2; i >= 0; i -= 1) { - if (_spans[i].type == _spans[i + 1].type && _spans[i].end == _spans[i + 1].start) { - _spans[i] = _HighlightSpan( - _spans[i].type, - _spans[i].start, - _spans[i + 1].end - ); - _spans.removeAt(i + 1); - } - } - } - - bool _firstLetterIsUpperCase(String str) { - if (str.isNotEmpty) { - final String first = str.substring(0, 1); - return first == first.toUpperCase(); - } - return false; - } -} - -enum _HighlightType { - number, - comment, - keyword, - string, - punctuation, - klass, - constant -} - -class _HighlightSpan { - _HighlightSpan(this.type, this.start, this.end); - final _HighlightType type; - final int start; - final int end; - - String textForSpan(String src) { - return src.substring(start, end); - } - - TextStyle textStyle(SyntaxHighlighterStyle style) { - if (type == _HighlightType.number) - return style.numberStyle; - else if (type == _HighlightType.comment) - return style.commentStyle; - else if (type == _HighlightType.keyword) - return style.keywordStyle; - else if (type == _HighlightType.string) - return style.stringStyle; - else if (type == _HighlightType.punctuation) - return style.punctuationStyle; - else if (type == _HighlightType.klass) - return style.classStyle; - else if (type == _HighlightType.constant) - return style.constantStyle; - else - return style.baseStyle; - } -} diff --git a/lib/common/icon_names.dart b/lib/common/icon_names.dart deleted file mode 100644 index 7d75b841..00000000 --- a/lib/common/icon_names.dart +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2018/11/23 - * Time: 上午2:14 - * email: zhu.yan@alibaba-inc.com - * tartget: FlatButton 的示例 - */ -import 'package:flutter/material.dart'; - - -class IconNames { - static List names = [Icons.ac_unit,Icons.access_alarm,Icons.access_alarms,Icons.access_time,Icons.accessibility,Icons.accessibility_new,Icons.accessible,Icons.accessible_forward,Icons.account_balance,Icons.account_balance_wallet,Icons.account_box,Icons.account_circle,Icons.adb,Icons.add,Icons.add_a_photo,Icons.add_alarm,Icons.add_alert,Icons.add_box,Icons.add_call,Icons.add_circle,Icons.add_circle_outline,Icons.add_comment,Icons.add_location,Icons.add_photo_alternate,Icons.add_shopping_cart,Icons.add_to_home_screen,Icons.add_to_photos,Icons.add_to_queue,Icons.adjust,Icons.airline_seat_flat,Icons.airline_seat_flat_angled,Icons.airline_seat_individual_suite,Icons.airline_seat_legroom_extra,Icons.airline_seat_legroom_normal,Icons.airline_seat_legroom_reduced,Icons.airline_seat_recline_extra,Icons.airline_seat_recline_normal,Icons.airplanemode_active,Icons.airplanemode_inactive,Icons.airplay,Icons.airport_shuttle,Icons.alarm,Icons.alarm_add,Icons.alarm_off,Icons.alarm_on,Icons.album,Icons.all_inclusive,Icons.all_out,Icons.alternate_email,Icons.android,Icons.announcement,Icons.apps,Icons.archive,Icons.arrow_back,Icons.arrow_back_ios,Icons.arrow_downward,Icons.arrow_drop_down,Icons.arrow_drop_down_circle,Icons.arrow_drop_up,Icons.arrow_forward,Icons.arrow_forward_ios,Icons.arrow_left,Icons.arrow_right,Icons.arrow_upward,Icons.art_track,Icons.aspect_ratio,Icons.assessment,Icons.assignment,Icons.assignment_ind,Icons.assignment_late,Icons.assignment_return,Icons.assignment_returned,Icons.assignment_turned_in,Icons.assistant,Icons.assistant_photo,Icons.atm,Icons.attach_file,Icons.attach_money,Icons.attachment,Icons.audiotrack,Icons.autorenew,Icons.av_timer,Icons.backspace,Icons.backup,Icons.battery_alert,Icons.battery_charging_full,Icons.battery_full,Icons.battery_std,Icons.battery_unknown,Icons.beach_access,Icons.beenhere,Icons.block,Icons.bluetooth,Icons.bluetooth_audio,Icons.bluetooth_connected,Icons.bluetooth_disabled,Icons.bluetooth_searching,Icons.blur_circular,Icons.blur_linear,Icons.blur_off,Icons.blur_on,Icons.book,Icons.bookmark,Icons.bookmark_border,Icons.border_all,Icons.border_bottom,Icons.border_clear,Icons.border_color,Icons.border_horizontal,Icons.border_inner,Icons.border_left,Icons.border_outer,Icons.border_right,Icons.border_style,Icons.border_top,Icons.border_vertical,Icons.branding_watermark,Icons.brightness_1,Icons.brightness_2,Icons.brightness_3,Icons.brightness_4,Icons.brightness_5,Icons.brightness_6,Icons.brightness_7,Icons.brightness_auto,Icons.brightness_high,Icons.brightness_low,Icons.brightness_medium,Icons.broken_image,Icons.brush,Icons.bubble_chart,Icons.bug_report,Icons.build,Icons.burst_mode,Icons.business,Icons.business_center,Icons.cached,Icons.cake,Icons.calendar_today,Icons.calendar_view_day,Icons.call,Icons.call_end,Icons.call_made,Icons.call_merge,Icons.call_missed,Icons.call_missed_outgoing,Icons.call_received,Icons.call_split,Icons.call_to_action,Icons.camera,Icons.camera_alt,Icons.camera_enhance,Icons.camera_front,Icons.camera_rear,Icons.camera_roll,Icons.cancel,Icons.card_giftcard,Icons.card_membership,Icons.card_travel,Icons.casino,Icons.cast,Icons.cast_connected,Icons.category,Icons.center_focus_strong,Icons.center_focus_weak,Icons.change_history,Icons.chat,Icons.chat_bubble,Icons.chat_bubble_outline,Icons.check,Icons.check_box,Icons.check_box_outline_blank,Icons.check_circle,Icons.check_circle_outline,Icons.chevron_left,Icons.chevron_right,Icons.child_care,Icons.child_friendly,Icons.chrome_reader_mode,Icons.class_,Icons.clear,Icons.clear_all,Icons.close,Icons.closed_caption,Icons.cloud,Icons.cloud_circle,Icons.cloud_done,Icons.cloud_download,Icons.cloud_off,Icons.cloud_queue,Icons.cloud_upload,Icons.code,Icons.collections,Icons.collections_bookmark,Icons.color_lens,Icons.colorize,Icons.comment,Icons.compare,Icons.compare_arrows,Icons.computer,Icons.confirmation_number,Icons.contact_mail,Icons.contact_phone,Icons.contacts,Icons.content_copy,Icons.content_cut,Icons.content_paste,Icons.control_point,Icons.control_point_duplicate,Icons.copyright,Icons.create,Icons.create_new_folder,Icons.credit_card,Icons.crop,Icons.crop_3_2,Icons.crop_5_4,Icons.crop_7_5,Icons.crop_16_9,Icons.crop_din,Icons.crop_free,Icons.crop_landscape,Icons.crop_original,Icons.crop_portrait,Icons.crop_rotate,Icons.crop_square,Icons.dashboard,Icons.data_usage,Icons.date_range,Icons.dehaze,Icons.delete,Icons.delete_forever,Icons.delete_outline,Icons.delete_sweep,Icons.departure_board,Icons.description,Icons.desktop_mac,Icons.desktop_windows,Icons.details,Icons.developer_board,Icons.developer_mode,Icons.device_hub,Icons.device_unknown,Icons.devices,Icons.devices_other,Icons.dialer_sip,Icons.dialpad,Icons.directions,Icons.directions_bike,Icons.directions_boat,Icons.directions_bus,Icons.directions_car,Icons.directions_railway,Icons.directions_run,Icons.directions_subway,Icons.directions_transit,Icons.directions_walk,Icons.disc_full,Icons.dns,Icons.do_not_disturb,Icons.do_not_disturb_alt,Icons.do_not_disturb_off,Icons.do_not_disturb_on,Icons.dock,Icons.domain,Icons.done,Icons.done_all,Icons.done_outline,Icons.donut_large,Icons.donut_small,Icons.drafts,Icons.drag_handle,Icons.drive_eta,Icons.dvr,Icons.edit,Icons.edit_attributes,Icons.edit_location,Icons.eject,Icons.email,Icons.enhanced_encryption,Icons.equalizer,Icons.error,Icons.error_outline,Icons.euro_symbol,Icons.ev_station,Icons.event,Icons.event_available,Icons.event_busy,Icons.event_note,Icons.event_seat,Icons.exit_to_app,Icons.expand_less,Icons.expand_more,Icons.explicit,Icons.explore,Icons.exposure,Icons.exposure_neg_1,Icons.exposure_neg_2,Icons.exposure_plus_1,Icons.exposure_plus_2,Icons.exposure_zero,Icons.extension,Icons.face,Icons.fast_forward,Icons.fast_rewind,Icons.fastfood,Icons.favorite,Icons.favorite_border,Icons.featured_play_list,Icons.featured_video,Icons.feedback,Icons.fiber_dvr,Icons.fiber_manual_record,Icons.fiber_new,Icons.fiber_pin,Icons.fiber_smart_record,Icons.file_download,Icons.file_upload,Icons.filter,Icons.filter_1,Icons.filter_2,Icons.filter_3,Icons.filter_4,Icons.filter_5,Icons.filter_6,Icons.filter_7,Icons.filter_8,Icons.filter_9,Icons.filter_9_plus,Icons.filter_b_and_w,Icons.filter_center_focus,Icons.filter_drama,Icons.filter_frames,Icons.filter_hdr,Icons.filter_list,Icons.filter_none,Icons.filter_tilt_shift,Icons.filter_vintage,Icons.find_in_page,Icons.find_replace,Icons.fingerprint,Icons.first_page,Icons.fitness_center,Icons.flag,Icons.flare,Icons.flash_auto,Icons.flash_off,Icons.flash_on,Icons.flight,Icons.flight_land,Icons.flight_takeoff,Icons.flip,Icons.flip_to_back,Icons.flip_to_front,Icons.folder,Icons.folder_open,Icons.folder_shared,Icons.folder_special,Icons.font_download,Icons.format_align_center,Icons.format_align_justify,Icons.format_align_left,Icons.format_align_right,Icons.format_bold,Icons.format_clear,Icons.format_color_fill,Icons.format_color_reset,Icons.format_color_text,Icons.format_indent_decrease,Icons.format_indent_increase,Icons.format_italic,Icons.format_line_spacing,Icons.format_list_bulleted,Icons.format_list_numbered,Icons.format_list_numbered_rtl,Icons.format_paint,Icons.format_quote,Icons.format_shapes,Icons.format_size,Icons.format_strikethrough,Icons.format_textdirection_l_to_r,Icons.format_textdirection_r_to_l,Icons.format_underlined,Icons.forum,Icons.forward,Icons.forward_5,Icons.forward_10,Icons.forward_30,Icons.four_k,Icons.free_breakfast,Icons.fullscreen,Icons.fullscreen_exit,Icons.functions,Icons.g_translate,Icons.gamepad,Icons.games,Icons.gavel,Icons.gesture,Icons.get_app,Icons.gif,Icons.golf_course,Icons.gps_fixed,Icons.gps_not_fixed,Icons.gps_off,Icons.grade,Icons.gradient,Icons.grain,Icons.graphic_eq,Icons.grid_off,Icons.grid_on,Icons.group,Icons.group_add,Icons.group_work,Icons.hd,Icons.hdr_off,Icons.hdr_on,Icons.hdr_strong,Icons.hdr_weak,Icons.headset,Icons.headset_mic,Icons.headset_off,Icons.healing,Icons.hearing,Icons.help,Icons.help_outline,Icons.high_quality,Icons.highlight,Icons.highlight_off,Icons.history,Icons.home,Icons.hot_tub,Icons.hotel,Icons.hourglass_empty,Icons.hourglass_full,Icons.http,Icons.https,Icons.image,Icons.image_aspect_ratio,Icons.import_contacts,Icons.import_export,Icons.important_devices,Icons.inbox,Icons.indeterminate_check_box,Icons.info,Icons.info_outline,Icons.input,Icons.insert_chart,Icons.insert_comment,Icons.insert_drive_file,Icons.insert_emoticon,Icons.insert_invitation,Icons.insert_link,Icons.insert_photo,Icons.invert_colors,Icons.invert_colors_off,Icons.iso,Icons.keyboard,Icons.keyboard_arrow_down,Icons.keyboard_arrow_left,Icons.keyboard_arrow_right,Icons.keyboard_arrow_up,Icons.keyboard_backspace,Icons.keyboard_capslock,Icons.keyboard_hide,Icons.keyboard_return,Icons.keyboard_tab,Icons.keyboard_voice,Icons.kitchen,Icons.label,Icons.label_important,Icons.label_outline,Icons.landscape,Icons.language,Icons.laptop,Icons.laptop_chromebook,Icons.laptop_mac,Icons.laptop_windows,Icons.last_page,Icons.launch,Icons.layers,Icons.layers_clear,Icons.leak_add,Icons.leak_remove,Icons.lens,Icons.library_add,Icons.library_books,Icons.library_music,Icons.lightbulb_outline,Icons.line_style,Icons.line_weight,Icons.linear_scale,Icons.link,Icons.link_off,Icons.linked_camera,Icons.list,Icons.live_help,Icons.live_tv,Icons.local_activity,Icons.local_airport,Icons.local_atm,Icons.local_bar,Icons.local_cafe,Icons.local_car_wash,Icons.local_convenience_store,Icons.local_dining,Icons.local_drink,Icons.local_florist,Icons.local_gas_station,Icons.local_grocery_store,Icons.local_hospital,Icons.local_hotel,Icons.local_laundry_service,Icons.local_library,Icons.local_mall,Icons.local_movies,Icons.local_offer,Icons.local_parking,Icons.local_pharmacy,Icons.local_phone,Icons.local_pizza,Icons.local_play,Icons.local_post_office,Icons.local_printshop,Icons.local_see,Icons.local_shipping,Icons.local_taxi,Icons.location_city,Icons.location_disabled,Icons.location_off,Icons.location_on,Icons.location_searching,Icons.lock,Icons.lock_open,Icons.lock_outline,Icons.looks,Icons.looks_3,Icons.looks_4,Icons.looks_5,Icons.looks_6,Icons.looks_one,Icons.looks_two,Icons.loop,Icons.loupe,Icons.low_priority,Icons.loyalty,Icons.mail,Icons.mail_outline,Icons.map,Icons.markunread,Icons.markunread_mailbox,Icons.maximize,Icons.memory,Icons.menu,Icons.merge_type,Icons.message,Icons.mic,Icons.mic_none,Icons.mic_off,Icons.minimize,Icons.missed_video_call,Icons.mms,Icons.mobile_screen_share,Icons.mode_comment,Icons.mode_edit,Icons.monetization_on,Icons.money_off,Icons.monochrome_photos,Icons.mood,Icons.mood_bad,Icons.more,Icons.more_horiz,Icons.more_vert,Icons.motorcycle,Icons.mouse,Icons.move_to_inbox,Icons.movie,Icons.movie_creation,Icons.movie_filter,Icons.multiline_chart,Icons.music_note,Icons.music_video,Icons.my_location,Icons.nature,Icons.nature_people,Icons.navigate_before,Icons.navigate_next,Icons.navigation,Icons.near_me,Icons.network_cell,Icons.network_check,Icons.network_locked,Icons.network_wifi,Icons.new_releases,Icons.next_week,Icons.nfc,Icons.no_encryption,Icons.no_sim,Icons.not_interested,Icons.not_listed_location,Icons.note,Icons.note_add,Icons.notification_important,Icons.notifications,Icons.notifications_active,Icons.notifications_none,Icons.notifications_off,Icons.notifications_paused,Icons.offline_bolt,Icons.offline_pin,Icons.ondemand_video,Icons.opacity,Icons.open_in_browser,Icons.open_in_new,Icons.open_with,Icons.outlined_flag,Icons.pages,Icons.pageview,Icons.palette,Icons.pan_tool,Icons.panorama,Icons.panorama_fish_eye,Icons.panorama_horizontal,Icons.panorama_vertical,Icons.panorama_wide_angle,Icons.party_mode,Icons.pause,Icons.pause_circle_filled,Icons.pause_circle_outline,Icons.payment,Icons.people,Icons.people_outline,Icons.perm_camera_mic,Icons.perm_contact_calendar,Icons.perm_data_setting,Icons.perm_device_information,Icons.perm_identity,Icons.perm_media,Icons.perm_phone_msg,Icons.perm_scan_wifi,Icons.person,Icons.person_add,Icons.person_outline,Icons.person_pin,Icons.person_pin_circle,Icons.personal_video,Icons.pets,Icons.phone,Icons.phone_android,Icons.phone_bluetooth_speaker,Icons.phone_forwarded,Icons.phone_in_talk,Icons.phone_iphone,Icons.phone_locked,Icons.phone_missed,Icons.phone_paused,Icons.phonelink,Icons.phonelink_erase,Icons.phonelink_lock,Icons.phonelink_off,Icons.phonelink_ring,Icons.phonelink_setup,Icons.photo,Icons.photo_album,Icons.photo_camera,Icons.photo_filter,Icons.photo_library,Icons.photo_size_select_actual,Icons.photo_size_select_large,Icons.photo_size_select_small,Icons.picture_as_pdf,Icons.picture_in_picture,Icons.picture_in_picture_alt,Icons.pie_chart,Icons.pie_chart_outlined,Icons.pin_drop,Icons.place,Icons.play_arrow,Icons.play_circle_filled,Icons.play_circle_outline,Icons.play_for_work,Icons.playlist_add,Icons.playlist_add_check,Icons.playlist_play,Icons.plus_one,Icons.poll,Icons.polymer,Icons.pool,Icons.portable_wifi_off,Icons.portrait,Icons.power,Icons.power_input,Icons.power_settings_new,Icons.pregnant_woman,Icons.present_to_all,Icons.print,Icons.priority_high,Icons.public,Icons.publish,Icons.query_builder,Icons.question_answer,Icons.queue,Icons.queue_music,Icons.queue_play_next,Icons.radio,Icons.radio_button_checked,Icons.radio_button_unchecked,Icons.rate_review,Icons.receipt,Icons.recent_actors,Icons.record_voice_over,Icons.redeem,Icons.redo,Icons.refresh,Icons.remove,Icons.remove_circle,Icons.remove_circle_outline,Icons.remove_from_queue,Icons.remove_red_eye,Icons.remove_shopping_cart,Icons.reorder,Icons.repeat,Icons.repeat_one,Icons.replay,Icons.replay_5,Icons.replay_10,Icons.replay_30,Icons.reply,Icons.reply_all,Icons.report,Icons.report_off,Icons.report_problem,Icons.restaurant,Icons.restaurant_menu,Icons.restore,Icons.restore_from_trash,Icons.restore_page,Icons.ring_volume,Icons.room,Icons.room_service,Icons.rotate_90_degrees_ccw,Icons.rotate_left,Icons.rotate_right,Icons.rounded_corner,Icons.router,Icons.rowing,Icons.rss_feed,Icons.rv_hookup,Icons.satellite,Icons.save,Icons.save_alt,Icons.scanner,Icons.scatter_plot,Icons.schedule,Icons.school,Icons.score,Icons.screen_lock_landscape,Icons.screen_lock_portrait,Icons.screen_lock_rotation,Icons.screen_rotation,Icons.screen_share,Icons.sd_card,Icons.sd_storage,Icons.search,Icons.security,Icons.select_all,Icons.send,Icons.sentiment_dissatisfied,Icons.sentiment_neutral,Icons.sentiment_satisfied,Icons.sentiment_very_dissatisfied,Icons.sentiment_very_satisfied,Icons.settings,Icons.settings_applications,Icons.settings_backup_restore,Icons.settings_bluetooth,Icons.settings_brightness,Icons.settings_cell,Icons.settings_ethernet,Icons.settings_input_antenna,Icons.settings_input_component,Icons.settings_input_composite,Icons.settings_input_hdmi,Icons.settings_input_svideo,Icons.settings_overscan,Icons.settings_phone,Icons.settings_power,Icons.settings_remote,Icons.settings_system_daydream,Icons.settings_voice,Icons.share,Icons.shop,Icons.shop_two,Icons.shopping_basket,Icons.shopping_cart,Icons.short_text,Icons.show_chart,Icons.shuffle,Icons.shutter_speed,Icons.signal_cellular_4_bar,Icons.signal_cellular_connected_no_internet_4_bar,Icons.signal_cellular_no_sim,Icons.signal_cellular_null,Icons.signal_cellular_off,Icons.signal_wifi_4_bar,Icons.signal_wifi_4_bar_lock,Icons.signal_wifi_off,Icons.sim_card,Icons.sim_card_alert,Icons.skip_next,Icons.skip_previous,Icons.slideshow,Icons.slow_motion_video,Icons.smartphone,Icons.smoke_free,Icons.smoking_rooms,Icons.sms,Icons.sms_failed,Icons.snooze,Icons.sort,Icons.sort_by_alpha,Icons.spa,Icons.space_bar,Icons.speaker,Icons.speaker_group,Icons.speaker_notes,Icons.speaker_notes_off,Icons.speaker_phone,Icons.spellcheck,Icons.star,Icons.star_border,Icons.star_half,Icons.stars,Icons.stay_current_landscape,Icons.stay_current_portrait,Icons.stay_primary_landscape,Icons.stay_primary_portrait,Icons.stop,Icons.stop_screen_share,Icons.storage,Icons.store,Icons.store_mall_directory,Icons.straighten,Icons.streetview,Icons.strikethrough_s,Icons.style,Icons.subdirectory_arrow_left,Icons.subdirectory_arrow_right,Icons.subject,Icons.subscriptions,Icons.subtitles,Icons.subway,Icons.supervised_user_circle,Icons.supervisor_account,Icons.surround_sound,Icons.swap_calls,Icons.swap_horiz,Icons.swap_horizontal_circle,Icons.swap_vert,Icons.swap_vertical_circle,Icons.switch_camera,Icons.switch_video,Icons.sync,Icons.sync_disabled,Icons.sync_problem,Icons.system_update,Icons.system_update_alt,Icons.tab,Icons.tab_unselected,Icons.table_chart,Icons.tablet,Icons.tablet_android,Icons.tablet_mac,Icons.tag_faces,Icons.tap_and_play,Icons.terrain,Icons.text_fields,Icons.text_format,Icons.text_rotate_up,Icons.text_rotate_vertical,Icons.text_rotation_angledown,Icons.text_rotation_angleup,Icons.text_rotation_down,Icons.text_rotation_none,Icons.textsms,Icons.texture,Icons.theaters,Icons.threed_rotation,Icons.threesixty,Icons.thumb_down,Icons.thumb_up,Icons.thumbs_up_down,Icons.time_to_leave,Icons.timelapse,Icons.timeline,Icons.timer,Icons.timer_3,Icons.timer_10,Icons.timer_off,Icons.title,Icons.toc,Icons.today,Icons.toll,Icons.tonality,Icons.touch_app,Icons.toys,Icons.track_changes,Icons.traffic,Icons.train,Icons.tram,Icons.transfer_within_a_station,Icons.transform,Icons.transit_enterexit,Icons.translate,Icons.trending_down,Icons.trending_flat,Icons.trending_up,Icons.trip_origin,Icons.tune,Icons.turned_in,Icons.turned_in_not,Icons.tv,Icons.unarchive,Icons.undo,Icons.unfold_less,Icons.unfold_more,Icons.update,Icons.usb,Icons.verified_user,Icons.vertical_align_bottom,Icons.vertical_align_center,Icons.vertical_align_top,Icons.vibration,Icons.video_call,Icons.video_label,Icons.video_library,Icons.videocam,Icons.videocam_off,Icons.videogame_asset,Icons.view_agenda,Icons.view_array,Icons.view_carousel,Icons.view_column,Icons.view_comfy,Icons.view_compact,Icons.view_day,Icons.view_headline,Icons.view_list,Icons.view_module,Icons.view_quilt,Icons.view_stream,Icons.view_week,Icons.vignette,Icons.visibility,Icons.visibility_off,Icons.voice_chat,Icons.voicemail,Icons.volume_down,Icons.volume_mute,Icons.volume_off,Icons.volume_up,Icons.vpn_key,Icons.vpn_lock,Icons.wallpaper,Icons.warning,Icons.watch,Icons.watch_later,Icons.wb_auto,Icons.wb_cloudy,Icons.wb_incandescent,Icons.wb_iridescent,Icons.wb_sunny,Icons.wc,Icons.web,Icons.web_asset,Icons.weekend,Icons.whatshot,Icons.widgets,Icons.wifi,Icons.wifi_lock,Icons.wifi_tethering,Icons.work,Icons.wrap_text,Icons.youtube_searched_for,Icons.zoom_in,Icons.zoom_out,Icons.zoom_out_map]; -} \ No newline at end of file diff --git a/lib/common/list_view_item.dart b/lib/common/list_view_item.dart deleted file mode 100644 index 7580cc0e..00000000 --- a/lib/common/list_view_item.dart +++ /dev/null @@ -1,54 +0,0 @@ -/* - * @Author: 一凨 - * @Date: 2019-01-14 17:53:54 - * @Last Modified by: 一凨 - * @Last Modified time: 2019-01-14 17:57:51 - */ -import 'package:flutter/material.dart'; -import '../routers/application.dart'; -import '../routers/routers.dart'; -import 'dart:core'; - - -class ListViewItem extends StatelessWidget { - final String itemUrl; - final String itemTitle; - final String data; - - const ListViewItem({Key key, this.itemUrl, this.itemTitle, this.data}) - : super(key: key); - - - @override - Widget build(BuildContext context) { - return Card( - color: Colors.white, - elevation: 4.0, - margin: new EdgeInsets.symmetric(horizontal: 10.0, vertical: 6.0), - child: ListTile( - onTap: () { - // _launchURL(itemUrl, context); - Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent(itemTitle)}&url=${Uri.encodeComponent(itemUrl)}'); - }, - title: Padding( - child: Text( - itemTitle, - style: TextStyle(color: Colors.black, fontSize: 15.0), - ), - padding: EdgeInsets.only(top: 10.0), - ), - subtitle: Row( - children: [ - Padding( - child: Text(data, - style: TextStyle(color: Colors.black54, fontSize: 10.0)), - padding: EdgeInsets.only(top: 10.0, bottom: 10.0), - ) - ], - ), - trailing: - Icon(Icons.keyboard_arrow_right, color: Colors.grey, size: 30.0), - ), - ); - } -} diff --git a/lib/common/net_utils.dart b/lib/common/net_utils.dart deleted file mode 100644 index d5dbcdc6..00000000 --- a/lib/common/net_utils.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:dio/dio.dart'; -import 'dart:async'; - -var dio = new Dio(); - -class NetUtils { - - static Future get(String url,{Map params}) async{ - var response = await dio.get(url, data: params); - return response.data; - } - - static Future post(String url,Map params) async{ - var response = await dio.post(url, data: params); - return response.data; - } -} \ No newline at end of file diff --git a/lib/common/provider.dart b/lib/common/provider.dart deleted file mode 100644 index 6704fc9d..00000000 --- a/lib/common/provider.dart +++ /dev/null @@ -1,91 +0,0 @@ -import 'dart:async'; -import 'dart:io'; -import 'dart:typed_data'; -import 'package:path/path.dart'; -import 'package:sqflite/sqflite.dart'; -import 'package:flutter/services.dart' show rootBundle; -//const createSql = { -// 'cat': """ -// CREATE TABLE "cat" ( -// `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, -// `name` TEXT NOT NULL UNIQUE, -// `depth` INTEGER NOT NULL DEFAULT 1, -// `parentId` INTEGER NOT NULL, -// `desc` TEXT -// ); -// """, -// 'collectio': """ -// CREATE TABLE collection (id INTEGER PRIMARY KEY NOT NULL UNIQUE, name TEXT NOT NULL, router TEXT); -// """, -// 'widget': """ -// CREATE TABLE widget (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, name TEXT NOT NULL, cnName TEXT NOT NULL, image TEXT NOT NULL, doc TEXT, demo TEXT, catId INTEGER NOT NULL REFERENCES cat (id), owner TEXT); -// """; -//}; - -class Provider { - static Database db; - - // 获取数据库中所有的表 - Future getTables() async { - if (db == null) { - return Future.value([]); - } - List tables = await db.rawQuery('SELECT name FROM sqlite_master WHERE type = "table"'); - List targetList = []; - tables.forEach((item) { - targetList.add(item['name']); - }); - return targetList; - } - - // 检查数据库中, 表是否完整, 在部份android中, 会出现表丢失的情况 - Future checkTableIsRight() async { - List expectTables = ['cat', 'widget', 'collection']; - - List tables = await getTables(); - - for(int i = 0; i < expectTables.length; i++) { - if (!tables.contains(expectTables[i])) { - return false; - } - } - return true; - - } - - //初始化数据库 - - Future init(bool isCreate) async { - //Get a location using getDatabasesPath - String databasesPath = await getDatabasesPath(); - String path = join(databasesPath, 'flutter.db'); - - try { - db = await openDatabase(path); - } catch (e) { - print("Error $e"); - } - bool tableIsRight = await this.checkTableIsRight(); - - if (!tableIsRight) { - // 关闭上面打开的db,否则无法执行open - db.close(); - // Delete the database - await deleteDatabase(path); - ByteData data = await rootBundle.load(join("assets", "app.db")); - List bytes = - data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); - await new File(path).writeAsBytes(bytes); - - db = await openDatabase(path, version: 1, - onCreate: (Database db, int version) async { - print('db created version is $version'); - }, onOpen: (Database db) async { - print('new db opened'); - }); - } else { - print("Opening existing database"); - } - } - -} diff --git a/lib/common/sql.dart b/lib/common/sql.dart deleted file mode 100644 index b6dd620a..00000000 --- a/lib/common/sql.dart +++ /dev/null @@ -1,98 +0,0 @@ -import './provider.dart'; -import 'dart:async'; -import 'package:sqflite/sqflite.dart'; - - - - -class BaseModel{ - Database db; - final String table = ''; - var query; - BaseModel(this.db){ - query = db.query; - } -} - -class Sql extends BaseModel { - final String tableName; - Sql.setTable(String name) - : tableName = name, - super(Provider.db); - - // sdf - Future get() async{ - return await this.query(tableName); - } - String getTableName () { - return tableName; - } - - Future delete(String value,String key) async{ - return await this.db.delete(tableName,where:'$key = ?',whereArgs:[value]); - } - - Future getByCondition({Map conditions}) async { - if (conditions == null || conditions.isEmpty) { - return this.get(); - } - String stringConditions = ''; - - int index = 0; - conditions.forEach((key, value) { - if (value == null) { - return ; - } - if (value.runtimeType == String) { - stringConditions = '$stringConditions $key = "$value"'; - } - if (value.runtimeType == int) { - stringConditions = '$stringConditions $key = $value'; - } - - if (index >= 0 && index < conditions.length -1) { - stringConditions = '$stringConditions and'; - } - index++; - }); - // print("this is string condition for sql > $stringConditions"); - return await this.query(tableName, where: stringConditions); - } - Future> insert(Map json) async { - var id = await this.db.insert(tableName, json); - json['id'] = id; - return json; - } - /// - /// 搜索 - /// @param Object condition - /// @mods [And, Or] default is Or - /// search({'name': "hanxu', 'id': 1}; - /// - Future search({Map conditions, String mods = 'Or'}) async { - if (conditions == null || conditions.isEmpty) { - return this.get(); - } - String stringConditions = ''; - int index = 0; - conditions.forEach((key, value) { - if (value == null) { - return ; - } - - if (value.runtimeType == String) { - stringConditions = '$stringConditions $key like "%$value%"'; - } - if (value.runtimeType == int) { - stringConditions = '$stringConditions $key = "%$value%"'; - } - - if (index >= 0 && index < conditions.length -1) { - stringConditions = '$stringConditions $mods'; - } - index++; - }); - - return await this.query(tableName, where: stringConditions); - } -} \ No newline at end of file diff --git a/lib/common/style.dart b/lib/common/style.dart deleted file mode 100644 index 31d9bb8d..00000000 --- a/lib/common/style.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/material.dart'; - -//颜色配置 -class AppColor{ - static const int white = 0xFFFFFFFF; - static const int mainTextColor = 0xFF121917; - static const int subTextColor = 0xff959595; -} - -//文本设置 -class AppText{ - static const middleSize = 16.0; - - static const middleText = TextStyle( - color: Color(AppColor.mainTextColor), - fontSize: middleSize, - ); - - static const middleSubText = TextStyle( - color: Color(AppColor.subTextColor), - fontSize: middleSize, - ); -} -class WidgetDemoColor { - static const int fontColor = 0xFF607173; - static const int iconColor = 0xFF607173; - static const int borderColor = 0xFFEFEFEF; - -} diff --git a/lib/common/syntax_highlighter.dart b/lib/common/syntax_highlighter.dart deleted file mode 100644 index 3048e3a8..00000000 --- a/lib/common/syntax_highlighter.dart +++ /dev/null @@ -1,362 +0,0 @@ -/* - * @Author: 一凨 - * @Date: 2019-01-14 11:42:39 - * @Last Modified by: 一凨 - * @Last Modified time: 2019-01-14 11:42:39 - */ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; -import 'package:string_scanner/string_scanner.dart'; - -class SyntaxHighlighterStyle { - SyntaxHighlighterStyle({ - this.baseStyle, - this.numberStyle, - this.commentStyle, - this.keywordStyle, - this.stringStyle, - this.punctuationStyle, - this.classStyle, - this.constantStyle - }); - - static SyntaxHighlighterStyle lightThemeStyle() { - return SyntaxHighlighterStyle( - baseStyle: const TextStyle(color: Color(0xFF000000)), - numberStyle: const TextStyle(color: Color(0xFF1565C0)), - commentStyle: const TextStyle(color: Color(0xFF9E9E9E)), - keywordStyle: const TextStyle(color: Color(0xFF9C27B0)), - stringStyle: const TextStyle(color: Color(0xFF43A047)), - punctuationStyle: const TextStyle(color: Color(0xFF000000)), - classStyle: const TextStyle(color: Color(0xFF512DA8)), - constantStyle: const TextStyle(color: Color(0xFF795548)) - ); - } - - static SyntaxHighlighterStyle darkThemeStyle() { - return SyntaxHighlighterStyle( - baseStyle: const TextStyle(color: Color(0xFFFFFFFF)), - numberStyle: const TextStyle(color: Color(0xFF1565C0)), - commentStyle: const TextStyle(color: Color(0xFF9E9E9E)), - keywordStyle: const TextStyle(color: Color(0xFF80CBC4)), - stringStyle: const TextStyle(color: Color(0xFF009688)), - punctuationStyle: const TextStyle(color: Color(0xFFFFFFFF)), - classStyle: const TextStyle(color: Color(0xFF009688)), - constantStyle: const TextStyle(color: Color(0xFF795548)) - ); - } - - final TextStyle baseStyle; - final TextStyle numberStyle; - final TextStyle commentStyle; - final TextStyle keywordStyle; - final TextStyle stringStyle; - final TextStyle punctuationStyle; - final TextStyle classStyle; - final TextStyle constantStyle; -} - -abstract class SyntaxHighlighter { // ignore: one_member_abstracts - TextSpan format(String src); -} - -class DartSyntaxHighlighter extends SyntaxHighlighter { - DartSyntaxHighlighter([this._style]) { - _spans = <_HighlightSpan>[]; - _style ??= SyntaxHighlighterStyle.darkThemeStyle(); - } - - SyntaxHighlighterStyle _style; - - static const List _keywords = [ - 'abstract', 'as', 'assert', 'async', 'await', 'break', 'case', 'catch', - 'class', 'const', 'continue', 'default', 'deferred', 'do', 'dynamic', 'else', - 'enum', 'export', 'external', 'extends', 'factory', 'false', 'final', - 'finally', 'for', 'get', 'if', 'implements', 'import', 'in', 'is', 'library', - 'new', 'null', 'operator', 'part', 'rethrow', 'return', 'set', 'static', - 'super', 'switch', 'sync', 'this', 'throw', 'true', 'try', 'typedef', 'var', - 'void', 'while', 'with', 'yield' - ]; - - static const List _builtInTypes = [ - 'int', 'double', 'num', 'bool' - ]; - - String _src; - StringScanner _scanner; - - List<_HighlightSpan> _spans; - - @override - TextSpan format(String src) { - _src = src; - _scanner = StringScanner(_src); - - if (_generateSpans()) { - // Successfully parsed the code - final List formattedText = []; - int currentPosition = 0; - - for (_HighlightSpan span in _spans) { - if (currentPosition != span.start) - formattedText.add(TextSpan(text: _src.substring(currentPosition, span.start))); - - formattedText.add(TextSpan(style: span.textStyle(_style), text: span.textForSpan(_src))); - - currentPosition = span.end; - } - - if (currentPosition != _src.length) - formattedText.add(TextSpan(text: _src.substring(currentPosition, _src.length))); - - return TextSpan(style: _style.baseStyle, children: formattedText); - } else { - // Parsing failed, return with only basic formatting - return TextSpan(style: _style.baseStyle, text: src); - } - } - - bool _generateSpans() { - int lastLoopPosition = _scanner.position; - - while (!_scanner.isDone) { - // Skip White space - _scanner.scan(RegExp(r'\s+')); - - // Block comments - if (_scanner.scan(RegExp(r'/\*(.|\n)*\*/'))) { - _spans.add(_HighlightSpan( - _HighlightType.comment, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Line comments - if (_scanner.scan('//')) { - final int startComment = _scanner.lastMatch.start; - - bool eof = false; - int endComment; - if (_scanner.scan(RegExp(r'.*\n'))) { - endComment = _scanner.lastMatch.end - 1; - } else { - eof = true; - endComment = _src.length; - } - - _spans.add(_HighlightSpan( - _HighlightType.comment, - startComment, - endComment - )); - - if (eof) - break; - - continue; - } - - // Raw r"String" - if (_scanner.scan(RegExp(r'r".*"'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Raw r'String' - if (_scanner.scan(RegExp(r"r'.*'"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Multiline """String""" - if (_scanner.scan(RegExp(r'"""(?:[^"\\]|\\(.|\n))*"""'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Multiline '''String''' - if (_scanner.scan(RegExp(r"'''(?:[^'\\]|\\(.|\n))*'''"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // "String" - if (_scanner.scan(RegExp(r'"(?:[^"\\]|\\.)*"'))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // 'String' - if (_scanner.scan(RegExp(r"'(?:[^'\\]|\\.)*'"))) { - _spans.add(_HighlightSpan( - _HighlightType.string, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Double - if (_scanner.scan(RegExp(r'\d+\.\d+'))) { - _spans.add(_HighlightSpan( - _HighlightType.number, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Integer - if (_scanner.scan(RegExp(r'\d+'))) { - _spans.add(_HighlightSpan( - _HighlightType.number, - _scanner.lastMatch.start, - _scanner.lastMatch.end) - ); - continue; - } - - // Punctuation - if (_scanner.scan(RegExp(r'[\[\]{}().!=<>&\|\?\+\-\*/%\^~;:,]'))) { - _spans.add(_HighlightSpan( - _HighlightType.punctuation, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Meta data - if (_scanner.scan(RegExp(r'@\w+'))) { - _spans.add(_HighlightSpan( - _HighlightType.keyword, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - continue; - } - - // Words - if (_scanner.scan(RegExp(r'\w+'))) { - _HighlightType type; - - String word = _scanner.lastMatch[0]; - if (word.startsWith('_')) - word = word.substring(1); - - if (_keywords.contains(word)) - type = _HighlightType.keyword; - else if (_builtInTypes.contains(word)) - type = _HighlightType.keyword; - else if (_firstLetterIsUpperCase(word)) - type = _HighlightType.klass; - else if (word.length >= 2 && word.startsWith('k') && _firstLetterIsUpperCase(word.substring(1))) - type = _HighlightType.constant; - - if (type != null) { - _spans.add(_HighlightSpan( - type, - _scanner.lastMatch.start, - _scanner.lastMatch.end - )); - } - } - - // Check if this loop did anything - if (lastLoopPosition == _scanner.position) { - // Failed to parse this file, abort gracefully - return false; - } - lastLoopPosition = _scanner.position; - } - - _simplify(); - return true; - } - - void _simplify() { - for (int i = _spans.length - 2; i >= 0; i -= 1) { - if (_spans[i].type == _spans[i + 1].type && _spans[i].end == _spans[i + 1].start) { - _spans[i] = _HighlightSpan( - _spans[i].type, - _spans[i].start, - _spans[i + 1].end - ); - _spans.removeAt(i + 1); - } - } - } - - bool _firstLetterIsUpperCase(String str) { - if (str.isNotEmpty) { - final String first = str.substring(0, 1); - return first == first.toUpperCase(); - } - return false; - } -} - -enum _HighlightType { - number, - comment, - keyword, - string, - punctuation, - klass, - constant -} - -class _HighlightSpan { - _HighlightSpan(this.type, this.start, this.end); - final _HighlightType type; - final int start; - final int end; - - String textForSpan(String src) { - return src.substring(start, end); - } - - TextStyle textStyle(SyntaxHighlighterStyle style) { - if (type == _HighlightType.number) - return style.numberStyle; - else if (type == _HighlightType.comment) - return style.commentStyle; - else if (type == _HighlightType.keyword) - return style.keywordStyle; - else if (type == _HighlightType.string) - return style.stringStyle; - else if (type == _HighlightType.punctuation) - return style.punctuationStyle; - else if (type == _HighlightType.klass) - return style.classStyle; - else if (type == _HighlightType.constant) - return style.constantStyle; - else - return style.baseStyle; - } -} diff --git a/lib/common/util.dart b/lib/common/util.dart deleted file mode 100644 index 1b9fab38..00000000 --- a/lib/common/util.dart +++ /dev/null @@ -1,90 +0,0 @@ -import 'package:flutter/material.dart'; - -const Map emumMap = const { - "Objective-C": Color(0xFF438EFF), - "Perl": Color(0xFF0298C3), - "Python": Color(0xFF0298C3), - "JavaScript": Color(0xFFF1E05A), - "PHP": Color(0xFF4F5D95), - "R": Color(0xFF188CE7), - "Lua": Color(0xFFC22D40), - "Scala": Color(0xFF020080), - "Swift": Color(0xFFFFAC45), - "Kotlin": Color(0xFFF18E33), - "Vue": Colors.black, - "Ruby": Color(0xFF701617), - "Shell": Color(0xFF89E051), - "TypeScript": Color(0xFF2B7489), - "C++": Color(0xFFF34B7D), - "CSS": Color(0xFF563C7C), - "Java": Color(0xFFB07219), - "C#": Color(0xFF178600), - "Go": Color(0xFF375EAB), - "Erlang": Color(0xFFB83998), - "C": Color(0xFF555555), -}; - -class Util { - static String getTimeDuration(String comTime) { - var nowTime = DateTime.now(); - var compareTime = DateTime.parse(comTime); - if (nowTime.isAfter(compareTime)) { - if (nowTime.year == compareTime.year) { - if (nowTime.month == compareTime.month) { - if (nowTime.day == compareTime.day) { - if (nowTime.hour == compareTime.hour) { - if (nowTime.minute == compareTime.minute) { - return '片刻之间'; - } - return (nowTime.minute - compareTime.minute).toString() + '分钟前'; - } - return (nowTime.hour - compareTime.hour).toString() + '小时前'; - } - return (nowTime.day - compareTime.day).toString() + '天前'; - } - return (nowTime.month - compareTime.month).toString() + '月前'; - } - return (nowTime.year - compareTime.year).toString() + '年前'; - } - return 'time error'; - } - - static double setPercentage(percentage, context) { - return MediaQuery.of(context).size.width * percentage; - } - - static Color getLangColor(String language) { - if (emumMap.containsKey(language)) { - return emumMap[language]; - } - return Colors.black26; - } - - static String getTimeDate(String comTime) { - var compareTime = DateTime.parse(comTime); - String weekDay = ''; - switch (compareTime.weekday) { - case 2: - weekDay = '周二'; - break; - case 3: - weekDay = '周三'; - break; - case 4: - weekDay = '周四'; - break; - case 5: - weekDay = '周五'; - break; - case 6: - weekDay = '周六'; - break; - case 7: - weekDay = '周日'; - break; - default: - weekDay = '周一'; - } - return '${compareTime.month}-${compareTime.day} $weekDay'; - } -} diff --git a/lib/common/widget-demo.dart b/lib/common/widget-demo.dart deleted file mode 100644 index b359e4d3..00000000 --- a/lib/common/widget-demo.dart +++ /dev/null @@ -1,74 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class WidgetDemo extends StatelessWidget { - final Widget child; - final String docUrl; - final String title; - final String codeUrl; - - WidgetDemo( - {Key key, - @required this.title, - @required this.child, - @required this.codeUrl, - @required this.docUrl}) - : super(key: key); - - void _launchURL(String url) async { - if (await canLaunch(url)) { - await launch(url); - } else { - throw 'Could not launch $url'; - } - } - - @override - Widget build(BuildContext context,[bottomNaviBar]) { - return Scaffold( - appBar: new AppBar( - title: Text(title), - actions: [ - new IconButton( - tooltip: 'widget doc', - onPressed: (){ - _launchURL(docUrl); - }, - icon: Icon(Icons.library_books), - ), - new IconButton( - tooltip: 'github code', - onPressed: (){ - _launchURL(codeUrl); - }, - icon: Icon(Icons.code), - ), - new IconButton( - tooltip: 'goBack home', - onPressed: (){ - Navigator.popUntil(context, ModalRoute.withName('/')); - }, - icon: Icon(Icons.home), - ), - ], - ), - body: new Container( - padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), - child: ListView( - shrinkWrap: true, - padding: const EdgeInsets.all(0.0), - children: [ - Column( - children: [ - SizedBox( - height: 10.0, - ), - child, - ], - ), - ]) - ), - bottomNavigationBar: (bottomNaviBar is Widget)?bottomNaviBar:null - ); - } -} diff --git a/lib/common/widget_demo.dart b/lib/common/widget_demo.dart deleted file mode 100644 index f64bde54..00000000 --- a/lib/common/widget_demo.dart +++ /dev/null @@ -1,204 +0,0 @@ -/** - * @author Nealyang - * - * 新widget详情页模板 - */ -import 'package:flutter/material.dart'; -import '../routers/application.dart'; -import '../routers/routers.dart'; -import '../components/markdown.dart'; -import '../model/collection.dart'; -import '../widgets/index.dart'; -import 'package:fluttertoast/fluttertoast.dart'; -import '../event/event-bus.dart'; -import '../event/event-model.dart'; -import 'dart:core'; - -class WidgetDemo extends StatefulWidget { - final List contentList; - final String docUrl; - final String title; - final String codeUrl; - final Widget bottomNaviBar; - - WidgetDemo( - {Key key, - @required this.title, - @required this.contentList, - @required this.codeUrl, - @required this.docUrl, - this.bottomNaviBar - }) - : super(key: key); - - _WidgetDemoState createState() => _WidgetDemoState(); -} - -class _WidgetDemoState extends State { - bool _hasCollected = false; - CollectionControlModel _collectionControl = new CollectionControlModel(); - var _collectionIcons; - List widgetDemosList = new WidgetDemoList().getDemos(); - String _router = ''; - - void showInSnackBar(String value) { - Fluttertoast.showToast( - msg: value, - toastLength: Toast.LENGTH_SHORT, - gravity: ToastGravity.CENTER, - timeInSecForIos: 1, - backgroundColor: Colors.grey, - textColor: Colors.white); - } - - - List _buildContent() { - List _list = [ - SizedBox( - height: 10.0, - ), - ]; - widget.contentList.forEach((item) { - if (item.runtimeType == String) { - _list.add(MarkdownBody(item)); - _list.add( - SizedBox( - height: 20.0, - ), - ); - } else { - _list.add(item); - } - }); - return _list; - } - - @override - void initState() { - super.initState(); - _collectionControl.getRouterByName(widget.title).then((list) { - widgetDemosList.forEach((item) { - if (item.name == widget.title) { - _router = item.routerName; - } - }); - if (this.mounted) { - setState(() { - _hasCollected = list.length > 0; - }); - } - }); - } - -// 点击收藏按钮 - _getCollection() { - if (_hasCollected) { - // 删除操作 - _collectionControl.deleteByName(widget.title).then((result) { - if (result > 0 && this.mounted) { - setState(() { - _hasCollected = false; - }); - showInSnackBar('已取消收藏'); - - if (ApplicationEvent.event != null) { - ApplicationEvent.event - .fire(CollectionEvent(widget.title, _router, true)); - } - return; - } - print('删除错误'); - }); - } else { - // 插入操作 - _collectionControl - .insert(Collection(name: widget.title, router: _router)) - .then((result) { - if (this.mounted) { - setState(() { - _hasCollected = true; - }); - - if (ApplicationEvent.event != null) { - ApplicationEvent.event - .fire(CollectionEvent(widget.title, _router, false)); - } - - showInSnackBar('收藏成功'); - } - }); - } - } - - void _selectValue(value){ - if(value == 'doc'){ - // _launchURL(widget.docUrl); - Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent(widget.title)} Doc&&url=${Uri.encodeComponent(widget.docUrl)}'); - }else if(value =='code'){ - Application.router.navigateTo(context, '${Routes.codeView}?filePath=${Uri.encodeComponent(widget.codeUrl)}'); - - } - } - - @override - Widget build(BuildContext context) { - if (_hasCollected) { - _collectionIcons = Icons.favorite; - } else { - _collectionIcons = Icons.favorite_border; - } - return Scaffold( - appBar: AppBar( - title: Text(widget.title), - actions: [ - new IconButton( - tooltip: 'goBack home', - onPressed: () { - Navigator.popUntil(context, ModalRoute.withName('/')); - }, - icon: Icon(Icons.home), - ), - new IconButton( - tooltip: 'collection', - onPressed: _getCollection, - icon: Icon(_collectionIcons), - ), - PopupMenuButton( - onSelected: _selectValue, - itemBuilder: (BuildContext context) => >[ - const PopupMenuItem( - value: 'doc', - child: ListTile( - leading: Icon(Icons.library_books,size: 22.0,), - title: Text('查看文档'), - ), - ), - const PopupMenuDivider(), - const PopupMenuItem( - value: 'code', - child: ListTile( - leading: Icon(Icons.code,size: 22.0,), - title: Text('查看Demo'), - ), - ), - ], - ), - ], - ), - body: Container( - padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), - child: ListView( - shrinkWrap: true, - padding: const EdgeInsets.all(0.0), - children: [ - Column( - children: _buildContent(), - ), - ], - ), - ), - bottomNavigationBar: (widget.bottomNaviBar is Widget) ? widget - .bottomNaviBar : null - ); - } -} diff --git a/lib/common/widget_name_to_icon.dart b/lib/common/widget_name_to_icon.dart deleted file mode 100644 index 188e848f..00000000 --- a/lib/common/widget_name_to_icon.dart +++ /dev/null @@ -1,150 +0,0 @@ -import 'package:flutter/material.dart'; -class WidgetName2Icon { - static Map icons = { - "Element":Icons.explicit, - "Components":Icons.extension, - "Themes":Icons.filter_b_and_w, - "Form":Icons.table_chart, - "Frame":Icons.aspect_ratio, - "Media":Icons.subscriptions, - "Input":Icons.input, - "TextField":Icons.text_fields, - "Checkbox":Icons.check_box, - "CheckboxListTile":Icons.playlist_add_check, - "Button":Icons.aspect_ratio, - "FlatButton":Icons.outlined_flag, - "RaisedButton":Icons.picture_in_picture_alt, - "IconButton":Icons.import_contacts, - "PopupMenuButton":Icons.power_input, - "FloatingActionButton":Icons.flash_off, - "RawMaterialButton":Icons.rowing, - "DropdownButton":Icons.drag_handle, - "OutlineButton":Icons.done_outline, - "Text":Icons.text_format, - "RichText":Icons.text_rotation_angleup, - "Radio":Icons.radio_button_checked, - "RadioListTile":Icons.list, - "Slider":Icons.slideshow, - "SliderTheme":Icons.theaters, - "SliderComponentShape":Icons.format_shapes, - "SliderThemeData":Icons.data_usage, - "Switch":Icons.switch_camera, - "SwitchListTile":Icons.switch_video, - "AnimatedSwitcher":Icons.airplanemode_active, - "Align":Icons.format_align_left, - "Stack":Icons.storage, - "IndexedStack":Icons.star, - "Layout":Icons.layers, - "Row":Icons.recent_actors, - "Column":Icons.cloud_off, - "Container":Icons.edit_location, - "Center":Icons.gesture, - "Box":Icons.hdr_strong, - "ConstrainedBox":Icons.account_box, - "OverflowBox":Icons.email, - "DecoratedBox":Icons.settings_overscan, - "FittedBox":Icons.data_usage, - "LimitedBox":Icons.format_align_justify, - "RenderBox":Icons.error, - "RotateBox":Icons.navigate_next, - "SizedOverflowBox":Icons.undo, - "TextBox":Icons.wallpaper, - "UnconstrainedBox":Icons.account_box, - "Axis":Icons.access_alarm, - "MainAxis":Icons.add_circle, - "CrossAxis":Icons.dehaze, - "FlipAxis":Icons.zoom_out, - "Expanded":Icons.all_out, - "Spacing":Icons.crop_free, - "Padding":Icons.crop, - "SliverPadding":Icons.euro_symbol, - "AnimatedPadding":Icons.zoom_out_map, - "Table":Icons.table_chart, - "Image":Icons.image, - "AssetImage":Icons.image_aspect_ratio, - "DecorationImage":Icons.picture_in_picture, - "DecorationImagePainter":Icons.image, - "ExactAssetImage":Icons.assessment, - "FadeInImage":Icons.flip, - "FileImage":Icons.filter, - "NetworkImage":Icons.network_wifi, - "RawImage":Icons.text_rotation_down, - "PaintImage":Icons.format_paint, - "PrecacheImage":Icons.perm_camera_mic, - "MemoryImage":Icons.memory, - "Icon":Icons.event_available, - "ImageIcon":Icons.image, - "IconTheme":Icons.table_chart, - "IconData":Icons.date_range, - "IconThemeData":Icons.insert_comment, - "Canvas":Icons.edit, - "Material":Icons.android, - "MaterialApp":Icons.android, - "MaterialButton":Icons.speaker, - "MaterialGap":Icons.view_week, - "MaterialSlice":Icons.format_list_numbered_rtl , - "MaterialColor":Icons.color_lens, - "Cupertino":Icons.phone_iphone, - "Scroll":Icons.swap_vertical_circle, - "Tab":Icons.tab, - "Menu":Icons.menu, - "PopupMenuDivider":Icons.remove, - "PopupMenuEntry":Icons.menu, - "CheckedPopupMenuItem":Icons.playlist_add_check, - "DropdownMenuItem":Icons.playlist_play, - "Grid":Icons.grid_on, - "Scaffold":Icons.local_convenience_store, - "Dialog":Icons.add_alert, - "Bar":Icons.border_horizontal, - "Card":Icons.credit_card, - "Panel":Icons.video_label, - "Navigation":Icons.navigation, - "List":Icons.list, - "ScrollView":Icons.move_to_inbox, - "Scrollable":Icons.swap_vertical_circle, - "ScrollbarPainter":Icons.format_paint, - "ScrollMetrics":Icons.camera, - "ScrollPhysics":Icons.control_point_duplicate, - "BoxScrollView":Icons.inbox, - "Chip":Icons.sim_card, - "ChipTheme":Icons.sd_card, - "CustomScrollView":Icons.autorenew, - "NestedScrollView":Icons.panorama_fish_eye, - "ChipThemeData":Icons.sim_card_alert, - "ChoiceChip":Icons.insert_drive_file, - "FilterChip":Icons.note_add, - "InputChip":Icons.restore_page, - "RawChip":Icons.save, - "LinearProgressIndicator":Icons.trending_flat , - "CircularProgressIndicator":Icons.rotate_left , - "ExpansionPanel":Icons.view_stream, - "ExpansionPanelList":Icons.view_headline, - "BottomNavigationBar":Icons.call_to_action, - "ListView":Icons.view_list , - "ListBody":Icons.list , - "AnimatedList":Icons.format_line_spacing , - "SliverAppBar":Icons.content_paste, - "AppBar":Icons.card_membership, - "BottomAppBar":Icons.call_to_action, - "BottomNavigationBarItem":Icons.crop_original, - "FlexibleSpaceBar":Icons.aspect_ratio, - "ButtonBar":Icons.branding_watermark, - "SnackBar":Icons.sms_failed, - "Progress":Icons.sync, - "Pick":Icons.event_note, - "DayPicker":Icons.calendar_today, - "MonthPicker":Icons.date_range, - "YearPicker":Icons.event_busy, - "ShowdatePicker":Icons.event, - "MaterialPageRoute":Icons.album, - "MaterialAccentColor":Icons.brush, - "SnackBarAction":Icons.assessment, - "TabBar":Icons.burst_mode, - "AlertDialog":Icons.sms_failed, - "AboutDialog":Icons.sms, - "SimpleDialog":Icons.message, - "ScaffoldState":Icons.local_bar, - "GridTile":Icons.apps, - "MergeableMaterialItem":Icons.view_list - }; -} diff --git a/lib/components/comp_list.dart b/lib/components/comp_list.dart deleted file mode 100644 index 3183bb5a..00000000 --- a/lib/components/comp_list.dart +++ /dev/null @@ -1,99 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_go/views/Detail.dart'; - -class CompList extends StatefulWidget { - @override - State createState() { - return new ListState(); - } -} - -class ListState extends State { - @override - Widget build(BuildContext context) { - /// getData() ; this is test; - return new ListView.builder( - //itemCount: data == null ? 0 : data.length, - itemCount: 100, - itemBuilder: (BuildContext context, int index) { - return new Card( - /////child: new Container( - /////padding: new EdgeInsets.all(10.0), - child: new ListTile( - subtitle: new Container( - child: new Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Expanded( - child: new Text("Title", - - ///data[index]["title"], - style: new TextStyle( - fontWeight: FontWeight.bold, fontSize: 16.0)), - ) - ], - ), - new Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - new Text("time:"), - new Text("2018-05-06") - ], - ), - ], - ), - new Row( - children: [ - new Container( - padding: - const EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 2.0), - child: new Text("content"), - - ///child: new Text("id:"+data[index]["id"].toString()), - ), - ], - ), - ], - ), - ), - trailing: new Icon( - Icons.keyboard_arrow_right, - color: Colors.grey, - ), - - ///onTap: () => _onTap(data[index]["id"].toString()), - onTap: () => _onTap('1'), - ), - /////), - ); - }, - ); - } - - void _onTap(String id){ - Navigator.of(context).push(new PageRouteBuilder( - opaque: false, - pageBuilder: (BuildContext context, _,__){ - return new Detail(id); - }, - transitionsBuilder: (_,Animation animation,__,Widget child){ - return new FadeTransition( - opacity: animation, - child: new SlideTransition(position: new Tween( - begin: const Offset(0.0, 1.0), - end: Offset.zero, - ).animate(animation),child: child, - ), - ) ; - } - )); - } - -} diff --git a/lib/components/disclaimer_msg.dart b/lib/components/disclaimer_msg.dart index 78ebb0a5..ea0d003b 100644 --- a/lib/components/disclaimer_msg.dart +++ b/lib/components/disclaimer_msg.dart @@ -178,7 +178,11 @@ class DisclaimerMsgState extends State { alignment: Alignment.center, decoration: BoxDecoration( borderRadius: +<<<<<<< HEAD BorderRadius.horizontal(right: Radius.circular(10)), +======= + BorderRadius.horizontal(right: Radius.circular(10)), +>>>>>>> develop color: Colors.black45, ), child: Text( diff --git a/lib/components/first_page_item.dart b/lib/components/first_page_item.dart deleted file mode 100644 index 3e4e8604..00000000 --- a/lib/components/first_page_item.dart +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/1/5 - * Time: 下午10:20 - * email: zhu.yan@alibaba-inc.com - * tartget: FirstPageItem - */ - -import '../common/Util.dart'; - -class FirstPageItem { - bool hot; - String isCollection; - String tag; - String username; - int collectionCount; - int commentCount; - String title; - String createdTime; - String detailUrl; - - FirstPageItem( - {this.hot, - this.tag, - this.username, - this.collectionCount, - this.createdTime, - this.commentCount, - this.title, - this.detailUrl, - this.isCollection}); - - factory FirstPageItem.fromJson(Map json) { - String _tag = ''; - if(json['tags'].length>0){ - _tag = '${json['tags'][0]['title']}/'; - } - return FirstPageItem( - hot: json['hot'], - collectionCount: json['collectionCount'], - commentCount: json['commentsCount'], - tag: '$_tag${json['category']['name']}', - username: json['user']['username'], - createdTime: Util.getTimeDuration(json['createdAt']), - title: json['title'], - detailUrl: json['originalUrl'], - isCollection: json['type'] , - ); - } -} \ No newline at end of file diff --git a/lib/components/fourth_page_feature/page_dragger.dart b/lib/components/fourth_page_feature/page_dragger.dart deleted file mode 100644 index 5b00e29f..00000000 --- a/lib/components/fourth_page_feature/page_dragger.dart +++ /dev/null @@ -1,192 +0,0 @@ - -import 'dart:async'; -import 'dart:ui'; - -import 'package:flutter/material.dart'; -import './pager_indicator.dart'; - -class PageDragger extends StatefulWidget { - - final canDragLeftToRight; - final canDragRightToLeft; - - final StreamController slideUpdateStream; - - - PageDragger({ - this.canDragLeftToRight, - this.canDragRightToLeft, - this.slideUpdateStream, - }); - - @override - _PageDraggerState createState() => _PageDraggerState(); -} - -class _PageDraggerState extends State { - - static const FULL_TRANSTITION_PX = 300.0; - - Offset dragStart; - SlideDirection slideDirection; - double slidePercent = 0.0; - - onDragStart(DragStartDetails details){ - dragStart = details.globalPosition; - } - - onDragUpdate(DragUpdateDetails details) { - if (dragStart != null) { - final newPosition = details.globalPosition; - final dx = dragStart.dx - newPosition.dx; - - if (dx > 0 && widget.canDragRightToLeft) { - slideDirection = SlideDirection.rightToLeft; - } else if (dx < 0 && widget.canDragLeftToRight) { - slideDirection = SlideDirection.leftToRight; - } else { - slideDirection = SlideDirection.none; - } - - if (slideDirection != SlideDirection.none){ - slidePercent = (dx / FULL_TRANSTITION_PX).abs().clamp(0.0, 1.0); - } else { - slidePercent = 0.0; - } - widget.slideUpdateStream.add( - new SlideUpdate( - UpdateType.dragging, - slideDirection, - slidePercent - )); - } - } - - onDragEnd(DragEndDetails details){ - widget.slideUpdateStream.add( - new SlideUpdate( - UpdateType.doneDragging, - SlideDirection.none, - 0.0, - ) - ); - - dragStart = null; - } - - @override - Widget build(BuildContext context) { - return GestureDetector( - onHorizontalDragStart: onDragStart , - onHorizontalDragUpdate: onDragUpdate , - onHorizontalDragEnd: onDragEnd , - ); - } -} - -class AnimatedPageDragger{ - - static const PERCENT_PER_MILLISECOND = 0.005; - - final slideDirection; - final transitionGoal; - - AnimationController completionAnimationController; - - AnimatedPageDragger({ - this.slideDirection, - this.transitionGoal, - slidePercent, - StreamController slideUpdateStream, - TickerProvider vsync, - }) { - final startSlidePercent = slidePercent; - var endSlidePercent; - var duration; - - if ( transitionGoal == TransitionGoal.open){ - endSlidePercent = 1.0; - - final slideRemaining = 1.0 - slidePercent; - - duration = new Duration( - milliseconds: (slideRemaining / PERCENT_PER_MILLISECOND).round() - ); - - } else { - endSlidePercent = 0.0; - duration = new Duration( - milliseconds: (slidePercent / PERCENT_PER_MILLISECOND).round() - ); - } - - completionAnimationController = new AnimationController( - duration: duration, - vsync: vsync - ) - ..addListener((){ - slidePercent = lerpDouble( - startSlidePercent, - endSlidePercent, - completionAnimationController.value - ); - - slideUpdateStream.add( - new SlideUpdate( - UpdateType.animating, - slideDirection, - slidePercent, - ) - ); - - }) - - ..addStatusListener((AnimationStatus status){ - - if(status == AnimationStatus.completed){ - slideUpdateStream.add( - new SlideUpdate( - UpdateType.doneAnimating, - slideDirection, - endSlidePercent, - ) - ); - } - - }); - - } - - run(){ - completionAnimationController.forward(from: 0.0); - } - - dispose(){ - completionAnimationController.dispose(); - } - -} - -enum TransitionGoal{ - open, - close, -} - -enum UpdateType{ - dragging, - doneDragging, - animating, - doneAnimating, -} - -class SlideUpdate { - final updateType; - final direction; - final slidePercent; - - SlideUpdate( - this.updateType, - this.direction, - this.slidePercent - ); -} diff --git a/lib/components/fourth_page_feature/page_reveal.dart b/lib/components/fourth_page_feature/page_reveal.dart deleted file mode 100644 index 2cc1490c..00000000 --- a/lib/components/fourth_page_feature/page_reveal.dart +++ /dev/null @@ -1,53 +0,0 @@ -import 'dart:math'; - -import 'package:flutter/material.dart'; - -class PageReveal extends StatelessWidget { - - final double revealPercent; - final Widget child; - - PageReveal({ - this.revealPercent, - this.child - }); - - @override - Widget build(BuildContext context) { - return ClipOval( - clipper: new CircleRevealClipper(revealPercent), - child: child, - ); - } -} - -class CircleRevealClipper extends CustomClipper{ - - final double revealPercent; - - - CircleRevealClipper( - this.revealPercent - ); - - @override - Rect getClip(Size size) { - - final epicenter = new Offset(size.width / 2, size.height * 0.9); - - double theta = atan(epicenter.dy / epicenter.dx); - final distanceToCorner = epicenter.dy / sin(theta); - - final radius = distanceToCorner * revealPercent; - final diameter = 2 * radius; - - return new Rect.fromLTWH(epicenter.dx - radius, epicenter.dy - radius, diameter, diameter); - } - - @override - bool shouldReclip(CustomClipper oldClipper) { - // TODO: implement shouldReclip - return true; - } - -} \ No newline at end of file diff --git a/lib/components/fourth_page_feature/pager_indicator.dart b/lib/components/fourth_page_feature/pager_indicator.dart deleted file mode 100644 index 1889165c..00000000 --- a/lib/components/fourth_page_feature/pager_indicator.dart +++ /dev/null @@ -1,156 +0,0 @@ -import 'dart:ui'; - -import 'package:flutter/material.dart'; -import './pages.dart'; - -class PagerIndicator extends StatelessWidget { - - final PagerIndicatorViewModel viewModel; - - PagerIndicator({ - this.viewModel, - }); - - @override - Widget build(BuildContext context) { - - List bubbles = []; - for(var i = 0; i < viewModel.pages.length; ++i ){ - final page = viewModel.pages[i]; - - var percentActive; - - if(i == viewModel.activeIndex){ - percentActive = 1.0 - viewModel.slidePercent; - } else if (i == viewModel.activeIndex - 1 && viewModel.slideDirection == SlideDirection.leftToRight){ - percentActive = viewModel.slidePercent; - } else if (i == viewModel.activeIndex + 1 && viewModel.slideDirection == SlideDirection.rightToLeft){ - percentActive = viewModel.slidePercent; - }else { - percentActive = 0.0; - } - - bool isHollow = i > viewModel.activeIndex || (i == viewModel.activeIndex && viewModel.slideDirection == SlideDirection.leftToRight); - - - - bubbles.add( - new PageBubble( - viewModel: new PageBubbleViewModel( - page.iconAssetPath, - page.color, - isHollow, - percentActive, - ), - ), - ); - } - - final BUBBLE_WIDHT = 55.0 ; - final baseTranslation = ((viewModel.pages.length * BUBBLE_WIDHT) / 2) - (BUBBLE_WIDHT / 2) ; - var translation = baseTranslation - (viewModel.activeIndex * BUBBLE_WIDHT); - - if (viewModel.slideDirection == SlideDirection.leftToRight){ - translation += BUBBLE_WIDHT * viewModel.slidePercent; - }else if (viewModel.slideDirection == SlideDirection.rightToLeft){ - translation -= BUBBLE_WIDHT * viewModel.slidePercent; - } - - return new Column( - children: [ - new Expanded(child: new Container()), - new Transform( - transform: new Matrix4.translationValues(translation, 0.0, 0.0), - child: new Row( - mainAxisAlignment: MainAxisAlignment.center, - children: bubbles, - ), - ), - ], - ); - } -} - -enum SlideDirection{ - leftToRight, - rightToLeft, - none, -} - - -class PagerIndicatorViewModel{ - final List pages; - final int activeIndex; - final SlideDirection slideDirection; - final double slidePercent; - - PagerIndicatorViewModel( - this.pages, - this.activeIndex, - this.slideDirection, - this.slidePercent - ); - - -} - -class PageBubble extends StatelessWidget { - - final PageBubbleViewModel viewModel; - - - PageBubble({ - this.viewModel - }); - - @override - Widget build(BuildContext context) { - return new Container( - width: 55.0, - height: 65.0, - child: new Center( - child: new Container( - width: lerpDouble(20.0,45.0,viewModel.activePercent), - height: lerpDouble(20.0,45.0,viewModel.activePercent), - decoration: new BoxDecoration( - shape: BoxShape.circle, - color: viewModel.isHollow - ? const Color(0x88FFFFFF).withAlpha(0x88 * viewModel.activePercent.round()) - : const Color(0x88FFFFFF), - border: new Border.all( - color: viewModel.isHollow - ? const Color(0x88FFFFFF).withAlpha((0x88 * (1.0 - viewModel.activePercent)).round()) - : Colors.transparent, - width: 3.0, - ), - ), - child: new Opacity( - opacity: viewModel.activePercent, - child: Image.asset( - viewModel.iconAssetPath, - color: viewModel.color, - ), - ), - ), - ), - ); - } -} - - -class PageBubbleViewModel { - final String iconAssetPath; - final Color color; - final bool isHollow; - final double activePercent; - - PageBubbleViewModel ( - this.iconAssetPath, - this.color, - this.isHollow, - this.activePercent, - ); - - -} - diff --git a/lib/components/fourth_page_feature/pages.dart b/lib/components/fourth_page_feature/pages.dart deleted file mode 100644 index e21ea01e..00000000 --- a/lib/components/fourth_page_feature/pages.dart +++ /dev/null @@ -1,136 +0,0 @@ -import 'package:flutter/material.dart'; -import '../../routers/application.dart'; -import '../../routers/routers.dart'; - -final pages = [ - new PageViewModel( - const Color(0xFFcd344f), - //'assets/mountain.png', - 'assets/images/p2.png', - 'FlutterGo是什么?', - '【FlutterGo】 是由"阿里拍卖"前端团队几位 Flutter 粉丝,用业余时间开发的一款,用于 Flutter 教学帮助的App,这里没有高大尚的概念,只有一个一个亲历的尝试,用最直观的方式展示的 Flutter 官方demo', - 'assets/images/plane.png'), - new PageViewModel( - const Color(0xFF638de3), - //'assets/world.png', - 'assets/images/p1.png', - 'FLutterGo的背景', - '🐢 官网文档示例较不够健全,不够直观\n🐞 运行widget demo要到处翻阅资料\n🐌 英文文档翻译生涩难懂,学习资料太少\n', - 'assets/images/calendar.png'), - new PageViewModel( - const Color(0xFFFF682D), - //'assets/home.png', - 'assets/images/p3.png', - 'FlutterGo的特点', - '🐡 详解常用widget多达 130+ 个\n🦋 持续迭代追新官方版本\n🐙 配套Demo详解widget用法\n🚀 一站式搞定所有常用widget,开箱即查\n', - 'assets/images/house.png', - ), -]; - -class Page extends StatelessWidget { - final PageViewModel viewModel; - final double percentVisible; - - Page({ - this.viewModel, - this.percentVisible = 1.0, - }); - - Widget creatButton(BuildContext context,String txt,IconData iconName,String type){ - return RaisedButton.icon( - onPressed: () { - if(type == 'start'){ - //Navigator.popUntil(context, ModalRoute.withName('/')); - }else if(type == 'goGithub'){ - Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent(txt)} Doc&&url=${Uri.encodeComponent("https://github.com/alibaba/flutter-go")}'); - } - }, - elevation: 10.0, - color:Colors.black26, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20)), - //如果不手动设置icon和text颜色,则默认使用foregroundColor颜色 - icon: new Icon(iconName,color: Colors.white,size:20.0), - label: new Text(txt, maxLines: 1,style: TextStyle(color:Colors.white,fontSize: 16,fontWeight: FontWeight.w700),) - ); - } - - @override - Widget build(BuildContext context) { - return new Container( - width: double.infinity, - color: viewModel.color, - child: new Opacity( - opacity: percentVisible, - child: new Column( - crossAxisAlignment:CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - - new Transform( - transform: new Matrix4.translationValues(0.0, 50.0 * (1.0 - percentVisible) ,0.0), - child: new Padding( - padding: new EdgeInsets.only(top: 20.0, bottom: 10.0), - child: - new Image.asset( - viewModel.heroAssetPath, - width: 200.0, - height: 200.0), - ), - ), - new Transform( - transform: new Matrix4.translationValues(0.0, 30.0 * (1.0 - percentVisible) ,0.0), - child: new Padding( - padding: new EdgeInsets.only(top: 10.0, bottom: 10.0), - child: new Text( - viewModel.title, - style: new TextStyle( - color: Colors.white, - fontFamily: 'FlamanteRoma', - fontSize: 34.0, - ), - ), - ), - ), - new Transform( - transform: new Matrix4.translationValues(0.0, 30.0 * (1.0 - percentVisible) ,0.0), - child: new Padding( - padding: new EdgeInsets.only(bottom: 10.0), - child: new Text( - viewModel.body, - textAlign: TextAlign.center, - style: new TextStyle( - height:1.2, - color: Colors.white, - fontFamily: 'FlamanteRomaItalic', - fontSize: 18.0, - ), - ), - ), - ), - ButtonBar( - alignment: MainAxisAlignment.center, - children: [ - creatButton(context,'开始使用',Icons.add_circle_outline,'start'), - creatButton(context,'GitHub',Icons.arrow_forward,'goGithub'), - ],) - ]), - )); - } -} - -class PageViewModel { - final Color color; - final String heroAssetPath; - final String title; - final String body; - final String iconAssetPath; - - PageViewModel( - this.color, - this.heroAssetPath, - this.title, - this.body, - this.iconAssetPath, - ); -} diff --git a/lib/components/home_banner.dart b/lib/components/home_banner.dart index 5dd335fd..36345cbe 100644 --- a/lib/components/home_banner.dart +++ b/lib/components/home_banner.dart @@ -42,6 +42,18 @@ class _BannerState extends State { timer.cancel(); } + /// pagination 的计数器 + Widget _numberIndicator(BuildContext context, int index, int itemCount) { + return Container( + decoration: BoxDecoration( + color: Colors.black45, borderRadius: BorderRadius.circular(20.0)), + margin: EdgeInsets.only(top: 10.0, right: 5.0), + padding: EdgeInsets.symmetric(horizontal: 6.0, vertical: 2.0), + child: Text("${++index}/$itemCount", + style: TextStyle( color: Colors.white70, fontSize: 12.0, fontWeight:FontWeight.bold )), + ); + } + @override Widget build(BuildContext context) { return Container( @@ -54,6 +66,11 @@ class _BannerState extends State { onPageChanged: _onPageChanged, children: _buildItems(),), _buildIndicator(), // 下面的小点 + Positioned(//方法二 + top: 0.0, + right: 0.0, + child: _numberIndicator(context,virtualIndex,widget.bannerStories.length), + ) ]), ); } diff --git a/lib/event/event-bus.dart b/lib/event/event-bus.dart deleted file mode 100644 index ce2123df..00000000 --- a/lib/event/event-bus.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:event_bus/event_bus.dart'; - -class ApplicationEvent{ - static EventBus event; -} \ No newline at end of file diff --git a/lib/event/event-model.dart b/lib/event/event-model.dart deleted file mode 100644 index f72f0cb6..00000000 --- a/lib/event/event-model.dart +++ /dev/null @@ -1,7 +0,0 @@ -class CollectionEvent{ - final String widgetName; - final String router; - final bool isRemove; - // token uid... - CollectionEvent(this.widgetName,this.router,this.isRemove); -} \ No newline at end of file diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart deleted file mode 100644 index db983ef0..00000000 --- a/lib/generated/i18n.dart +++ /dev/null @@ -1,78 +0,0 @@ - -import 'dart:async'; - -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -// ignore_for_file: non_constant_identifier_names -// ignore_for_file: camel_case_types -// ignore_for_file: prefer_single_quotes - -//This file is automatically generated. DO NOT EDIT, all your changes would be lost. - -class S implements WidgetsLocalizations { - const S(); - - static const GeneratedLocalizationsDelegate delegate = - const GeneratedLocalizationsDelegate(); - - static S of(BuildContext context) => - Localizations.of(context, WidgetsLocalizations); - - @override - TextDirection get textDirection => TextDirection.ltr; - -} - -class en extends S { - const en(); -} - - -class GeneratedLocalizationsDelegate extends LocalizationsDelegate { - const GeneratedLocalizationsDelegate(); - - List get supportedLocales { - return const [ - - const Locale("en", ""), - - ]; - } - - LocaleResolutionCallback resolution({Locale fallback}) { - return (Locale locale, Iterable supported) { - final Locale languageLocale = new Locale(locale.languageCode, ""); - if (supported.contains(locale)) - return locale; - else if (supported.contains(languageLocale)) - return languageLocale; - else { - final Locale fallbackLocale = fallback ?? supported.first; - return fallbackLocale; - } - }; - } - - @override - Future load(Locale locale) { - final String lang = getLang(locale); - switch (lang) { - - case "en": - return new SynchronousFuture(const en()); - - default: - return new SynchronousFuture(const S()); - } - } - - @override - bool isSupported(Locale locale) => supportedLocales.contains(locale); - - @override - bool shouldReload(GeneratedLocalizationsDelegate old) => false; -} - -String getLang(Locale l) => l.countryCode != null && l.countryCode.isEmpty - ? l.languageCode - : l.toString(); diff --git a/lib/main.dart b/lib/main.dart index 8d268d7b..8ebb0d23 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,8 +6,14 @@ import 'routers/application.dart'; import 'package:flutter_go/utils/provider.dart'; import 'package:flutter_go/utils/shared_preferences.dart'; +<<<<<<< HEAD import 'package:flutter_go/views/first_page/home.dart'; import 'package:flutter_go/model/search_history.dart'; +======= +import 'package:flutter_go/views/home.dart'; +import 'package:flutter_go/model/search_history.dart'; +import 'package:flutter_go/utils/analytics.dart' as Analytics; +>>>>>>> develop //import 'views/welcome_page/index.dart'; const int ThemeColor = 0xFFC91B3A; @@ -52,7 +58,12 @@ class MyApp extends StatelessWidget { home: new Scaffold( body: showWelcomePage() ), +<<<<<<< HEAD +======= + debugShowCheckedModeBanner: false, +>>>>>>> develop onGenerateRoute: Application.router.generator, + navigatorObservers: [Analytics.observer], ); } } diff --git a/lib/model/collection_general.dart b/lib/model/collection_general.dart deleted file mode 100644 index 9e23674d..00000000 --- a/lib/model/collection_general.dart +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Created with Android Studio. - * User: 一晟 - * Date: 2019/1/12 - * Time: 下午9:19 - * email: zhu.yan@alibaba-inc.com - */ -import 'dart:async'; -import '../common/sql.dart'; - -abstract class CollectionInterface { - String get key; - String get values; -} - -class CollectionGeneral implements CollectionInterface { - String key; - String values; - - CollectionGeneral({this.key, this.values}); - - factory CollectionGeneral.fromJSON(Map json){ - return CollectionGeneral(key: json['name'],values: json['values']); - } - - Object toMap() { - return {'key': key, 'values': values}; - } -} - -class CollectionControlModel { - final String table = 'collectionGeneral'; - Sql sql; - - CollectionControlModel() { - sql = Sql.setTable(table); - } - - // 获取所有的收藏 - - // 插入新收藏 - Future insert(CollectionGeneral collection) { - var result = - sql.insert({'key': collection.key, 'values': collection.values}); - return result; - } - - // 获取全部的收藏 - Future> getAllCollection() async { - List list = await sql.getByCondition(); - List resultList = []; - list.forEach((item){ - print(item); - resultList.add(CollectionGeneral.fromJSON(item)); - }); - return resultList; - } - - // 通过收藏名获取router - Future getRouterByName(String key) async { - List list = await sql.getByCondition(conditions: {'key': key}); - return list; - } - - // 删除 - Future deleteByName(String key) async{ - return await sql.delete(key,'key'); - } -} diff --git a/lib/routers/router_handler.dart b/lib/routers/router_handler.dart index 01519cd5..abb899c4 100644 --- a/lib/routers/router_handler.dart +++ b/lib/routers/router_handler.dart @@ -5,7 +5,11 @@ import 'package:flutter_go/components/category.dart'; import '../widgets/404.dart'; import 'package:flutter_go/components/full_screen_code_dialog.dart'; import 'package:flutter_go/views/web_page/web_view_page.dart'; +<<<<<<< HEAD import 'package:flutter_go/views/first_page/home.dart'; +======= +import 'package:flutter_go/views/home.dart'; +>>>>>>> develop // app的首页 var homeHandler = new Handler( diff --git a/lib/routers/routers.dart b/lib/routers/routers.dart index 4e589b61..6a4325af 100644 --- a/lib/routers/routers.dart +++ b/lib/routers/routers.dart @@ -1,6 +1,10 @@ import 'package:fluro/fluro.dart'; import 'package:flutter/material.dart'; +<<<<<<< HEAD +======= +import 'package:flutter_go/utils/analytics.dart' show analytics; +>>>>>>> develop import '../widgets/index.dart'; import './router_handler.dart'; @@ -26,6 +30,12 @@ class Routes { widgetDemosList.forEach((demo) { Handler handler = new Handler( handlerFunc: (BuildContext context, Map> params) { +<<<<<<< HEAD +======= + print('组件路由params=$params widgetsItem=${demo.routerName}'); + analytics.logEvent( + name: 'component', parameters: {'name': demo.routerName }); +>>>>>>> develop return demo.buildRouter(context); }); router.define('${demo.routerName}', handler: handler); diff --git a/lib/utils/analytics.dart b/lib/utils/analytics.dart new file mode 100644 index 00000000..2a7fcf6f --- /dev/null +++ b/lib/utils/analytics.dart @@ -0,0 +1,7 @@ +import 'package:firebase_analytics/firebase_analytics.dart'; +import 'package:firebase_analytics/observer.dart'; + +//统计 +FirebaseAnalytics analytics = FirebaseAnalytics(); +FirebaseAnalyticsObserver observer = + FirebaseAnalyticsObserver(analytics: analytics); diff --git a/lib/views/Detail.dart b/lib/views/Detail.dart deleted file mode 100644 index 0677a2bc..00000000 --- a/lib/views/Detail.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:flutter/material.dart'; - -class Detail extends StatelessWidget { - - final String id ; - Detail(this.id) ; - - - @override - Widget build(BuildContext context) { - return new Scaffold( - appBar: new AppBar( - title: new Text('List Detail'), - ), - body: new Center( - child: new Text('msg:'+ 'id='+id), - ), - ) ; - } - - -} \ No newline at end of file diff --git a/lib/views/category.dart b/lib/views/category.dart deleted file mode 100644 index 0bcd850e..00000000 --- a/lib/views/category.dart +++ /dev/null @@ -1,142 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import '../routers/application.dart'; -import '../model/cat.dart'; -import '../model/widget.dart'; -import '../widgets/index.dart'; -import '../components/widget_item_container.dart'; - -enum CateOrWigdet { Cat, WidgetDemo } - -class CategoryHome extends StatefulWidget { - CategoryHome(this.name); - final String name; - - @override - _CategoryHome createState() => new _CategoryHome(); -} - -class _CategoryHome extends State { - String title = ''; - // 显示列表 cat or widget; - List categories = []; - List widgetPoints = []; - List catHistory = new List(); - - CatControlModel catControl = new CatControlModel(); - WidgetControlModel widgetControl = new WidgetControlModel(); - // 所有的可用demos; - List widgetDemosList = new WidgetDemoList().getDemos(); - - @override - void initState() { - super.initState(); - // 初始化加入顶级的name - this.getCatByName(widget.name).then((Cat cat) { - catHistory.add(cat); - searchCatOrWigdet(); - }); - } - - Future getCatByName(String name) async { - return await catControl.getCatByName(name); - } - - Future back() { - if (catHistory.length == 1) { - return Future.value(true); - } - catHistory.removeLast(); - searchCatOrWigdet(); - return Future.value(false); - } - - void go(Cat cat) { - catHistory.add(cat); - searchCatOrWigdet(); - } - - void searchCatOrWigdet() async { - // 假设进入这个界面的parent一定存在 - Cat parentCat = catHistory.last; - - - // 继续搜索显示下一级depth: depth + 1, parentId: parentCat.id - List _categories = - await catControl.getList(new Cat(parentId: parentCat.id)); - List _widgetPoints = new List(); - if (_categories.isEmpty) { - _widgetPoints = - await widgetControl.getList(new WidgetPoint(catId: parentCat.id)); - } - - this.setState(() { - categories = _categories; - title = parentCat.name; - widgetPoints = _widgetPoints; - }); - } - - void onCatgoryTap(Cat cat) { - go(cat); - } - - void onWidgetTap(WidgetPoint widgetPoint) { - String targetName = widgetPoint.name; - String targetRouter = '/category/error/404'; - widgetDemosList.forEach((item) { - // print("targetRouter = item.routerName> ${[item.name,targetName]}"); - if (item.name == targetName) { - targetRouter = item.routerName; - } - }); - Application.router.navigateTo(context, "$targetRouter"); - } - - Widget _buildContent() { - WidgetItemContainer wiContaienr = WidgetItemContainer( - columnCount: 3, - categories: categories, - isWidgetPoint:false - ); - if (widgetPoints.length > 0) { - wiContaienr = WidgetItemContainer( - categories: widgetPoints, - columnCount: 3, - isWidgetPoint:true - ); - } - return Container( - padding: const EdgeInsets.only(bottom: 10.0, top: 5.0), - decoration: BoxDecoration( - color: Colors.white, - image: DecorationImage( - image: AssetImage('assets/images/paimaiLogo.png'), - alignment: Alignment.bottomRight), - ), - child: wiContaienr, - ); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(title), - ), - body: WillPopScope( - onWillPop: () { - return back(); - }, - child: ListView( - children: [ - _buildContent(), - ], - ), - // child: Container(color: Colors.blue,child: Text('123'),), - ), - ); - } -} - diff --git a/lib/views/collection_page.dart b/lib/views/collection_page.dart deleted file mode 100644 index b1e0fe60..00000000 --- a/lib/views/collection_page.dart +++ /dev/null @@ -1,150 +0,0 @@ -/* - * @Author: 一凨 - * @Date: 2019-01-08 17:12:58 - * @Last Modified by: 一凨 - * @Last Modified time: 2019-01-14 20:13:28 - */ -import 'package:flutter/material.dart'; -import '../model/collection.dart'; -import '../routers/application.dart'; -import '../routers/routers.dart'; -import '../event/event-bus.dart'; -import '../event/event-model.dart'; -import 'package:event_bus/event_bus.dart'; - -class CollectionPage extends StatefulWidget { - _CollectionPageState createState() => _CollectionPageState(); -} - -class _CollectionPageState extends State { - _CollectionPageState() { - final eventBus = new EventBus(); - ApplicationEvent.event = eventBus; - } - CollectionControlModel _collectionControl = new CollectionControlModel(); - List _collectionList = []; - ScrollController _scrollController = new ScrollController(); - var _icons; - - @override - void initState() { - super.initState(); - _getList(); - ApplicationEvent.event.on().listen((event) { - _getList(); - }); - } - - @override - void dispose() { - _scrollController.dispose(); - super.dispose(); - } - - void _getList() { - _collectionList.clear(); - _collectionControl.getAllCollection().then((resultList) { - resultList.forEach((item) { - _collectionList.add(item); - }); - if (this.mounted) { - setState(() { - _collectionList = _collectionList; - }); - } - }); - } - - Widget _renderList(context, index) { - if (index == 0) { - return Container( - height: 40.0, - padding: const EdgeInsets.only(left: 10.0), - child: Row( - children: [ - Icon( - Icons.warning, - size: 22.0, - ), - SizedBox( - width: 5.0, - ), - Text('模拟器重新运行会丢失收藏'), - ], - ), - ); - } - if (_collectionList[index - 1].router.contains('http')) { - if (_collectionList[index - 1].name.endsWith('Doc')) { - _icons = Icons.library_books; - } else { - _icons = Icons.language; - } - } else { - _icons = Icons.extension; - } - return Container( - padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 5.0), - margin: const EdgeInsets.only(bottom: 7.0), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - new BoxShadow( - color: const Color(0xFFd0d0d0), - blurRadius: 1.0, - spreadRadius: 2.0, - offset: Offset(3.0, 2.0), - ), - ], - ), - child: ListTile( - leading: Icon( - _icons, - size: 30.0, - color: Theme.of(context).primaryColor, - ), - title: Text( - _collectionList[index - 1].name, - overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 17.0), - ), - trailing: - Icon(Icons.keyboard_arrow_right, color: Colors.grey, size: 30.0), - onTap: () { - if (_collectionList[index - 1].router.contains('http')) { - Application.router.navigateTo(context, - '${Routes.webViewPage}?title=${Uri.encodeComponent(_collectionList[index - 1].name)}&url=${Uri.encodeComponent(_collectionList[index - 1].router)}'); - } else { - Application.router - .navigateTo(context, "${_collectionList[index - 1].router}"); - } - }, - ), - ); - } - - @override - Widget build(BuildContext context) { - if (_collectionList.length == 0) { - return ListView( - children: [ - Column( - children: [ - Image.asset( - 'assets/images/nothing.png', - fit: BoxFit.contain, - width: MediaQuery.of(context).size.width / 2, - ), - Text('暂无收藏,赶紧去收藏一个吧!'), - ], - ), - ], - ); - } - return ListView.builder( - itemBuilder: _renderList, - itemCount: _collectionList.length + 1, - controller: _scrollController, - ); - } -} diff --git a/lib/views/detail.dart b/lib/views/detail.dart deleted file mode 100644 index 0677a2bc..00000000 --- a/lib/views/detail.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:flutter/material.dart'; - -class Detail extends StatelessWidget { - - final String id ; - Detail(this.id) ; - - - @override - Widget build(BuildContext context) { - return new Scaffold( - appBar: new AppBar( - title: new Text('List Detail'), - ), - body: new Center( - child: new Text('msg:'+ 'id='+id), - ), - ) ; - } - - -} \ No newline at end of file diff --git a/lib/views/first_page.dart b/lib/views/first_page.dart deleted file mode 100644 index d364b3e3..00000000 --- a/lib/views/first_page.dart +++ /dev/null @@ -1,150 +0,0 @@ -import 'dart:async'; -import 'package:flutter/material.dart'; - -import 'package:flutter_go/common/list_view_item.dart'; -import 'package:flutter_go/components/list_refresh.dart' as listComp; -import 'package:flutter_go/components/pagination.dart'; -import 'package:flutter_go/components/first_page_item.dart'; -import 'package:flutter_go/components/disclaimer_msg.dart'; -import 'package:shared_preferences/shared_preferences.dart'; - -import '../common/net_utils.dart'; - -GlobalKey key; - -class FirstPage extends StatefulWidget { - @override - FirstPageState createState() => new FirstPageState(); -} - -class FirstPageState extends State with AutomaticKeepAliveClientMixin{ - - @override - bool get wantKeepAlive => true; - - save(bool flag) async{ - //print('=============save=========$flag'); - SharedPreferences prefs = await SharedPreferences.getInstance(); - prefs.setString('disclaimer', flag.toString()); - } - - Future get() async { - var value; - SharedPreferences prefs = await SharedPreferences.getInstance(); - value = prefs.getString('disclaimer'); - return value; - } - - @override - void initState() { - super.initState(); - if(key == null) { - //print('=============111=========${key}'); - delayed(); - } - key = GlobalKey(); - - } - - /* - * 判断是否需要弹出免责声明,已经勾选过不在显示,就不会主动弹 - * */ - Future delayed() async { - await new Future.delayed(const Duration(seconds: 1)); -// if (this.mounted) { -// setState(() { -// print('test=======>${key.currentState}'); -// key.currentState.showAlertDialog(context); -// //key.currentState.init(context); -// }); -// } - Future flag = get(); - flag.then((String value) { - //print('=============get=========$value'); - if(value.toString() == 'false'){ // 如果没有勾选下次开启 - key.currentState.showAlertDialog(context); - } - }); - } - - Future getIndexListData([Map params]) async { - const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; - var pageIndex = (params is Map) ? params['pageIndex'] : 0; - final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'}; - - var response = await NetUtils.get(juejin_flutter, params: _param); - var responseList = response['d']['entrylist']; - var pageTotal = response['d']['total']; - if (!(pageTotal is int) || pageTotal <= 0) { - pageTotal = 0; - } - pageIndex += 1; - List resultList = new List(); - for (int i = 0; i < responseList.length; i++) { - try { - FirstPageItem cellData = new FirstPageItem.fromJson(responseList[i]); - resultList.add(cellData); - } catch (e) { - // No specified type, handles all - } - } - Map result = {"list":resultList, 'total':pageTotal, 'pageIndex':pageIndex}; - return result; - } - - Widget makeCard(index,item){ - - var myTitle = '${item.title}'; - var myUsername = '${'👲'}: ${item.username} '; - var codeUrl = '${item.detailUrl}'; - return new ListViewItem(itemUrl:codeUrl,itemTitle: myTitle,data: myUsername,); - } - - headerView(){ - return - Column( - children: [ - Stack( - //alignment: const FractionalOffset(0.9, 0.1),//方法一 - children: [ - Pagination(), - Positioned(//方法二 - top: 10.0, - left: 0.0, - child: DisclaimerMsg(key:key,pWidget:this) - ), - ]), - SizedBox(height: 1, child:Container(color: Theme.of(context).primaryColor)), - SizedBox(height: 10), - ], - ); - - } - - @override - Widget build(BuildContext context) { - super.build(context); - return new Column( - children: [ -// new Stack( -// //alignment: const FractionalOffset(0.9, 0.1),//方法一 -// children: [ -// Pagination(), -// Positioned(//方法二 -// top: 10.0, -// left: 0.0, -// child: DisclaimerMsg(key:key,pWidget:this) -// ), -// ]), -// SizedBox(height: 2, child:Container(color: Theme.of(context).primaryColor)), - new Expanded( - //child: new List(), - child: listComp.ListRefresh(getIndexListData,makeCard,headerView) - ) - ] - - ); - } -} - - diff --git a/lib/views/first_page/first_page.dart b/lib/views/first_page/first_page.dart index e121390f..4074c2a4 100644 --- a/lib/views/first_page/first_page.dart +++ b/lib/views/first_page/first_page.dart @@ -17,11 +17,18 @@ class FirstPage extends StatefulWidget { FirstPageState createState() => new FirstPageState(); } +<<<<<<< HEAD +======= + +>>>>>>> develop class FirstPageState extends State with AutomaticKeepAliveClientMixin{ Future _prefs = SharedPreferences.getInstance(); Future _unKnow; GlobalKey key; +<<<<<<< HEAD +======= +>>>>>>> develop @override bool get wantKeepAlive => true; @@ -40,8 +47,13 @@ class FirstPageState extends State with AutomaticKeepAliveClientMixin /// 判断是否需要弹出免责声明,已经勾选过不在显示,就不会主动弹 _unKnow.then((bool value) { new Future.delayed(const Duration(seconds: 1),(){ +<<<<<<< HEAD if (!value) { key.currentState.showAlertDialog(context); +======= + if (!value && key.currentState is DisclaimerMsgState && key.currentState.showAlertDialog is Function) { + key.currentState.showAlertDialog(context); +>>>>>>> develop } }); }); @@ -50,7 +62,12 @@ class FirstPageState extends State with AutomaticKeepAliveClientMixin Future getIndexListData([Map params]) async { +<<<<<<< HEAD const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; +======= + const juejin_flutter = + 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; +>>>>>>> develop var pageIndex = (params is Map) ? params['pageIndex'] : 0; final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'}; var responseList = []; @@ -76,12 +93,26 @@ class FirstPageState extends State with AutomaticKeepAliveClientMixin // No specified type, handles all } } +<<<<<<< HEAD Map result = {"list":resultList, 'total':pageTotal, 'pageIndex':pageIndex}; return result; } Widget makeCard(index,item){ +======= + Map result = { + "list": resultList, + 'total': pageTotal, + 'pageIndex': pageIndex + }; + return result; + } + + + /// 每个item的样式 + Widget makeCard(index,item){ +>>>>>>> develop var myTitle = '${item.title}'; var myUsername = '${'👲'}: ${item.username} '; var codeUrl = '${item.detailUrl}'; @@ -92,6 +123,7 @@ class FirstPageState extends State with AutomaticKeepAliveClientMixin return Column( children: [ +<<<<<<< HEAD Stack( //alignment: const FractionalOffset(0.9, 0.1),//方法一 children: [ @@ -104,6 +136,20 @@ class FirstPageState extends State with AutomaticKeepAliveClientMixin ]), SizedBox(height: 1, child:Container(color: Theme.of(context).primaryColor)), SizedBox(height: 10), +======= + Stack( + //alignment: const FractionalOffset(0.9, 0.1),//方法一 + children: [ + Pagination(), + Positioned(//方法二 + top: 10.0, + left: 0.0, + child: DisclaimerMsg(key:key,pWidget:this) + ), + ]), + SizedBox(height: 1, child:Container(color: Theme.of(context).primaryColor)), + SizedBox(height: 10), +>>>>>>> develop ], ); @@ -112,6 +158,7 @@ class FirstPageState extends State with AutomaticKeepAliveClientMixin @override Widget build(BuildContext context) { super.build(context); +<<<<<<< HEAD return new Column( children: [ // new Stack( @@ -136,3 +183,24 @@ class FirstPageState extends State with AutomaticKeepAliveClientMixin } +======= + return new Column(children: [ + new Stack( + //alignment: const FractionalOffset(0.9, 0.1),//方法一 + children: [ + Pagination(), + Positioned( + //方法二 + top: 10.0, + left: 0.0, + child: new DisclaimerMsg(key: key, pWidget: this)), + ]), + SizedBox( + height: 2, child: Container(color: Theme.of(context).primaryColor)), + new Expanded( + //child: new List(), + child: listComp.ListRefresh(getIndexListData, makeCard)) + ]); + } +} +>>>>>>> develop diff --git a/lib/views/first_page/main_app_bar.dart b/lib/views/first_page/main_app_bar.dart new file mode 100644 index 00000000..c85e4cde --- /dev/null +++ b/lib/views/first_page/main_app_bar.dart @@ -0,0 +1,415 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +const double _kLeadingWidth = + kToolbarHeight; // So the leading button is square. + +// Bottom justify the kToolbarHeight child which may overflow the top. +class _ToolbarContainerLayout extends SingleChildLayoutDelegate { + const _ToolbarContainerLayout(); + + @override + BoxConstraints getConstraintsForChild(BoxConstraints constraints) { + return constraints.tighten(height: kToolbarHeight); + } + + @override + Size getSize(BoxConstraints constraints) { + return Size(constraints.maxWidth, kToolbarHeight); + } + + @override + Offset getPositionForChild(Size size, Size childSize) { + return Offset(0.0, size.height - childSize.height); + } + + @override + bool shouldRelayout(_ToolbarContainerLayout oldDelegate) => false; +} + +class MyAppBar extends StatefulWidget implements PreferredSizeWidget { + /// Creates a material design app bar. + /// + /// The arguments [elevation], [primary], [toolbarOpacity], [bottomOpacity] + /// and [automaticallyImplyLeading] must not be null. + /// + /// Typically used in the [Scaffold.appBar] property. + MyAppBar({ + Key key, + this.leading, + this.automaticallyImplyLeading = true, + this.title, + this.actions, + this.flexibleSpace, + this.bottom, + this.elevation = 4.0, + this.backgroundColor, + this.brightness, + this.iconTheme, + this.textTheme, + this.primary = true, + this.centerTitle, + this.titleSpacing = NavigationToolbar.kMiddleSpacing, + this.toolbarOpacity = 1.0, + this.bottomOpacity = 1.0, + }) : assert(automaticallyImplyLeading != null), + assert(elevation != null), + assert(primary != null), + assert(titleSpacing != null), + assert(toolbarOpacity != null), + assert(bottomOpacity != null), + preferredSize = Size.fromHeight( + kToolbarHeight + (bottom?.preferredSize?.height ?? 0.0)), + super(key: key); + + /// A widget to display before the [title]. + /// + /// If this is null and [automaticallyImplyLeading] is set to true, the + /// [AppBar] will imply an appropriate widget. For example, if the [AppBar] is + /// in a [Scaffold] that also has a [Drawer], the [Scaffold] will fill this + /// widget with an [IconButton] that opens the drawer (using [Icons.menu]). If + /// there's no [Drawer] and the parent [Navigator] can go back, the [AppBar] + /// will use a [BackButton] that calls [Navigator.maybePop]. + final Widget leading; + + /// Controls whether we should try to imply the leading widget if null. + /// + /// If true and [leading] is null, automatically try to deduce what the leading + /// widget should be. If false and [leading] is null, leading space is given to [title]. + /// If leading widget is not null, this parameter has no effect. + final bool automaticallyImplyLeading; + + /// The primary widget displayed in the appbar. + /// + /// Typically a [Text] widget containing a description of the current contents + /// of the app. + final Widget title; + + /// Widgets to display after the [title] widget. + /// + /// Typically these widgets are [IconButton]s representing common operations. + /// For less common operations, consider using a [PopupMenuButton] as the + /// last action. + /// + /// ## Sample code + /// + /// ```dart + /// Scaffold( + /// appBar: AppBar( + /// title: Text('Hello World'), + /// actions: [ + /// IconButton( + /// icon: Icon(Icons.shopping_cart), + /// tooltip: 'Open shopping cart', + /// onPressed: () { + /// // ... + /// }, + /// ), + /// ], + /// ), + /// ) + /// ``` + final List actions; + + /// This widget is stacked behind the toolbar and the tabbar. It's height will + /// be the same as the app bar's overall height. + /// + /// A flexible space isn't actually flexible unless the [AppBar]'s container + /// changes the [AppBar]'s size. A [SliverAppBar] in a [CustomScrollView] + /// changes the [AppBar]'s height when scrolled. + /// + /// Typically a [FlexibleSpaceBar]. See [FlexibleSpaceBar] for details. + final Widget flexibleSpace; + + /// This widget appears across the bottom of the app bar. + /// + /// Typically a [TabBar]. Only widgets that implement [PreferredSizeWidget] can + /// be used at the bottom of an app bar. + /// + /// See also: + /// + /// * [PreferredSize], which can be used to give an arbitrary widget a preferred size. + final PreferredSizeWidget bottom; + + /// The z-coordinate at which to place this app bar. This controls the size of + /// the shadow below the app bar. + /// + /// Defaults to 4, the appropriate elevation for app bars. + final double elevation; + + /// The color to use for the app bar's material. Typically this should be set + /// along with [brightness], [iconTheme], [textTheme]. + /// + /// Defaults to [ThemeData.primaryColor]. + final Color backgroundColor; + + /// The brightness of the app bar's material. Typically this is set along + /// with [backgroundColor], [iconTheme], [textTheme]. + /// + /// Defaults to [ThemeData.primaryColorBrightness]. + final Brightness brightness; + + /// The color, opacity, and size to use for app bar icons. Typically this + /// is set along with [backgroundColor], [brightness], [textTheme]. + /// + /// Defaults to [ThemeData.primaryIconTheme]. + final IconThemeData iconTheme; + + /// The typographic styles to use for text in the app bar. Typically this is + /// set along with [brightness] [backgroundColor], [iconTheme]. + /// + /// Defaults to [ThemeData.primaryTextTheme]. + final TextTheme textTheme; + + /// Whether this app bar is being displayed at the top of the screen. + /// + /// If true, the appbar's toolbar elements and [bottom] widget will be + /// padded on top by the height of the system status bar. The layout + /// of the [flexibleSpace] is not affected by the [primary] property. + final bool primary; + + /// Whether the title should be centered. + /// + /// Defaults to being adapted to the current [TargetPlatform]. + final bool centerTitle; + + /// The spacing around [title] content on the horizontal axis. This spacing is + /// applied even if there is no [leading] content or [actions]. If you want + /// [title] to take all the space available, set this value to 0.0. + /// + /// Defaults to [NavigationToolbar.kMiddleSpacing]. + final double titleSpacing; + + /// How opaque the toolbar part of the app bar is. + /// + /// A value of 1.0 is fully opaque, and a value of 0.0 is fully transparent. + /// + /// Typically, this value is not changed from its default value (1.0). It is + /// used by [SliverAppBar] to animate the opacity of the toolbar when the app + /// bar is scrolled. + final double toolbarOpacity; + + /// How opaque the bottom part of the app bar is. + /// + /// A value of 1.0 is fully opaque, and a value of 0.0 is fully transparent. + /// + /// Typically, this value is not changed from its default value (1.0). It is + /// used by [SliverAppBar] to animate the opacity of the toolbar when the app + /// bar is scrolled. + final double bottomOpacity; + + /// A size whose height is the sum of [kToolbarHeight] and the [bottom] widget's + /// preferred height. + /// + /// [Scaffold] uses this this size to set its app bar's height. + @override + final Size preferredSize; + + bool _getEffectiveCenterTitle(ThemeData themeData) { + if (centerTitle != null) return centerTitle; + assert(themeData.platform != null); + switch (themeData.platform) { + case TargetPlatform.android: + case TargetPlatform.fuchsia: + return false; + case TargetPlatform.iOS: + return actions == null || actions.length < 2; + } + return null; + } + + @override + _MyAppBarState createState() => _MyAppBarState(); +} + +class _MyAppBarState extends State { + void _handleDrawerButton() { + Scaffold.of(context).openDrawer(); + } + + void _handleDrawerButtonEnd() { + Scaffold.of(context).openEndDrawer(); + } + + @override + Widget build(BuildContext context) { + assert(!widget.primary || debugCheckHasMediaQuery(context)); + assert(debugCheckHasMaterialLocalizations(context)); + final ThemeData themeData = Theme.of(context); + final ScaffoldState scaffold = Scaffold.of(context, nullOk: true); + final ModalRoute parentRoute = ModalRoute.of(context); + + final bool hasDrawer = scaffold?.hasDrawer ?? false; + final bool hasEndDrawer = scaffold?.hasEndDrawer ?? false; + final bool canPop = parentRoute?.canPop ?? false; + final bool useCloseButton = + parentRoute is PageRoute && parentRoute.fullscreenDialog; + + IconThemeData appBarIconTheme = + widget.iconTheme ?? themeData.primaryIconTheme; + TextStyle centerStyle = + widget.textTheme?.title ?? themeData.primaryTextTheme.title; + TextStyle sideStyle = + widget.textTheme?.body1 ?? themeData.primaryTextTheme.body1; + + if (widget.toolbarOpacity != 1.0) { + final double opacity = + const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn) + .transform(widget.toolbarOpacity); + if (centerStyle?.color != null) + centerStyle = + centerStyle.copyWith(color: centerStyle.color.withOpacity(opacity)); + if (sideStyle?.color != null) + sideStyle = + sideStyle.copyWith(color: sideStyle.color.withOpacity(opacity)); + appBarIconTheme = appBarIconTheme.copyWith( + opacity: opacity * (appBarIconTheme.opacity ?? 1.0)); + } + + Widget leading = widget.leading; + //if (leading == null && widget.automaticallyImplyLeading) { + if (widget.automaticallyImplyLeading) { + if (hasDrawer) { + leading = IconButton( + //icon: const Icon(Icons.menu), + icon: leading ?? const Icon(Icons.menu), + onPressed: _handleDrawerButton, + tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip, + ); + } else { + if (canPop) + leading = useCloseButton ? const CloseButton() : const BackButton(); + } + } + if (leading != null) { + leading = ConstrainedBox( + constraints: const BoxConstraints.tightFor(width: _kLeadingWidth), + child: leading, + ); + } + + Widget title = widget.title; + if (title != null) { + bool namesRoute; + switch (defaultTargetPlatform) { + case TargetPlatform.android: + case TargetPlatform.fuchsia: + namesRoute = true; + break; + case TargetPlatform.iOS: + break; + } + title = DefaultTextStyle( + style: centerStyle, + softWrap: false, + overflow: TextOverflow.ellipsis, + child: Semantics( + namesRoute: namesRoute, + child: title, + header: true, + ), + ); + } + + Widget actions; + if (widget.actions != null && widget.actions.isNotEmpty) { + actions = Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: widget.actions, + ); + } else if (hasEndDrawer) { + actions = IconButton( + icon: const Icon(Icons.menu), + onPressed: _handleDrawerButtonEnd, + tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip, + ); + } + + final Widget toolbar = NavigationToolbar( + leading: leading, + middle: title, + trailing: actions, + centerMiddle: widget._getEffectiveCenterTitle(themeData), + middleSpacing: widget.titleSpacing, + ); + + // If the toolbar is allocated less than kToolbarHeight make it + // appear to scroll upwards within its shrinking container. + Widget appBar = ClipRect( + child: CustomSingleChildLayout( + delegate: const _ToolbarContainerLayout(), + child: IconTheme.merge( + data: appBarIconTheme, + child: DefaultTextStyle( + style: sideStyle, + child: toolbar, + ), + ), + ), + ); + if (widget.bottom != null) { + appBar = Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible( + child: ConstrainedBox( + constraints: const BoxConstraints(maxHeight: kToolbarHeight), + child: appBar, + ), + ), + widget.bottomOpacity == 1.0 + ? widget.bottom + : Opacity( + opacity: + const Interval(0.25, 1.0, curve: Curves.fastOutSlowIn) + .transform(widget.bottomOpacity), + child: widget.bottom, + ), + ], + ); + } + + // The padding applies to the toolbar and tabbar, not the flexible space. + if (widget.primary) { + appBar = SafeArea( + top: true, + child: appBar, + ); + } + + appBar = Align( + alignment: Alignment.topCenter, + child: appBar, + ); + + if (widget.flexibleSpace != null) { + appBar = Stack( + fit: StackFit.passthrough, + children: [ + widget.flexibleSpace, + appBar, + ], + ); + } + final Brightness brightness = + widget.brightness ?? themeData.primaryColorBrightness; + final SystemUiOverlayStyle overlayStyle = brightness == Brightness.dark + ? SystemUiOverlayStyle.light + : SystemUiOverlayStyle.dark; + + return Semantics( + container: true, + explicitChildNodes: true, + child: AnnotatedRegion( + value: overlayStyle, + child: Material( + color: widget.backgroundColor ?? themeData.primaryColor, + elevation: widget.elevation, + child: appBar, + ), + ), + ); + } +} diff --git a/lib/views/first_page/main_page.dart b/lib/views/first_page/main_page.dart new file mode 100644 index 00000000..43383a85 --- /dev/null +++ b/lib/views/first_page/main_page.dart @@ -0,0 +1,106 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/cupertino.dart'; +import './first_page.dart'; +import './sub_page.dart'; +import './main_app_bar.dart'; +import './search_page.dart'; + +class _Page { + final String labelId; + + _Page(this.labelId); +} + +final List<_Page> _allPages = <_Page>[ + _Page('项目1'), + _Page('项目2'), + _Page('项目3'), + _Page('项目4'), +]; + +class MainPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + print("MainPagess build......"); + return DefaultTabController( + length: _allPages.length, + child: Scaffold( + appBar: new MyAppBar( + leading: Container( + child: new ClipOval( + child: Image.network( + 'https://hbimg.huabanimg.com/9bfa0fad3b1284d652d370fa0a8155e1222c62c0bf9d-YjG0Vt_fw658', + scale: 15.0, + ), + ) + ), + centerTitle: true, + title: TabLayout(), + actions: [ + IconButton( + icon: Icon(Icons.search), + onPressed: () { + pushPage(context, SearchPage(), pageName: "SearchPage"); + }) + ], + ), + body: TabBarViewLayout(), +// drawer: Drawer( +// child: MainLeftPage(), +// ), + )); + } +} + +void pushPage(BuildContext context, Widget page, {String pageName}) { + if (context == null || page == null) return; + Navigator.push(context, CupertinoPageRoute(builder: (ctx) => page)); +} + +class TabLayout extends StatelessWidget { + @override + Widget build(BuildContext context) { + return TabBar( + isScrollable: true, + //labelPadding: EdgeInsets.all(12.0), + labelPadding: EdgeInsets.only(top: 12.0,left: 12.0,right:12.0), + indicatorSize: TabBarIndicatorSize.label, + tabs: _allPages + .map((_Page page) => + Tab(text: page.labelId)) + .toList(), + ); + } +} + +class TabBarViewLayout extends StatelessWidget { + Widget buildTabView(BuildContext context, _Page page) { + String labelId = page.labelId; + switch (labelId) { + case '项目1': + return FirstPage(); + break; + case '项目2': + return SubPage(); + break; + case '项目3': + return SubPage(); + break; + case '项目4': + return SubPage(); + break; + default: + return Container(); + break; + } + } + + @override + Widget build(BuildContext context) { + print("TabBarViewLayout build......."); + return TabBarView( + children: _allPages.map((_Page page) { + return buildTabView(context, page); + }).toList()); + } +} diff --git a/lib/views/first_page/search_page.dart b/lib/views/first_page/search_page.dart new file mode 100644 index 00000000..6d519738 --- /dev/null +++ b/lib/views/first_page/search_page.dart @@ -0,0 +1,189 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter/cupertino.dart'; +import 'dart:ui'; +import 'dart:async'; +import 'package:flutter_go/blocs/industry_main.dart' as Industry; +import 'package:flutter_go/blocs/industry_event.dart'; +import 'package:flutter_go/routers/application.dart'; +import 'package:flutter_go/routers/routers.dart'; + +final _industryPage = Industry.IndustryPage(itemTitle: (state){ + return ListView.builder( + itemBuilder: (BuildContext context, int index) { + return ListTile( + dense: true, + leading: Icon( + Icons.bookmark_border, + size: 32, + ), + title: Text( + state.res[index].title, + overflow: TextOverflow.ellipsis, + ), + subtitle: Text(state.res[index].source), + onTap: () { + // 在这里对选中的结果进行解析,因为我目前是用golang实现的,所以就没贴代码了。 + print(state.res[index].source); + final itemTitle = state.res[index].title; + final itemUrl = state.res[index].source; + Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent(itemTitle)}&url=${Uri.encodeComponent(itemUrl)}'); + }, + ); + }, + itemCount: state.res.length, + ); +}); + +final suggestion = Industry.suggestion; +final searchBarPage = SearchBarPage(); + +class SearchPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + /// print('suggestion::${Industry.suggestion}'); + return Scaffold( + appBar: PreferredSize( + preferredSize: Size(double.infinity, 52), // 44 is the height + child: AppBar(title: searchBarPage) + ), + //body: ProgressView(), + body: _industryPage, + floatingActionButton: FloatingActionButton( + child: const Icon(Icons.search), + onPressed: () { + //print('searchBarPage=====>${controller.text}'); + //print('searchBarPage=====>${that.getResultsDebounced}'); + if(that is _SearchBarPageState && that.getResultsDebounced is Function && controller.text is String ) { + that.getResultsDebounced(controller.text); + } + }, + ), + ); + } +} + +/// 加载loading +class ProgressView extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Center( + child: SizedBox( + width: 24.0, + height: 24.0, + child: CircularProgressIndicator( + strokeWidth: 2.0, + ), + ), + ); + } +} + +class SearchBarPage extends StatefulWidget{ + @override + State createState() => _SearchBarPageState(); +} + + +final TextEditingController controller = TextEditingController(); +var that; +class _SearchBarPageState extends State { + @override + void initState() { + super.initState(); + that = this; + } + + Timer _resultsTimer; + bool _loading = false; + String oldKey; + /// 防抖函数 + Future getResultsDebounced(String text) async { + if(oldKey == text){ + print('请求内容重复'); + return; + } + if (text == '' || !mounted) { + return; + } + _loading = true; + if (_resultsTimer != null && _resultsTimer.isActive) { + _resultsTimer.cancel(); + } + _resultsTimer = new Timer(new Duration(milliseconds: 400), () async { + _loading = true; + if(mounted){ + suggestion.dispatch(SuggestionFetch(query: text)); + } + oldKey = text; + }); + } + + + void onSearchTextChanged(String text){ + print('onSearchTextChanged:${text}'); + //suggestion.dispatch(SuggestionFetch(query: text)); + getResultsDebounced(text); + } + + @override + void dispose() { + print('dispose'); + suggestion.dispatch(SuggestionClearFetch()); + //controller.dispose(); + super.dispose(); + } + + + Widget build(BuildContext context) { + return Container( + color: Theme.of(context).primaryColor, + //color: Colors.amber, + child: Padding( + //padding: EdgeInsets.only(top: MediaQueryData.fromWindow(window).padding.top,), + padding: EdgeInsets.all(0.0), + child: Container( + //height: 162.0, + child: Padding( + padding: const EdgeInsets.all(6.0), + child: Card( + child: Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(width: 5.0,), + Icon(Icons.search, color: Colors.grey,size: 18.0,), + Expanded( + child: Container( + alignment: Alignment.center, + child: TextField( + controller: controller, + decoration: InputDecoration( + contentPadding: EdgeInsets.only(top: 0.0), + hintText: '搜索全局flutter知识库', + hintStyle:TextStyle(fontSize: 12.0), + border: InputBorder.none + ), + onChanged: onSearchTextChanged, + ), + ), + ), + IconButton( + icon: Icon(Icons.cancel), + color: Colors.grey, + iconSize: 18.0, + onPressed: () { + controller.clear(); + // onSearchTextChanged(''); + }, + ), + ], + ), + ) + ) + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/first_page/sub_page.dart b/lib/views/first_page/sub_page.dart new file mode 100644 index 00000000..387b55bf --- /dev/null +++ b/lib/views/first_page/sub_page.dart @@ -0,0 +1,125 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import 'package:flutter_go/components/list_view_item.dart'; +import 'package:flutter_go/components/list_refresh.dart' as listComp; +import 'package:flutter_go/components/pagination.dart'; +import 'package:flutter_go/views/first_page/first_page_item.dart'; +import 'package:flutter_go/components/disclaimer_msg.dart'; +import 'package:flutter_go/utils/net_utils.dart'; + +// ValueKey key; + +class SubPage extends StatefulWidget { + @override + SubPageState createState() => SubPageState(); +} + +class SubPageState extends State with AutomaticKeepAliveClientMixin{ + Future _prefs = SharedPreferences.getInstance(); + Future _unKnow; + GlobalKey key; + + @override + bool get wantKeepAlive => true; + + + @override + void initState() { + super.initState(); + if (key == null) { + key = GlobalKey(); + // key = const Key('__RIKEY1__'); + //获取sharePre + _unKnow = _prefs.then((SharedPreferences prefs) { + return (prefs.getBool('disclaimer::Boolean') ?? false); + }); + + /// 判断是否需要弹出免责声明,已经勾选过不在显示,就不会主动弹 + _unKnow.then((bool value) { + new Future.delayed(const Duration(seconds: 1),(){ + if (!value && key.currentState is DisclaimerMsgState && key.currentState.showAlertDialog is Function) { + key.currentState.showAlertDialog(context); + } + }); + }); + } + } + + + Future getIndexListData([Map params]) async { + const juejin_flutter = 'https://timeline-merger-ms.juejin.im/v1/get_tag_entry?src=web&tagId=5a96291f6fb9a0535b535438'; + var pageIndex = (params is Map) ? params['pageIndex'] : 0; + final _param = {'page':pageIndex,'pageSize':20,'sort':'rankIndex'}; + var responseList = []; + var pageTotal = 0; + + try{ + var response = await NetUtils.get(juejin_flutter, params: _param); + responseList = response['d']['entrylist']; + pageTotal = response['d']['total']; + if (!(pageTotal is int) || pageTotal <= 0) { + pageTotal = 0; + } + }catch(e){ + + } + pageIndex += 1; + List resultList = new List(); + for (int i = 0; i < responseList.length; i++) { + try { + FirstPageItem cellData = new FirstPageItem.fromJson(responseList[i]); + resultList.add(cellData); + } catch (e) { + // No specified type, handles all + } + } + Map result = {"list":resultList, 'total':pageTotal, 'pageIndex':pageIndex}; + return result; + } + + Widget makeCard(index,item){ + + var myTitle = '${item.title}'; + var myUsername = '${'👲'}: ${item.username} '; + var codeUrl = '${item.detailUrl}'; + return new ListViewItem(itemUrl:codeUrl,itemTitle: myTitle,data: myUsername,); + } + + headerView(){ + return + Column( + children: [ + Stack( + //alignment: const FractionalOffset(0.9, 0.1),//方法一 + children: [ + Pagination(), + Positioned(//方法二 + top: 10.0, + left: 0.0, + child: DisclaimerMsg(key:key,pWidget:this) + ), + ]), + SizedBox(height: 1, child:Container(color: Theme.of(context).primaryColor)), + SizedBox(height: 10), + ], + ); + + } + + @override + Widget build(BuildContext context) { + super.build(context); + return new Column( + children: [ + new Expanded( + child: listComp.ListRefresh(getIndexListData,makeCard) + ) + ] + ); + } +} + + diff --git a/lib/views/fourth_page.dart b/lib/views/fourth_page.dart deleted file mode 100644 index 0aa96e35..00000000 --- a/lib/views/fourth_page.dart +++ /dev/null @@ -1,118 +0,0 @@ - -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/fourth_page_feature/page_dragger.dart'; -import 'package:flutter_go/components/fourth_page_feature/page_reveal.dart'; -import 'package:flutter_go/components/fourth_page_feature/pager_indicator.dart'; -import 'package:flutter_go/components/fourth_page_feature/pages.dart'; - -import '../components/comp_list.dart'; - -class FourthPage extends StatefulWidget { - @override - FourthPageState createState() => new FourthPageState(); -} - -class FourthPageState extends State with TickerProviderStateMixin { - - StreamController slideUpdateStream; - AnimatedPageDragger animatedPageDragger; - - int activeIndex = 0 ; - SlideDirection slideDirection = SlideDirection.none; - int nextPageIndex = 0 ; - double slidePercent= 0.0; - - FourthPageState(){ - slideUpdateStream = new StreamController(); - - slideUpdateStream.stream.listen((SlideUpdate event){ - setState(() { - if( event.updateType == UpdateType.dragging){ - slideDirection = event.direction; - slidePercent = event.slidePercent; - - if( slideDirection == SlideDirection.leftToRight ){ - nextPageIndex = activeIndex - 1; - } else if (slideDirection == SlideDirection.rightToLeft){ - nextPageIndex = activeIndex + 1; - } else{ - nextPageIndex = activeIndex; - } - } else if( event.updateType == UpdateType.doneDragging){ - if(slidePercent > 0.5){ - - animatedPageDragger = new AnimatedPageDragger( - slideDirection: slideDirection, - transitionGoal: TransitionGoal.open, - slidePercent: slidePercent, - slideUpdateStream: slideUpdateStream, - vsync: this, - ); - - } else{ - animatedPageDragger = new AnimatedPageDragger( - slideDirection: slideDirection, - transitionGoal: TransitionGoal.close, - slidePercent: slidePercent, - slideUpdateStream: slideUpdateStream, - vsync: this, - ); - - nextPageIndex = activeIndex; - } - - animatedPageDragger.run(); - } - else if( event.updateType == UpdateType.animating){ - slideDirection = event.direction; - slidePercent = event.slidePercent; - } - - else if (event.updateType == UpdateType.doneAnimating){ - activeIndex = nextPageIndex; - - slideDirection = SlideDirection.none; - slidePercent = 0.0; - - animatedPageDragger.dispose(); - } - }); - }); - - - } - - @override - Widget build(BuildContext context) { - return new Stack( - children: [ - new Page( // page 的主要内容 - viewModel: pages[activeIndex], - percentVisible: 1.0 , - ), - new PageReveal( - revealPercent: slidePercent, - child: new Page( - viewModel: pages[nextPageIndex], - percentVisible: slidePercent , - ), - ), - new PagerIndicator( - viewModel: new PagerIndicatorViewModel( - pages, - activeIndex, - slideDirection, - slidePercent, - ), - ), - new PageDragger( - canDragLeftToRight: activeIndex > 0 , - canDragRightToLeft: activeIndex < pages.length - 1 , - slideUpdateStream: this.slideUpdateStream, - ) - ], - ); - } -} diff --git a/lib/views/home.dart b/lib/views/home.dart new file mode 100644 index 00000000..59dbd737 --- /dev/null +++ b/lib/views/home.dart @@ -0,0 +1,145 @@ +/// Created with Android Studio. +/// User: 三帆 +/// Date: 16/01/2019 +/// Time: 11:16 +/// email: sanfan.hx@alibaba-inc.com +/// target: app首页 + +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_go/utils/shared_preferences.dart'; +import 'package:flutter_go/views/first_page/first_page.dart'; +import 'package:flutter_go/views/widget_page/widget_page.dart'; +import 'package:flutter_go/views/welcome_page/fourth_page.dart'; +import 'package:flutter_go/views/collection_page/collection_page.dart'; +import 'package:flutter_go/routers/application.dart'; +import 'package:flutter_go/utils/provider.dart'; +import 'package:flutter_go/model/widget.dart'; +import 'package:flutter_go/widgets/index.dart'; +import 'package:flutter_go/components/search_input.dart'; +import 'package:flutter_go/model/search_history.dart'; +import 'package:flutter_go/resources/widget_name_to_icon.dart'; + +const int ThemeColor = 0xFFC91B3A; + +class AppPage extends StatefulWidget { + @override + State createState() { + return _MyHomePageState(); + } +} + +class _MyHomePageState extends State + with SingleTickerProviderStateMixin { + SpUtil sp; + WidgetControlModel widgetControl = new WidgetControlModel(); + SearchHistoryList searchHistoryList; + bool isSearch = false; + String appBarTitle = tabData[0]['text']; + List list = List(); + int _currentIndex = 0; + static List tabData = [ + {'text': '业界动态', 'icon': Icon(Icons.language)}, + {'text': 'WIDGET', 'icon': Icon(Icons.extension)}, + {'text': '组件收藏', 'icon': Icon(Icons.favorite)}, + {'text': '关于手册', 'icon': Icon(Icons.import_contacts)} + ]; + + List myTabs = []; + + @override + void initState() { + super.initState(); + initSearchHistory(); + for (int i = 0; i < tabData.length; i++) { + myTabs.add(BottomNavigationBarItem( + icon: tabData[i]['icon'], + title: Text( + tabData[i]['text'], + ), + )); + } + list + ..add(FirstPage()) + ..add(WidgetPage(Provider.db)) + ..add(CollectionPage()) + ..add(FourthPage()); + } + + @override + void dispose() { + super.dispose(); + } + + initSearchHistory() async { + sp = await SpUtil.getInstance(); + String json = sp.getString(SharedPreferencesKeys.searchHistory); + print("json $json"); + searchHistoryList = SearchHistoryList.fromJSON(json); + } + + void onWidgetTap(WidgetPoint widgetPoint, BuildContext context) { + List widgetDemosList = new WidgetDemoList().getDemos(); + String targetName = widgetPoint.name; + String targetRouter = '/category/error/404'; + widgetDemosList.forEach((item) { + if (item.name == targetName) { + targetRouter = item.routerName; + } + }); + searchHistoryList + .add(SearchHistory(name: targetName, targetRouter: targetRouter)); + print("searchHistoryList1 ${searchHistoryList.toString()}"); + print("searchHistoryList2 ${targetRouter}"); + print("searchHistoryList3 ${widgetPoint.name}"); + Application.router.navigateTo(context, "$targetRouter"); + } + + Widget buildSearchInput(BuildContext context) { + return new SearchInput((value) async { + if (value != '') { + List list = await widgetControl.search(value); + return list + .map((item) => new MaterialSearchResult( + value: item.name, + icon: WidgetName2Icon.icons[item.name] ?? null, + text: 'widget', + onTap: () { + onWidgetTap(item, context); + }, + )) + .toList(); + } else { + return null; + } + }, (value) {}, () {}); + } + + + @override + Widget build(BuildContext context) { + return new Scaffold( + appBar: new AppBar(title: buildSearchInput(context)), + body: list[_currentIndex], + bottomNavigationBar: BottomNavigationBar( + items: myTabs, + //高亮 被点击高亮 + currentIndex: _currentIndex, + //修改 页面 + onTap: _ItemTapped, + //shifting :按钮点击移动效果 + //fixed:固定 + type: BottomNavigationBarType.fixed, + + fixedColor: Color(0xFFC91B3A), + ), + ); + } + + void _ItemTapped(int index) { + setState(() { + _currentIndex = index; + appBarTitle = tabData[index]['text']; + }); + } +} diff --git a/lib/views/web_view_page.dart b/lib/views/web_view_page.dart deleted file mode 100644 index 27b0eb78..00000000 --- a/lib/views/web_view_page.dart +++ /dev/null @@ -1,120 +0,0 @@ -/* - * @Author: 一凨 - * @Date: 2019-01-14 17:44:47 - * @Last Modified by: 一凨 - * @Last Modified time: 2019-01-14 19:47:14 - */ -import 'package:flutter/material.dart'; -import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; -import '../model/collection.dart'; -import '../event/event-bus.dart'; -import '../event/event-model.dart'; -import 'package:fluttertoast/fluttertoast.dart'; - -class WebViewPage extends StatefulWidget { - final String url; - final String title; - - WebViewPage(this.url, this.title); - _WebViewPageState createState() => _WebViewPageState(); -} - -class _WebViewPageState extends State { - bool _hasCollected = false; - String _router = ''; - var _collectionIcons; - CollectionControlModel _collectionControl = new CollectionControlModel(); - - void showInSnackBar(String value) { - Fluttertoast.showToast( - msg: value, - toastLength: Toast.LENGTH_SHORT, - gravity: ToastGravity.CENTER, - timeInSecForIos: 1, - backgroundColor: Colors.grey, - textColor: Colors.white); - } - - @override - void initState() { - super.initState(); - _collectionControl.getRouterByName(widget.title.trim()).then((list) { - - list.forEach((item) { - if(widget.title.trim() == item['name']){ - _router = item['router']; - } - }); - if (mounted) { - setState(() { - _hasCollected = list.length > 0; - }); - } - }); - } - - // 点击收藏按钮 - _getCollection() { - if (_hasCollected) { - // 删除操作 - _collectionControl.deleteByName(widget.title.trim()).then((result) { - if (result > 0 && this.mounted) { - setState(() { - _hasCollected = false; - }); - showInSnackBar('已取消收藏'); - - if (ApplicationEvent.event != null) { - ApplicationEvent.event - .fire(CollectionEvent(widget.title, _router, true)); - } - return; - } - print('删除错误'); - }); - } else { - // 插入操作 - _collectionControl - .insert(Collection(name: widget.title.trim(), router: widget.url)) - .then((result) { - if (this.mounted) { - setState(() { - _hasCollected = true; - }); - - if (ApplicationEvent.event != null) { - ApplicationEvent.event - .fire(CollectionEvent(widget.title, _router, false)); - } - - showInSnackBar('收藏成功'); - } - }); - } - } - - @override - Widget build(BuildContext context) { - if (_hasCollected) { - _collectionIcons = Icons.favorite; - } else { - _collectionIcons = Icons.favorite_border; - } - return WebviewScaffold( - url: widget.url, - appBar: AppBar( - title: Text(widget.title), - actions: [ - new IconButton( - tooltip: 'goBack home', - onPressed: _getCollection, - icon: Icon(_collectionIcons,), - ), - ], - ), - withZoom: false, - withLocalStorage: true, - withJavascript: true, - ); - } -} diff --git a/lib/views/widget_page.dart b/lib/views/widget_page.dart deleted file mode 100644 index baa6666b..00000000 --- a/lib/views/widget_page.dart +++ /dev/null @@ -1,76 +0,0 @@ -/* - * @Author: 一凨 - * @Date: 2019-01-11 14:39:48 - * @Last Modified by: 一凨 - * @Last Modified time: 2019-01-11 14:40:09 - */ -import 'package:flutter/material.dart'; -import 'package:flutter_go/components/cate_card.dart'; -import '../model/cat.dart'; - -class WidgetPage extends StatefulWidget { - final db; - final CatControlModel catModel; - WidgetPage(this.db) - : catModel = new CatControlModel(), - super(); - - @override - SecondPageState createState() => new SecondPageState(catModel); -} - -class SecondPageState extends State with AutomaticKeepAliveClientMixin{ - CatControlModel catModel; - SecondPageState(this.catModel) : super(); - - TextEditingController controller; - String active = 'test'; - String data = '无'; - - List categories = []; - - @override - bool get wantKeepAlive => true; - - @override - void initState() { - super.initState(); - renderCats(); - } - - void renderCats() { - catModel.getList().then((List data) { - if (data.isNotEmpty) { - setState(() { - categories = data; - }); - } - }); - } - - Widget buildGrid() { - // 存放最后的widget - List tiles = []; - for (Cat item in categories) { - tiles.add(new CateCard(category: item)); - } - return new ListView( - children: tiles, - ); - } - - @override - Widget build(BuildContext context) { - super.build(context); - if (categories.length == 0) { - return ListView( - children: [new Container()], - ); - } - return Container( - color: Theme.of(context).backgroundColor, - child: this.buildGrid(), - ); - } - -} diff --git a/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart b/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart index fa2f6d26..5e5d9eaf 100644 --- a/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart +++ b/lib/widgets/components/Bar/FlexibleSpaceBar/demo.dart @@ -20,8 +20,8 @@ class _FlexibleSpaceBarFullDefault extends State { @override Widget build(BuildContext context) { return FlexibleSpaceBar( - // ... // 如果没有,就是不需要有状态的 StatefulWidget - ); + // ... // 如果没有,就是不需要有状态的 StatefulWidget + ); } } @@ -30,8 +30,7 @@ class FlexibleSpaceBarLessDefault extends StatelessWidget { final widget; final parent; - const FlexibleSpaceBarLessDefault([this.widget, this.parent]) - : super(); + const FlexibleSpaceBarLessDefault([this.widget, this.parent]) : super(); @override Widget build(BuildContext context) { @@ -39,7 +38,8 @@ class FlexibleSpaceBarLessDefault extends StatelessWidget { height: 300.0, child: Scaffold( body: NestedScrollView( - headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { return [ SliverAppBar( expandedHeight: 150.0, @@ -55,6 +55,13 @@ class FlexibleSpaceBarLessDefault extends StatelessWidget { background: Image.network( "https://images.pexels.com/photos/396547/pexels-photo-396547.jpeg?auto=compress&cs=tinysrgb&h=350", fit: BoxFit.cover, + + /// 色彩叠加 UI可以理解为两个色彩涂层,在图片混合一个色层 + // color: Colors.redAccent, //混合的颜色 + // colorBlendMode: BlendMode.darken, //混合方式 + + ///图片重复填充容器 + // repeat: ImageRepeat.repeat, )), ), ]; @@ -63,6 +70,6 @@ class FlexibleSpaceBarLessDefault extends StatelessWidget { child: Text("向上提拉 ⬆ 查看效果..."), ), ), - ) - ); -}} \ No newline at end of file + )); + } +} diff --git a/lib/widgets/components/Chip/inputChip/demo.dart b/lib/widgets/components/Chip/InputChip/demo.dart similarity index 100% rename from lib/widgets/components/Chip/inputChip/demo.dart rename to lib/widgets/components/Chip/InputChip/demo.dart diff --git a/lib/widgets/components/Chip/inputChip/index.dart b/lib/widgets/components/Chip/InputChip/index.dart similarity index 100% rename from lib/widgets/components/Chip/inputChip/index.dart rename to lib/widgets/components/Chip/InputChip/index.dart diff --git a/lib/widgets/components/Grid/GridView/demo.dart b/lib/widgets/components/Grid/GridView/demo.dart index a7bbeb16..6246c433 100644 --- a/lib/widgets/components/Grid/GridView/demo.dart +++ b/lib/widgets/components/Grid/GridView/demo.dart @@ -13,7 +13,6 @@ class GridTileDemo extends StatefulWidget { class _Demo extends State { - Widget build(BuildContext context) { return Container( height: 400, @@ -55,3 +54,34 @@ class _Demo extends State { ); } } + + +class GridViewDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Container( + height: 200, + color: Color(0xffc91b3a), + child: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + ///列数 + crossAxisCount: 3, + ///列间距 + mainAxisSpacing: 10.0, + ///横轴距离 + crossAxisSpacing: 4.0, + ///缩放比例 + childAspectRatio: 1.3,), + padding: const EdgeInsets.only(left: 10,right: 10,top: 10), + children: [ + Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + Image.network('https://flutter.io/assets/homepage/news-2-599aefd56e8aa903ded69500ef4102cdd8f988dab8d9e4d570de18bdb702ffd4.png', scale: 1, fit: BoxFit.cover), + ],), + ); + } + +} \ No newline at end of file diff --git a/lib/widgets/components/Grid/GridView/index.dart b/lib/widgets/components/Grid/GridView/index.dart index 0f8beb0d..d00925e9 100644 --- a/lib/widgets/components/Grid/GridView/index.dart +++ b/lib/widgets/components/Grid/GridView/index.dart @@ -49,6 +49,13 @@ const String _Text0 = """ - GridView.extent """; +const Text1=""" +### +> SliverGridDelegateWithFixedCrossAxisCount + +gridDelegate: SliverGridDelegateWithFixedCrossAxisCount,实现网格 +"""; + class Demo extends StatefulWidget { @@ -68,8 +75,10 @@ class _DemoState extends State { _Text0, GridTileDemo(), SizedBox( - height: 100.0, - ) + height: 10.0, + ), + Text1, + GridViewDemo(), ], docUrl: 'https://docs.flutter.io/flutter/material/GridView-class.html', ); diff --git a/lib/widgets/components/LIst/AnimatedList/demo.dart b/lib/widgets/components/List/AnimatedList/demo.dart similarity index 100% rename from lib/widgets/components/LIst/AnimatedList/demo.dart rename to lib/widgets/components/List/AnimatedList/demo.dart diff --git a/lib/widgets/components/LIst/AnimatedList/index.dart b/lib/widgets/components/List/AnimatedList/index.dart similarity index 100% rename from lib/widgets/components/LIst/AnimatedList/index.dart rename to lib/widgets/components/List/AnimatedList/index.dart diff --git a/lib/widgets/components/LIst/AnimatedList/model.dart b/lib/widgets/components/List/AnimatedList/model.dart similarity index 100% rename from lib/widgets/components/LIst/AnimatedList/model.dart rename to lib/widgets/components/List/AnimatedList/model.dart diff --git a/lib/widgets/components/LIst/ListBody/demo.dart b/lib/widgets/components/List/ListBody/demo.dart similarity index 100% rename from lib/widgets/components/LIst/ListBody/demo.dart rename to lib/widgets/components/List/ListBody/demo.dart diff --git a/lib/widgets/components/LIst/ListBody/index.dart b/lib/widgets/components/List/ListBody/index.dart similarity index 100% rename from lib/widgets/components/LIst/ListBody/index.dart rename to lib/widgets/components/List/ListBody/index.dart diff --git a/lib/widgets/components/LIst/ListView/demo.dart b/lib/widgets/components/List/ListView/demo.dart similarity index 100% rename from lib/widgets/components/LIst/ListView/demo.dart rename to lib/widgets/components/List/ListView/demo.dart diff --git a/lib/widgets/components/LIst/ListView/index.dart b/lib/widgets/components/List/ListView/index.dart similarity index 100% rename from lib/widgets/components/LIst/ListView/index.dart rename to lib/widgets/components/List/ListView/index.dart diff --git a/lib/widgets/components/LIst/index.dart b/lib/widgets/components/List/index.dart similarity index 100% rename from lib/widgets/components/LIst/index.dart rename to lib/widgets/components/List/index.dart diff --git a/lib/widgets/elements/Frame/Box/DecoratedBox/demo.dart b/lib/widgets/elements/Frame/Box/DecoratedBox/demo.dart index bf4bf0fd..5767d525 100644 --- a/lib/widgets/elements/Frame/Box/DecoratedBox/demo.dart +++ b/lib/widgets/elements/Frame/Box/DecoratedBox/demo.dart @@ -1,8 +1,16 @@ +<<<<<<< HEAD /// Author: xiaojia.dxj /// Date: 2018/11/22 /// Email: xiaojia.dxj@alibaba-inc.com /// LastUpdateTime: 2018/11/22 /// LastUpdateBy: xj.deng +======= +/// Author: xiaojia.dxj +/// Date: 2018/11/22 +/// Email: xiaojia.dxj@alibaba-inc.com +/// LastUpdateTime: 2018/11/22 +/// LastUpdateBy: xj.deng +>>>>>>> develop import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; @@ -19,8 +27,15 @@ class DecoratedBoxCreate extends StatelessWidget { decoration: BoxDecoration( color: const Color(0xff7c94b6), //设置图片内容 +<<<<<<< HEAD image: DecorationImage( fit: BoxFit.cover, +======= + image: DecorationImage( + ///fix:BoxFit.contain: 保持图片的比例,最大程度填充容器 BoxFit.fill:容器被图片完全填充,不在意图片比例,只填充整个容器 + ///fix:BoxFit.fitWidth:图片以宽被完全填充 BoxFit.fix:fixHigth:图片以高度完全填充 + fit: BoxFit.cover, //图片填充整个容器,按比例放大,多余部分被裁切 +>>>>>>> develop image: ExactAssetImage('assets/images/food01.jpeg')), //外宽边框,可以不设置 border: Border.all( @@ -44,7 +59,11 @@ class DecoratedBoxCreateTwo extends StatelessWidget { decoration: BoxDecoration( color: const Color(0xff7c94b6), //设置图片内容 +<<<<<<< HEAD image: DecorationImage( +======= + image: DecorationImage( +>>>>>>> develop fit: BoxFit.cover, image: ExactAssetImage('assets/images/food01.jpeg')), //根据传入的不同大小,呈现图片效弧度不同, @@ -65,7 +84,11 @@ class DecoratedBoxCreateShape extends StatelessWidget { position: DecorationPosition.background, decoration: BoxDecoration( color: const Color(0xff7c94b6), +<<<<<<< HEAD image: DecorationImage( +======= + image: DecorationImage( +>>>>>>> develop fit: BoxFit.cover, image: ExactAssetImage('assets/images/food01.jpeg')), border: Border.all( @@ -77,3 +100,27 @@ class DecoratedBoxCreateShape extends StatelessWidget { ); } } + +class DecoratedBoxCreateShapes extends StatelessWidget { + DecoratedBoxCreateShapes({ + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return DecoratedBox( + position: DecorationPosition.background, + decoration: BoxDecoration( + gradient: const LinearGradient( + //渐变效果 线性渐变 + colors: [Colors.red, Colors.yellowAccent, Colors.lightGreenAccent]), +// color: const Color(0xff7c94b6), + border: Border.all( + color: Colors.blue.shade50, + width: 5.0, + ), + shape: BoxShape.circle, + ), + ); + } +} diff --git a/lib/widgets/elements/Frame/Box/DecoratedBox/index.dart b/lib/widgets/elements/Frame/Box/DecoratedBox/index.dart index 66ab7701..8b25b7a4 100644 --- a/lib/widgets/elements/Frame/Box/DecoratedBox/index.dart +++ b/lib/widgets/elements/Frame/Box/DecoratedBox/index.dart @@ -1,7 +1,13 @@ ///Author: xiaojia.dxj +<<<<<<< HEAD ///Date: 2019-01-08 15:56:49 ///Last Modified by: xiaojia.dxj ///Last Modified time: 2019-01-08 15:56:49 +======= +///Date: 2019-01-08 15:56:49 +///Last Modified by: xiaojia.dxj +///Last Modified time: 2019-01-08 15:56:49 +>>>>>>> develop ///email: xiaojia.dxj@alibaba-inc.com import 'package:flutter/material.dart'; @@ -46,7 +52,11 @@ class _DemoState extends State { } Column _decoratedBoxCreate() { +<<<<<<< HEAD return Column( +======= + return Column( +>>>>>>> develop children: [ Container( height: 100.0, @@ -68,6 +78,14 @@ class _DemoState extends State { height: 100.0, width: 100.0, child: DecoratedBoxCreateShape(), + ), + SizedBox( + height: 10.0, + ), + Container( + height: 100.0, + width: 100.0, + child: DecoratedBoxCreateShapes(), ) ], ); diff --git a/lib/widgets/elements/Frame/Box/Fittedbox/demo.dart b/lib/widgets/elements/Frame/Box/FittedBox/demo.dart similarity index 100% rename from lib/widgets/elements/Frame/Box/Fittedbox/demo.dart rename to lib/widgets/elements/Frame/Box/FittedBox/demo.dart diff --git a/lib/widgets/elements/Frame/Box/Fittedbox/index.dart b/lib/widgets/elements/Frame/Box/FittedBox/index.dart similarity index 100% rename from lib/widgets/elements/Frame/Box/Fittedbox/index.dart rename to lib/widgets/elements/Frame/Box/FittedBox/index.dart diff --git a/lib/widgets/elements/Frame/Box/RenderBox/demo.dart b/lib/widgets/elements/Frame/Box/RenderBox/demo.dart deleted file mode 100644 index 9c1a7565..00000000 --- a/lib/widgets/elements/Frame/Box/RenderBox/demo.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:flutter/material.dart'; - -class RenderBoxDemo extends StatefulWidget { - _RenderBoxDemoState createState() => _RenderBoxDemoState(); -} - -class _RenderBoxDemoState extends State { - @override - Widget build(BuildContext context) { - return Container( - // child: RenderFoo(), - ); - } -} - -class RenderFoo extends RenderBox { - @override - bool get hasSize => super.hasSize; - - @override - BoxConstraints get constraints => super.constraints; -} diff --git a/lib/widgets/elements/Frame/Box/RenderBox/index.dart b/lib/widgets/elements/Frame/Box/RenderBox/index.dart deleted file mode 100644 index df740656..00000000 --- a/lib/widgets/elements/Frame/Box/RenderBox/index.dart +++ /dev/null @@ -1,62 +0,0 @@ -/* - * @Author: xiaojia.dxj - * @Date: 2019-01-08 15:56:26 - * @Last Modified by: xiaojia.dxj - * @Last Modified time: 2019-01-08 15:56:26 - */ -import 'package:flutter/material.dart'; -import '../../../../../common/widget_demo.dart'; - -const String _Text = ''' -### **简介** -> BoxConstraints为抽象类,我们可以使用BoxConstraints,一个不可边的约束布局,renderBox布局 -- 一个尺寸尊重一个BoxConstraints,当且仅当,以下关系式的成立: -minWidth <= Size.width <= maxWidth -minHeight <= Size.height <= maxHeight -约束本身必须满足这些关系: - -0.0 <= minWidth <= maxWidth <= double.infinity -0.0 <= minHeight <= maxHeight <= double.infinity -double.infinity是每个约束的合法值。 -'''; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/RenderBox'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'Table', - codeUrl: 'elements/Frame/Box/RenderBox/demo.dart', - contentList: [ - _Text, - _sizeBoxCreate(), - ], - docUrl: 'https://docs.flutter.io/flutter/widgets/RenderBox-class.html', - ); - } - - Column _sizeBoxCreate() { - return new Column( - children: [ - /** - * Immutable layout constraints for RenderBox layout. - */ - SizedBox( - width: 900.0, - height: 50.0, - child: const Card( - child: Text( - 'SizedBox', - textAlign: TextAlign.center, - ), - color: Color(0xFFEF5350)), - ), - ], - ); - } -} diff --git a/lib/widgets/elements/Frame/Box/TextBox/demo.dart b/lib/widgets/elements/Frame/Box/TextBox/demo.dart deleted file mode 100644 index 8b137891..00000000 --- a/lib/widgets/elements/Frame/Box/TextBox/demo.dart +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lib/widgets/elements/Frame/Box/TextBox/index.dart b/lib/widgets/elements/Frame/Box/TextBox/index.dart deleted file mode 100644 index cc48e960..00000000 --- a/lib/widgets/elements/Frame/Box/TextBox/index.dart +++ /dev/null @@ -1,49 +0,0 @@ -import 'package:flutter/material.dart'; -import '../../../../../common/widget_demo.dart'; - -const String _Text = """### **TextBox简介** -> 是一个包含一段文本的矩形 -- 它与rect类似,不过包含一个固定的TextDirection。 -- sizebox的width,heigh为null,child自身设置 -### **属性** -> width:宽 -> height:高 -- ex:200*50 sizebox -"""; - -class Demo extends StatefulWidget { - static const String routeName = '/element/Frame/Box/TextBox'; - - _DemoState createState() => _DemoState(); -} - -class _DemoState extends State { - @override - Widget build(BuildContext context) { - return WidgetDemo( - title: 'TextBox', - codeUrl: 'elements/Frame/Box/TextBox/demo.dart', - contentList: [ - _Text, - _creatTexbox(), - ], - docUrl: 'https://docs.flutter.io/flutter/dart-ui/TextBox-class.html', - ); - } -} - -Column _creatTexbox() { - return Column( - children: [ - // Text("TextBox ",textDirection: new TextBox.fo,), - Container( - // child: TextBox.fromLTRB(270.0, 180.0, 1360.0, 730.0,TextDirection.rtl), - - ) - -// centerSlice: new Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0), - - - ], - ); -} diff --git a/lib/widgets/elements/Frame/Layout/Row/demo.dart b/lib/widgets/elements/Frame/Layout/Row/demo.dart index 2c372d83..8ae11acf 100644 --- a/lib/widgets/elements/Frame/Layout/Row/demo.dart +++ b/lib/widgets/elements/Frame/Layout/Row/demo.dart @@ -1,4 +1,9 @@ +<<<<<<< HEAD /// Author: xiaojia.dxj +======= + import 'package:flutter/material.dart'; +/// Author: xiaojia.dxj +>>>>>>> develop /// Date: 2018/11/22 /// Email: xiaojia.dxj@alibaba-inc.com /// LastUpdateTime: 2018/11/22 @@ -92,3 +97,34 @@ class RowLayoutCreate extends StatelessWidget { ); } } + +class RowExpanded extends StatelessWidget{ + @override + Widget build(BuildContext context) { + + return Row( + children: [ + ////填充数据 + Expanded(child: new RaisedButton( + onPressed: (){ + }, + color: Color(0xfffce4ec), + child:new Text('flutter',style: TextStyle(color: Colors.white),) + ),), + Expanded(child: new RaisedButton( + onPressed: (){ + }, + color: Color(0xfff8bbd0), + child:new Text('Expanded',style: TextStyle(color: Colors.white),) + ),), + Expanded(child: new RaisedButton( + onPressed: (){ + }, + color: Color(0xfff48fb1), + child:new Text('flutter',style: TextStyle(color: Colors.white),) + ),), + ], + ); + } + +} diff --git a/lib/widgets/elements/Frame/Layout/Row/index.dart b/lib/widgets/elements/Frame/Layout/Row/index.dart index fa8e7b34..4ebb6f8f 100644 --- a/lib/widgets/elements/Frame/Layout/Row/index.dart +++ b/lib/widgets/elements/Frame/Layout/Row/index.dart @@ -60,6 +60,8 @@ class _DemoState extends State { return Column( children: [ RowLayoutCreate(), + SizedBox(height: 10.0,), + RowExpanded(), Row( children: [ Expanded( diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 00000000..33eb9622 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,308 @@ +# Generated by pub +# See https://www.dartlang.org/tools/pub/glossary#lockfile +packages: + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.1" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" + bloc: + dependency: "direct main" + description: + name: bloc + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + city_pickers: + dependency: "direct main" + description: + name: city_pickers + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.11" + cookie_jar: + dependency: transitive + description: + name: cookie_jar + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.8" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" + dio: + dependency: "direct main" + description: + name: dio + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.17" + event_bus: + dependency: "direct main" + description: + name: event_bus + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + firebase_analytics: + dependency: "direct main" + description: + name: firebase_analytics + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0+1" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.4" + fluro: + dependency: "direct main" + description: + name: fluro + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_bloc: + dependency: "direct main" + description: + name: flutter_bloc + url: "https://pub.dartlang.org" + source: hosted + version: "0.11.1" + flutter_markdown: + dependency: "direct main" + description: + name: flutter_markdown + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_webview_plugin: + dependency: "direct main" + description: + name: flutter_webview_plugin + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.4" + html: + dependency: "direct main" + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0+2" + image_picker: + dependency: "direct main" + description: + name: image_picker + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.0+1" + intl: + dependency: "direct main" + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.15.7" + lpinyin: + dependency: transitive + description: + name: lpinyin + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.7" + markdown: + dependency: transitive + description: + name: markdown + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.3" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.3+1" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.2" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + rxdart: + dependency: transitive + description: + name: rxdart + url: "https://pub.dartlang.org" + source: hosted + version: "0.21.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.3" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.4" + sqflite: + dependency: "direct main" + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.5" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.8" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.2" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "5.0.2" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" +sdks: + dart: ">=2.1.0 <3.0.0" + flutter: ">=1.2.1 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 1d47ed4c..a0277605 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,11 @@ description: flutter_go # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. # Read more about versioning at semver.org. +<<<<<<< HEAD version: 0.0.5 +======= +version: 1.0.0 +>>>>>>> develop environment: sdk: ">=2.0.0-dev.68.0 <3.0.0" @@ -21,9 +25,10 @@ dependencies: cupertino_icons: ^0.1.2 event_bus: ^1.0.1 fluro: ^1.3.4 - image_picker: ^0.4.10 - sqflite: ^0.12.1 + image_picker: ^0.6.0+1 + sqflite: ^1.1.5 flutter_markdown: ^0.2.0 +<<<<<<< HEAD url_launcher: ^4.0.1 # 本地存储、收藏功能 shared_preferences: ^0.4.3 @@ -32,6 +37,22 @@ dependencies: # 日期格式化 intl: 0.15.7 city_pickers: ^0.1.0 +======= + url_launcher: ^5.0.2 + # 本地存储、收藏功能 + shared_preferences: ^0.4.3 + dio: ^1.0.6 + flutter_webview_plugin: ^0.3.4 + # 日期格式化 + intl: 0.15.7 + city_pickers: ^0.0.1 + firebase_analytics: ^1.1.0 + #firebase_auth: ^0.8.3 #auth + firebase_core: ^0.3.4 # add dependency for Firebase Core + flutter_bloc: ^0.11.1 + bloc: ^0.12.0 + html: ^0.14.0+2 +>>>>>>> develop dev_dependencies: flutter_test: diff --git a/recruit b/recruit new file mode 100644 index 00000000..f173ce63 --- /dev/null +++ b/recruit @@ -0,0 +1,29 @@ + +--- + +## 加个广告:团队招聘 + + ### 🔥《阿里巴巴集团春季校园招聘》已经启动。 + +- 团队获取此消息后第一时间,赶紧通知,各位刚走出校园的千里马,走进阿里的机会来了!!! + + 基本要求如下: + + - 招收 2019年11月-2020年10月 毕业的同学 + - 本次校招行动共执行四周,到 4月12日结束 + +#### 🔔强调一下这次是校招哦!!!如果你有意向,又符合 2019年11月-2020年10月 的应届毕业生条件; + +- 不符合,也没关系,可以推荐优秀的学弟,学妹;增进一下“纯洁”的同学感情 👫😎。 + +#### 请移步往下,关注我们《阿里拍卖团队》 的招聘信息。 + + + + + + + +#### 最重要的部分来了,手机扫描下面二维码,即可进入简历投递系统 + + diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb deleted file mode 100644 index 9e26dfee..00000000 --- a/res/values/strings_en.arb +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file