├── .gitignore ├── .metadata ├── README.md ├── android ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── wyz │ │ │ │ └── flutter_wyz │ │ │ │ └── MainActivity.java │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── key.properties └── settings.gradle ├── img ├── add.png ├── back.png ├── chat.png ├── ic_mic.png ├── ic_pause.png ├── ic_play.png ├── ic_stop.png ├── ic_volume_down.png ├── ic_volume_up.png ├── ld.gif ├── loading.gif ├── love.png ├── luyin.gif ├── luyin.png ├── lx.png ├── off.png ├── on.png ├── p.jpg ├── p.png ├── pp.png ├── sd.png ├── start.jpg ├── wd.png ├── yyl.png └── yyr.png ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── icon-App-20x20@1x.png │ │ ├── icon-App-20x20@2x.png │ │ ├── icon-App-20x20@3x.png │ │ ├── icon-App-29x29@1x.png │ │ ├── icon-App-29x29@2x.png │ │ ├── icon-App-29x29@3x.png │ │ ├── icon-App-40x40@1x.png │ │ ├── icon-App-40x40@2x.png │ │ ├── icon-App-40x40@3x.png │ │ ├── icon-App-60x60@2x.png │ │ ├── icon-App-60x60@3x.png │ │ ├── icon-App-76x76@1x.png │ │ ├── icon-App-76x76@2x.png │ │ └── icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── main.m ├── lib.zip ├── lib ├── config │ ├── all_data.dart │ └── config.dart ├── main.dart ├── page │ ├── component │ │ ├── chat │ │ │ ├── chat_home.dart │ │ │ └── chat_list.dart │ │ ├── friend │ │ │ ├── friend_all.dart │ │ │ ├── friend_info.dart │ │ │ ├── friend_my.dart │ │ │ └── my_friend.dart │ │ ├── list │ │ │ └── user_list.dart │ │ ├── msg │ │ │ ├── comment_back.dart │ │ │ ├── msg_add.dart │ │ │ ├── msg_home.dart │ │ │ ├── msg_info.dart │ │ │ ├── msg_list.dart │ │ │ ├── msg_my.dart │ │ │ └── msg_my_care.dart │ │ ├── person │ │ │ ├── add_device.dart │ │ │ ├── change_autograph │ │ │ │ └── change_autograph.dart │ │ │ ├── change_back_img │ │ │ │ └── change_back_img.dart │ │ │ ├── change_head │ │ │ │ └── change_head.dart │ │ │ ├── device_hj.dart │ │ │ ├── device_info.dart │ │ │ ├── device_list.dart │ │ │ ├── head_img.dart │ │ │ ├── menu.dart │ │ │ ├── name │ │ │ │ └── change_name.dart │ │ │ └── psd │ │ │ │ └── change_password.dart │ │ └── user │ │ │ ├── add_user.dart │ │ │ ├── qrcode.dart │ │ │ └── user_info.dart │ ├── content │ │ ├── airplay_screen.dart │ │ ├── email_screen.dart │ │ ├── home_screen.dart │ │ └── pages_screen.dart │ ├── index │ │ └── index.dart │ ├── login │ │ ├── forget_password.dart │ │ ├── login.dart │ │ └── register.dart │ ├── pojo │ │ ├── chat.dart │ │ ├── comment.dart │ │ ├── device.dart │ │ ├── msg.dart │ │ └── user.dart │ ├── readme.txt │ └── version │ │ └── version.dart └── util │ ├── Toast.dart │ └── local_storage.dart ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # my ignore 2 | key.jks 3 | uploadServer.txt 4 | 5 | # Miscellaneous 6 | *.class 7 | *.log 8 | *.pyc 9 | *.swp 10 | .DS_Store 11 | .atom/ 12 | .buildlog/ 13 | .history 14 | .svn/ 15 | 16 | # IntelliJ related 17 | *.iml 18 | *.ipr 19 | *.iws 20 | .idea/ 21 | 22 | # Visual Studio Code related 23 | .vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | **/doc/api/ 27 | .dart_tool/ 28 | .flutter-plugins 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Android related 35 | **/android/**/gradle-wrapper.jar 36 | **/android/.gradle 37 | **/android/captures/ 38 | **/android/gradlew 39 | **/android/gradlew.bat 40 | **/android/local.properties 41 | **/android/**/GeneratedPluginRegistrant.java 42 | 43 | # iOS/XCode related 44 | **/ios/**/*.mode1v3 45 | **/ios/**/*.mode2v3 46 | **/ios/**/*.moved-aside 47 | **/ios/**/*.pbxuser 48 | **/ios/**/*.perspectivev3 49 | **/ios/**/*sync/ 50 | **/ios/**/.sconsign.dblite 51 | **/ios/**/.tags* 52 | **/ios/**/.vagrant/ 53 | **/ios/**/DerivedData/ 54 | **/ios/**/Icon? 55 | **/ios/**/Pods/ 56 | **/ios/**/.symlinks/ 57 | **/ios/**/profile 58 | **/ios/**/xcuserdata 59 | **/ios/.generated/ 60 | **/ios/Flutter/App.framework 61 | **/ios/Flutter/Flutter.framework 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/ServiceDefinitions.json 67 | **/ios/Runner/GeneratedPluginRegistrant.* 68 | 69 | # Exceptions to above rules. 70 | !**/ios/**/default.mode1v3 71 | !**/ios/**/default.mode2v3 72 | !**/ios/**/default.pbxuser 73 | !**/ios/**/default.perspectivev3 74 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 75 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 遥不可及 2 | 3 | flutter 社交app Updated 3 minutes ago 主要用于研究flutter常用packages,涉及到,app版本升级,权限获取,扫码,图片选择,图片上传,图片压缩,图片裁剪,图片缓存,数据缓存,http通讯。本人纯后端出身,ui别吐槽 4 | 5 | ## Getting Started 6 | 7 | 如果出现服务器数据返回慢,不要慌,毕竟后面是个1核1G1M带宽的服务器,体谅下~~
8 | 9 | 因为项目中引用了一些外部package,有些package版本上有冲突,我对这些package做了手动修改。clone下去后,跑不起来的。
10 | 项目根目录下有个lib.zip,解压后可以得到这些package,复制到自己电脑,如:D:\soft\flutter\\.pub-cache\hosted\pub.flutter-io.cn\路径下就可以了。D:\soft\flutter\为你电脑对应的flutter sdk位置。
11 | 项目版本为flutter1.2.1,如果你的flutter版本为1.5.4,chat_home中有两个方法(onLongPressDragUp,onLongPressDragStart)需要稍微修改一下。如果不想改,可以先注释掉报错代码,然后运行
12 | 13 | 语音存储用的OSS,项目中没有提供OSS的密钥。若要使用语音功能,请修改相关OSS配置为自己的OSS配置。
14 | 15 | 项目中的api都可以随便调用,如果觉得我ui不好看的,可以利用这些api自己重新写一个app。如果有什么更多的功能需求,需要新api,简单,好实现那种,可以qq联系我,815769472。加好友时说明来意。
16 | 17 | 用户系统和我另外一个app《智能管家》用的一个,那个app注册了,这里可以直接登录。
18 | - [智能管家项目地址](https://www.github.com/zocoo/znjjwyz) 19 | 20 | 安卓下载尝试请扫码
21 | ![安卓apk](https://assets-store-cdn.48lu.cn/assets-store/6f5a3202c72d3aeaecb667395432b842.png?x-oss-process=image/resize,m_lfit,h_800,w_800) 22 | 23 | 登录
24 | ![登录](https://assets-store-cdn.48lu.cn/assets-store/2af587e7fef13f3ab0189bce36357caf.jpg?x-oss-process=image/resize,m_lfit,h_800,w_800) 25 | 26 | 主页
27 | ![主页](https://assets-store-cdn.48lu.cn/assets-store/ef9601abb07b9d3a15d9e7f4994b64d7.jpg?x-oss-process=image/resize,m_lfit,h_800,w_800) 28 | 29 | 动态详情及评论
30 | ![动态详情及评论](https://assets-store-cdn.48lu.cn/assets-store/8ae35d39a12b85df946db6d2a7e1c294.jpg?x-oss-process=image/resize,m_lfit,h_800,w_800) 31 | 32 | 好友列表
33 | ![好友列表](https://assets-store-cdn.48lu.cn/assets-store/fc0fc1276fef02a2b041ea7d777e5b8f.jpg?x-oss-process=image/resize,m_lfit,h_800,w_800) 34 | 35 | 用户主页
36 | ![用户主页](https://assets-store-cdn.48lu.cn/assets-store/f1b5276baaf2b6b348dcddbba74e9ff9.jpg?x-oss-process=image/resize,m_lfit,h_800,w_800) 37 | 38 | 消息列表
39 | ![消息列表](https://assets-store-cdn.48lu.cn/assets-store/0f59ca528950e947f19ca9cb84c40cf0.jpg?x-oss-process=image/resize,m_lfit,h_800,w_800) 40 | 41 | 聊天界面
42 | ![聊天界面](https://assets-store-cdn.48lu.cn/assets-store/d6a11245be8473811a830fcda74eecd1.jpg?x-oss-process=image/resize,m_lfit,h_800,w_800) 43 | 44 | 个人中心
45 | ![个人中心](https://assets-store-cdn.48lu.cn/assets-store/07ce79ff20f93029b5064c328027da6d.jpg?x-oss-process=image/resize,m_lfit,h_800,w_800) 46 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | apply plugin: 'kotlin-android' 27 | def keystorePropertiesFile = rootProject.file("key.properties") 28 | def keystoreProperties = new Properties() 29 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 30 | android { 31 | compileSdkVersion 28 32 | 33 | lintOptions { 34 | disable 'InvalidPackage' 35 | } 36 | 37 | defaultConfig { 38 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 39 | applicationId "com.wyz.flutter_wyz" 40 | minSdkVersion 16 41 | targetSdkVersion 28 42 | versionCode flutterVersionCode.toInteger() 43 | versionName flutterVersionName 44 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 45 | manifestPlaceholders = [ 46 | JPUSH_PKGNAME : "com.wyz.flutter_wyz", 47 | JPUSH_APPKEY : "ce53da8fe966805f893421bb", // NOTE: JPush 上注册的包名对应的 Appkey. 48 | JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可. 49 | ] 50 | } 51 | signingConfigs { 52 | release { 53 | keyAlias keystoreProperties['keyAlias'] 54 | keyPassword keystoreProperties['keyPassword'] 55 | storeFile file(keystoreProperties['storeFile']) 56 | storePassword keystoreProperties['storePassword'] 57 | } 58 | } 59 | buildTypes { 60 | release { 61 | // TODO: Add your own signing config for the release build. 62 | // Signing with the debug keys for now, so `flutter run --release` works. 63 | signingConfig signingConfigs.debug 64 | } 65 | } 66 | 67 | 68 | } 69 | 70 | flutter { 71 | source '../..' 72 | } 73 | 74 | dependencies { 75 | testImplementation 'junit:junit:4.12' 76 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 77 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 78 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 79 | } 80 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 18 | 21 | 22 | 26 | 27 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 44 | 47 | 48 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/wyz/flutter_wyz/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.wyz.flutter_wyz; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | 8 | import android.view.KeyEvent; 9 | import io.flutter.plugin.common.MethodCall; 10 | import io.flutter.plugin.common.MethodChannel; 11 | public class MainActivity extends FlutterActivity { 12 | private final String CHANNEL = "android/back/desktop"; 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | GeneratedPluginRegistrant.registerWith(this); 18 | new MethodChannel(getFlutterView(), CHANNEL).setMethodCallHandler( 19 | new MethodChannel.MethodCallHandler() { 20 | @Override 21 | public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { 22 | if (methodCall.method.equals("backDesktop")) { 23 | result.success(true); 24 | moveTaskToBack(false); 25 | } 26 | } 27 | } 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 17 | 22 | 25 | 26 | 27 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | ext.kotlin_version = '1.2.51' 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | jcenter() 17 | } 18 | } 19 | 20 | rootProject.buildDir = '../build' 21 | subprojects { 22 | project.buildDir = "${rootProject.buildDir}/${project.name}" 23 | } 24 | subprojects { 25 | project.evaluationDependsOn(':app') 26 | } 27 | 28 | task clean(type: Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /android/key.properties: -------------------------------------------------------------------------------- 1 | storePassword=psoxsk4855 2 | keyPassword=psoxsk4855 3 | keyAlias=key 4 | storeFile=E:/flutterWorkSpace/flutter-app/key.jks -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /img/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/add.png -------------------------------------------------------------------------------- /img/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/back.png -------------------------------------------------------------------------------- /img/chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/chat.png -------------------------------------------------------------------------------- /img/ic_mic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/ic_mic.png -------------------------------------------------------------------------------- /img/ic_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/ic_pause.png -------------------------------------------------------------------------------- /img/ic_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/ic_play.png -------------------------------------------------------------------------------- /img/ic_stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/ic_stop.png -------------------------------------------------------------------------------- /img/ic_volume_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/ic_volume_down.png -------------------------------------------------------------------------------- /img/ic_volume_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/ic_volume_up.png -------------------------------------------------------------------------------- /img/ld.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/ld.gif -------------------------------------------------------------------------------- /img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/loading.gif -------------------------------------------------------------------------------- /img/love.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/love.png -------------------------------------------------------------------------------- /img/luyin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/luyin.gif -------------------------------------------------------------------------------- /img/luyin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/luyin.png -------------------------------------------------------------------------------- /img/lx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/lx.png -------------------------------------------------------------------------------- /img/off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/off.png -------------------------------------------------------------------------------- /img/on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/on.png -------------------------------------------------------------------------------- /img/p.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/p.jpg -------------------------------------------------------------------------------- /img/p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/p.png -------------------------------------------------------------------------------- /img/pp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/pp.png -------------------------------------------------------------------------------- /img/sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/sd.png -------------------------------------------------------------------------------- /img/start.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/start.jpg -------------------------------------------------------------------------------- /img/wd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/wd.png -------------------------------------------------------------------------------- /img/yyl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/yyl.png -------------------------------------------------------------------------------- /img/yyr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/img/yyr.png -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSCameraUsageDescription 6 | Camera permission is required for barcode scanning. 7 | CFBundleGetInfoString 8 | 9 | CFBundleDisplayName 10 | 11 | CFBundleDevelopmentRegion 12 | en 13 | CFBundleExecutable 14 | App 15 | CFBundleIdentifier 16 | io.flutter.flutter.app 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundleName 20 | App 21 | CFBundlePackageType 22 | FMWK 23 | CFBundleShortVersionString 24 | 1.0 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | 1.0 29 | MinimumOSVersion 30 | 8.0 31 | 32 | 33 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '10.3' 3 | use_frameworks! 4 | 5 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 6 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 7 | 8 | project 'Runner', { 9 | 'Debug' => :debug, 10 | 'Profile' => :release, 11 | 'Release' => :release, 12 | } 13 | 14 | def parse_KV_file(file, separator='=') 15 | file_abs_path = File.expand_path(file) 16 | if !File.exists? file_abs_path 17 | return []; 18 | end 19 | pods_ary = [] 20 | skip_line_start_symbols = ["#", "/"] 21 | File.foreach(file_abs_path) { |line| 22 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 23 | plugin = line.split(pattern=separator) 24 | if plugin.length == 2 25 | podname = plugin[0].strip() 26 | path = plugin[1].strip() 27 | podpath = File.expand_path("#{path}", file_abs_path) 28 | pods_ary.push({:name => podname, :path => podpath}); 29 | else 30 | puts "Invalid plugin specification: #{line}" 31 | end 32 | } 33 | return pods_ary 34 | end 35 | 36 | target 'Runner' do 37 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 38 | # referring to absolute paths on developers' machines. 39 | system('rm -rf .symlinks') 40 | system('mkdir -p .symlinks/plugins') 41 | 42 | # Flutter Pods 43 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 44 | if generated_xcode_build_settings.empty? 45 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 46 | end 47 | generated_xcode_build_settings.map { |p| 48 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 49 | symlink = File.join('.symlinks', 'flutter') 50 | File.symlink(File.dirname(p[:path]), symlink) 51 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 52 | end 53 | } 54 | 55 | # Plugin Pods 56 | plugin_pods = parse_KV_file('../.flutter-plugins') 57 | plugin_pods.map { |p| 58 | symlink = File.join('.symlinks', 'plugins', p[:name]) 59 | File.symlink(p[:path], symlink) 60 | pod p[:name], :path => File.join(symlink, 'ios') 61 | } 62 | end 63 | 64 | post_install do |installer| 65 | installer.pods_project.targets.each do |target| 66 | target.build_configurations.each do |config| 67 | config.build_settings['ENABLE_BITCODE'] = 'NO' 68 | end 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - barcode_scan (0.0.1): 3 | - Flutter 4 | - MTBBarcodeScanner 5 | - Flutter (1.0.0) 6 | - flutter_downloader (0.0.1): 7 | - Flutter 8 | - flutter_drag_scale (0.0.1): 9 | - Flutter 10 | - flutter_image_compress (0.0.1): 11 | - Flutter 12 | - flutter_sound (0.0.1): 13 | - Flutter 14 | - image_crop (0.0.1): 15 | - Flutter 16 | - image_picker (0.0.1): 17 | - Flutter 18 | - MTBBarcodeScanner (5.0.8) 19 | - open_file (0.0.1): 20 | - Flutter 21 | - package_info (0.0.1): 22 | - Flutter 23 | - path_provider (0.0.1): 24 | - Flutter 25 | - shared_preferences (0.0.1): 26 | - Flutter 27 | - simple_permissions (0.0.1): 28 | - Flutter 29 | - wifi (0.0.1): 30 | - Flutter 31 | 32 | DEPENDENCIES: 33 | - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) 34 | - Flutter (from `.symlinks/flutter/ios`) 35 | - flutter_downloader (from `.symlinks/plugins/flutter_downloader/ios`) 36 | - flutter_drag_scale (from `.symlinks/plugins/flutter_drag_scale/ios`) 37 | - flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`) 38 | - flutter_sound (from `.symlinks/plugins/flutter_sound/ios`) 39 | - image_crop (from `.symlinks/plugins/image_crop/ios`) 40 | - image_picker (from `.symlinks/plugins/image_picker/ios`) 41 | - open_file (from `.symlinks/plugins/open_file/ios`) 42 | - package_info (from `.symlinks/plugins/package_info/ios`) 43 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 44 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) 45 | - simple_permissions (from `.symlinks/plugins/simple_permissions/ios`) 46 | - wifi (from `.symlinks/plugins/wifi/ios`) 47 | 48 | SPEC REPOS: 49 | https://github.com/cocoapods/specs.git: 50 | - MTBBarcodeScanner 51 | 52 | EXTERNAL SOURCES: 53 | barcode_scan: 54 | :path: ".symlinks/plugins/barcode_scan/ios" 55 | Flutter: 56 | :path: ".symlinks/flutter/ios" 57 | flutter_downloader: 58 | :path: ".symlinks/plugins/flutter_downloader/ios" 59 | flutter_drag_scale: 60 | :path: ".symlinks/plugins/flutter_drag_scale/ios" 61 | flutter_image_compress: 62 | :path: ".symlinks/plugins/flutter_image_compress/ios" 63 | flutter_sound: 64 | :path: ".symlinks/plugins/flutter_sound/ios" 65 | image_crop: 66 | :path: ".symlinks/plugins/image_crop/ios" 67 | image_picker: 68 | :path: ".symlinks/plugins/image_picker/ios" 69 | open_file: 70 | :path: ".symlinks/plugins/open_file/ios" 71 | package_info: 72 | :path: ".symlinks/plugins/package_info/ios" 73 | path_provider: 74 | :path: ".symlinks/plugins/path_provider/ios" 75 | shared_preferences: 76 | :path: ".symlinks/plugins/shared_preferences/ios" 77 | simple_permissions: 78 | :path: ".symlinks/plugins/simple_permissions/ios" 79 | wifi: 80 | :path: ".symlinks/plugins/wifi/ios" 81 | 82 | SPEC CHECKSUMS: 83 | barcode_scan: 33f586d02270046fc6559135038b34b5754eaa4f 84 | Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a 85 | flutter_downloader: 058b9c41564a90500f67f3e432e3524613a7fd83 86 | flutter_drag_scale: 545fd546a1e968bd965883f0511b1c47f049f37d 87 | flutter_image_compress: c29e818cdf6e4276875601a245b6bb18eb444157 88 | flutter_sound: 0e8163ceac1e00eb6d894e2ae4641ba726a2c479 89 | image_crop: e0a67085d3ebf3cf46ca46d61c53a082507b0bc3 90 | image_picker: a211f28b95a560433c00f5cd3773f4710a20404d 91 | MTBBarcodeScanner: 5b97f10a037e2560ff104da413343c5ce9413911 92 | open_file: 02eb5cb6b21264bd3a696876f5afbfb7ca4f4b7d 93 | package_info: 78cabb3c322943c55d39676f4a5bfc748c01d055 94 | path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259 95 | shared_preferences: 1feebfa37bb57264736e16865e7ffae7fc99b523 96 | simple_permissions: a6834dbad830eee541e62be161f96c75121dc4ab 97 | wifi: d7d77c94109e36c4175d845f0a5964eadba71060 98 | 99 | PODFILE CHECKSUM: 2764be9daecd122206af69db42c21f522b736806 100 | 101 | COCOAPODS: 1.6.1 102 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/AppIcon.appiconset/icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSMicrophoneUsageDescription 6 | This sample uses the microphone to record your speech and convert it to text. 7 | UIBackgroundModes 8 | 9 | audio 10 | 11 | NSCameraUsageDescription 12 | Camera permission is required for barcode scanning. 13 | CFBundleDevelopmentRegion 14 | en 15 | CFBundleExecutable 16 | $(EXECUTABLE_NAME) 17 | CFBundleIdentifier 18 | $(PRODUCT_BUNDLE_IDENTIFIER) 19 | CFBundleInfoDictionaryVersion 20 | 6.0 21 | CFBundleName 22 | 遥不可及 23 | CFBundlePackageType 24 | APPL 25 | CFBundleShortVersionString 26 | $(FLUTTER_BUILD_NAME) 27 | CFBundleSignature 28 | ???? 29 | CFBundleVersion 30 | $(FLUTTER_BUILD_NUMBER) 31 | LSRequiresIPhoneOS 32 | 33 | UILaunchStoryboardName 34 | LaunchScreen 35 | UIMainStoryboardFile 36 | Main 37 | UISupportedInterfaceOrientations 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationLandscapeLeft 41 | UIInterfaceOrientationLandscapeRight 42 | 43 | UISupportedInterfaceOrientations~ipad 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationPortraitUpsideDown 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UIViewControllerBasedStatusBarAppearance 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/lib.zip -------------------------------------------------------------------------------- /lib/config/all_data.dart: -------------------------------------------------------------------------------- 1 | class AllData{ 2 | bool haveNewMessage = false; 3 | } -------------------------------------------------------------------------------- /lib/config/config.dart: -------------------------------------------------------------------------------- 1 | class Config { 2 | String host = "http://ddz.so-what.cc"; 3 | int version = 11; 4 | String ossKey = '6f9UuyAgFQfsfnJaffT3C3aYoJ'; 5 | // String host = "http://so-what.nat123.cc"; 6 | } 7 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/page/version/version.dart'; 3 | 4 | void main() => runApp(MyApp()); 5 | 6 | class MyApp extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return MaterialApp( 10 | title: 'Flutter Demo', 11 | theme: ThemeData( 12 | primarySwatch: Colors.blue, 13 | ), 14 | home: Version(), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/page/component/chat/chat_list.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_wyz/config/config.dart'; 6 | import 'package:flutter_wyz/page/component/chat/chat_home.dart'; 7 | import 'package:flutter_wyz/page/pojo/chat.dart'; 8 | import 'package:flutter_wyz/util/Toast.dart'; 9 | import 'package:flutter_wyz/util/local_storage.dart'; 10 | import 'package:http/http.dart' as http; 11 | 12 | class ChatList extends StatefulWidget { 13 | @override 14 | _ChatListState createState() => _ChatListState(); 15 | } 16 | 17 | class _ChatListState extends State { 18 | Timer _ctXl; 19 | 20 | _ctXlGx() async { 21 | _ctXl = Timer.periodic(new Duration(milliseconds: 5000), (timer) { 22 | checkNew(); 23 | }); 24 | } 25 | 26 | String _id = null; 27 | List _list = []; 28 | 29 | _ChatListState() { 30 | _initData(); 31 | _ctXlGx(); 32 | } 33 | 34 | checkNew() async { 35 | String result = await LocalStorage().get("havaNewMsg"); 36 | if (result == "1") { 37 | await LocalStorage().set("havaNewMsg", "0"); 38 | _initData(); 39 | } 40 | } 41 | 42 | _initData() async { 43 | String token = await LocalStorage().get("token"); 44 | if (_id == null) { 45 | _id = await LocalStorage().get("userId"); 46 | } 47 | String url = 48 | Config().host + "/chat/chatTo?token=" + token + "&userId=" + _id; 49 | print(url); 50 | final http.Response response = await http.get(url); 51 | Utf8Decoder utf8decoder = new Utf8Decoder(); 52 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 53 | // print(data); 54 | var result = data['code']; 55 | if (result == 0) { 56 | List list = []; 57 | List datas = data['data']; 58 | if (data['data'] != null) { 59 | for (int i = 0; i < datas.length; i++) { 60 | list.add(Chat.fromJson(datas[i])); 61 | } 62 | setState(() { 63 | _list = list; 64 | }); 65 | } 66 | } else { 67 | Toast.toast(context, data['msg']); 68 | } 69 | } 70 | 71 | Widget _displayOne(index) { 72 | String content = _list[index].content; 73 | if (_list[index].type == 2) { 74 | content = '图片'; 75 | } 76 | if (_list[index].type == 3) { 77 | content = '语音'; 78 | } 79 | String url = _list[index].userHeadUrl; 80 | if (_id == _list[index].friendId) { 81 | url = _list[index].myHeadUrl; 82 | } 83 | // if (content.length >17) { 84 | // content = content.substring(0, 16); 85 | // } 86 | // if (content.length > 10) { 87 | // content = content.substring(0, 9); 88 | // } 89 | return GestureDetector( 90 | onTap: () { 91 | Navigator.push(context, 92 | new MaterialPageRoute(builder: (BuildContext context) { 93 | print(_id); 94 | return ChatHome( 95 | id: _list[index].friendId == _id 96 | ? _list[index].userId 97 | : _list[index].friendId, 98 | name: _id == _list[index].friendId 99 | ? _list[index].myName 100 | : _list[index].userName); 101 | })).then((result) { 102 | _initData(); 103 | }); 104 | }, 105 | child: Container( 106 | height: 90, 107 | child: Card( 108 | child: Row( 109 | crossAxisAlignment: CrossAxisAlignment.center, 110 | mainAxisAlignment: MainAxisAlignment.start, 111 | children: [ 112 | Container( 113 | padding: EdgeInsets.only(left: 20), 114 | child: Container( 115 | width: 66, 116 | child: ClipOval( 117 | child: Image.network(url == null 118 | ? 'https://assets-store-cdn.48lu.cn/assets-store/5002cfc3bf41f67f51b1d979ca2bd637.png' 119 | : url + 120 | "?x-oss-process=image/resize,m_lfit,h_100,w_100"), 121 | ), 122 | ), 123 | ), 124 | Expanded( 125 | child: Container( 126 | padding: EdgeInsets.only(left: 15), 127 | child: Column( 128 | crossAxisAlignment: CrossAxisAlignment.start, 129 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 130 | children: [ 131 | Container( 132 | child: Text( 133 | _id == _list[index].friendId 134 | ? _list[index].myName 135 | : _list[index].userName, 136 | style: TextStyle(fontSize: 22, color: Colors.black), 137 | ), 138 | ), 139 | Container( 140 | child: Text( 141 | content, 142 | overflow: TextOverflow.ellipsis, 143 | style: TextStyle( 144 | fontSize: 16, 145 | color: (_list[index].type == 2 || 146 | _list[index].type == 3) 147 | ? Colors.blue 148 | : Color.fromARGB(255, 100, 100, 100)), 149 | ), 150 | ), 151 | ], 152 | ), 153 | ), 154 | ), 155 | // Expanded( 156 | // child: 157 | Container( 158 | height: 60, 159 | width: 70, 160 | alignment: Alignment(0.8, -0.8), 161 | child: Text( 162 | DateTime.fromMicrosecondsSinceEpoch( 163 | _list[index].createAt * 1000 * 1000) 164 | .toString() 165 | .substring(0, 19), 166 | maxLines: 3, 167 | overflow: TextOverflow.ellipsis, 168 | style: TextStyle(color: Color.fromARGB(255, 120, 120, 120)), 169 | ), 170 | ), 171 | // ), 172 | ], 173 | ), 174 | ), 175 | ), 176 | ); 177 | } 178 | 179 | Future _flush() async { 180 | _list = []; 181 | _initData(); 182 | return; 183 | } 184 | 185 | @override 186 | Widget build(BuildContext context) { 187 | return (_list == null || _list.length < 1) 188 | ? Container( 189 | child: Center( 190 | child: Text("暂无数据"), 191 | ), 192 | ) 193 | : Container( 194 | child: RefreshIndicator( 195 | child: ListView.builder( 196 | itemCount: _list.length, 197 | itemBuilder: (context, index) { 198 | return _displayOne(index); 199 | }, 200 | ), 201 | onRefresh: _flush, 202 | ), 203 | ); 204 | } 205 | 206 | @override 207 | void dispose() { 208 | // TODO: implement dispose 209 | print("---------------------------------------------1111"); 210 | if (null != _ctXl) { 211 | _ctXl.cancel(); 212 | } 213 | super.dispose(); 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /lib/page/component/friend/friend_all.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:flutter_wyz/page/component/friend/friend_my.dart'; 4 | import 'package:flutter_wyz/page/component/friend/my_friend.dart'; 5 | 6 | class FriendAll extends StatefulWidget { 7 | FriendAll({Key key, this.id}) : super(key: key); 8 | 9 | final String id; 10 | 11 | @override 12 | _FriendAll createState() => _FriendAll(id); 13 | } 14 | 15 | class _FriendAll extends State { 16 | final List _m = [0, 1]; 17 | final List _ms = ['他关注的', '关注他的']; 18 | int _c = 0; 19 | String _id = ""; 20 | 21 | _FriendAll(id) { 22 | // setState(() { 23 | _id = id; 24 | // }); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return Scaffold( 30 | appBar: AppBar( 31 | title: Text('他的好友'), 32 | ), 33 | body: Column( 34 | children: [ 35 | Row( 36 | children: [ 37 | Expanded( 38 | child: GestureDetector( 39 | onTap: () { 40 | setState(() { 41 | _c = 0; 42 | }); 43 | }, 44 | child: Container( 45 | color: Color.fromARGB(255, 255, 255, 255), 46 | height: 50, 47 | width: double.infinity, 48 | child: Center( 49 | child: Text( 50 | _ms[0], 51 | style: TextStyle( 52 | fontSize: _c == 0 ? 20 : 18, 53 | color: _c == 0 54 | ? Color.fromARGB(255, 1, 1, 1) 55 | : Color.fromARGB(255, 100, 100, 100), 56 | ), 57 | ), 58 | ), 59 | ), 60 | ), 61 | ), 62 | Expanded( 63 | child: GestureDetector( 64 | onTap: () { 65 | setState(() { 66 | _c = 1; 67 | }); 68 | }, 69 | child: Container( 70 | color: Color.fromARGB(255, 255, 255, 255), 71 | height: 50, 72 | width: double.infinity, 73 | child: Center( 74 | child: Text( 75 | _ms[1], 76 | style: TextStyle( 77 | fontSize: _c == 1 ? 20 : 18, 78 | color: _c == 1 79 | ? Color.fromARGB(255, 1, 1, 1) 80 | : Color.fromARGB(255, 100, 100, 100), 81 | ), 82 | ), 83 | ), 84 | ), 85 | ), 86 | ), 87 | ], 88 | ), 89 | Row( 90 | children: [ 91 | Expanded( 92 | child: Container( 93 | height: 2, 94 | color: _c == 0 ? Colors.blue : Colors.black26, 95 | width: double.infinity, 96 | ), 97 | ), 98 | Expanded( 99 | child: Container( 100 | height: 2, 101 | color: _c == 1 ? Colors.blue : Colors.black26, 102 | width: double.infinity, 103 | ), 104 | ), 105 | ], 106 | ), 107 | Expanded( 108 | child: Container( 109 | color: Color.fromARGB(255, 250, 250, 250), 110 | width: double.infinity, 111 | child: _c == 0 ? MyFriend(id: _id) : FriendMy(id: _id), 112 | ), 113 | ) 114 | ], 115 | ), 116 | ); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /lib/page/component/friend/friend_my.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/config/config.dart'; 3 | import 'package:flutter_wyz/page/component/friend/friend_info.dart'; 4 | import 'package:flutter_wyz/page/pojo/user.dart'; 5 | import 'package:flutter_wyz/util/Toast.dart'; 6 | import 'package:flutter_wyz/util/local_storage.dart'; 7 | import 'package:http/http.dart' as http; 8 | import 'dart:convert'; 9 | 10 | class FriendMy extends StatefulWidget { 11 | FriendMy({Key key, this.id}) : super(key: key); 12 | 13 | final String id; 14 | 15 | @override 16 | _FriendMyState createState() => _FriendMyState(id); 17 | } 18 | 19 | class _FriendMyState extends State { 20 | List _list = []; 21 | 22 | String _id = ""; 23 | 24 | _FriendMyState(id) { 25 | print(id); 26 | _init(id); 27 | } 28 | 29 | _init(id) async { 30 | if (id == "0" || id == null) { 31 | id = await LocalStorage().get("userId"); 32 | } 33 | _id = id; 34 | _initData(); 35 | } 36 | 37 | _initData() async { 38 | String token = await LocalStorage().get("token"); 39 | String url = 40 | Config().host + "/user/queryFriendMy?id=" + _id + "&token=" + token; 41 | final http.Response response = await http.get(url); 42 | Utf8Decoder utf8decoder = new Utf8Decoder(); 43 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 44 | // print(data); 45 | var result = data['code']; 46 | if (result == 0) { 47 | List list = new List(); 48 | List datas = data['data']; 49 | for (int i = 0; i < datas.length; i++) { 50 | list.add(User.fromJson(datas[i])); 51 | } 52 | setState(() { 53 | _list = list; 54 | }); 55 | } else { 56 | Toast.toast(context, data['msg']); 57 | } 58 | } 59 | 60 | @override 61 | Widget build(BuildContext context) { 62 | return Container( 63 | child: ListView.builder( 64 | itemCount: _list.length, 65 | itemBuilder: (context, index) { 66 | return _displayOneUser(index); 67 | }, 68 | ), 69 | ); 70 | } 71 | 72 | Widget _displayOneUser(int index) { 73 | return GestureDetector( 74 | onTap: () { 75 | Navigator.push(context, 76 | new MaterialPageRoute(builder: (BuildContext context) { 77 | return FriendInfo(id: _list[index].id); 78 | })).then((result) { 79 | if (result != null) { 80 | _initData(); 81 | } 82 | }); 83 | }, 84 | child: Container( 85 | padding: EdgeInsets.only(top: 2), 86 | child: Card( 87 | child: Container( 88 | height: 80, 89 | padding: EdgeInsets.only(left: 15), 90 | child: Row( 91 | children: [ 92 | Padding( 93 | padding: EdgeInsets.only(left: 1), 94 | child: Container( 95 | child: Container( 96 | height: 60, 97 | width: 60, 98 | child: ClipOval( 99 | child: Image.network(_list[index].headUrl == null 100 | ? 'https://assets-store-cdn.48lu.cn/assets-store/5002cfc3bf41f67f51b1d979ca2bd637.png' 101 | : _list[index].headUrl + 102 | "?x-oss-process=image/resize,m_lfit,h_100,w_100"), 103 | ), 104 | ), 105 | ), 106 | ), 107 | Padding( 108 | padding: EdgeInsets.only(left: 20), 109 | child: Container( 110 | child: Text(_list[index].name), 111 | ), 112 | ) 113 | ], 114 | ), 115 | ), 116 | ), 117 | ), 118 | ); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /lib/page/component/friend/my_friend.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/config/config.dart'; 3 | import 'package:flutter_wyz/page/component/friend/friend_info.dart'; 4 | import 'package:flutter_wyz/page/pojo/user.dart'; 5 | import 'package:flutter_wyz/util/Toast.dart'; 6 | import 'package:flutter_wyz/util/local_storage.dart'; 7 | import 'package:http/http.dart' as http; 8 | import 'dart:convert'; 9 | 10 | class MyFriend extends StatefulWidget { 11 | MyFriend({Key key, this.id}) : super(key: key); 12 | 13 | final String id; 14 | 15 | @override 16 | _MyFriendState createState() => _MyFriendState(id); 17 | } 18 | 19 | class _MyFriendState extends State { 20 | List _list = []; 21 | 22 | String _id = ""; 23 | 24 | _MyFriendState(id) { 25 | _init(id); 26 | } 27 | 28 | _init(id) async { 29 | if (id == "0" || id == null) 30 | _id = await LocalStorage().get("userId"); 31 | else 32 | _id = id; 33 | _initData(); 34 | } 35 | 36 | _initData() async { 37 | String token = await LocalStorage().get("token"); 38 | String url = 39 | Config().host + "/user/queryMyFriend?id=" + _id + "&token=" + token; 40 | final http.Response response = await http.get(url); 41 | Utf8Decoder utf8decoder = new Utf8Decoder(); 42 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 43 | // print(data); 44 | var result = data['code']; 45 | if (result == 0) { 46 | List list = new List(); 47 | List datas = data['data']; 48 | for (int i = 0; i < datas.length; i++) { 49 | list.add(User.fromJson(datas[i])); 50 | } 51 | setState(() { 52 | _list = list; 53 | }); 54 | } else { 55 | Toast.toast(context, data['msg']); 56 | } 57 | } 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | return Container( 62 | child: ListView.builder( 63 | itemCount: _list.length, 64 | itemBuilder: (context, index) { 65 | return _displayOneUser(index); 66 | }, 67 | ), 68 | ); 69 | } 70 | 71 | Widget _displayOneUser(int index) { 72 | return GestureDetector( 73 | onTap: () { 74 | Navigator.push(context, 75 | new MaterialPageRoute(builder: (BuildContext context) { 76 | return FriendInfo(id: _list[index].id); 77 | })).then((result) { 78 | _initData(); 79 | }); 80 | }, 81 | child: Container( 82 | padding: EdgeInsets.only(top: 2), 83 | child: Card( 84 | child: Container( 85 | height: 80, 86 | padding: EdgeInsets.only(left: 15), 87 | child: Row( 88 | children: [ 89 | Padding( 90 | padding: EdgeInsets.only(left: 1), 91 | child: Container( 92 | child: Container( 93 | height: 60, 94 | width: 60, 95 | child: ClipOval( 96 | child: Image.network(_list[index].headUrl == null 97 | ? 'https://assets-store-cdn.48lu.cn/assets-store/5002cfc3bf41f67f51b1d979ca2bd637.png' 98 | : _list[index].headUrl + 99 | "?x-oss-process=image/resize,m_lfit,h_100,w_100"), 100 | ), 101 | ), 102 | ), 103 | ), 104 | Padding( 105 | padding: EdgeInsets.only(left: 20), 106 | child: Container( 107 | child: Text(_list[index].name), 108 | ), 109 | ) 110 | ], 111 | ), 112 | ), 113 | ), 114 | ), 115 | ); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /lib/page/component/list/user_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/page/pojo/user.dart'; 3 | 4 | class UserList extends StatefulWidget { 5 | @override 6 | _UserListState createState() => _UserListState(); 7 | } 8 | 9 | class _UserListState extends State { 10 | List _users = [ 11 | User('吴易泽1', '10', '杭州'), 12 | User('吴易泽2', '10', '杭州'), 13 | User('吴易泽3', '10', '杭州'), 14 | User('吴易泽4', '10', '杭州'), 15 | User('吴易泽5', '10', '杭州'), 16 | User('吴易泽6', '10', '杭州'), 17 | User('吴易泽7', '10', '杭州'), 18 | User('吴易泽8', '10', '杭州'), 19 | User('吴易泽9', '10', '杭州'), 20 | User('吴易泽10', '10', '杭州') 21 | ]; 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Container( 26 | child: Expanded( 27 | child: ListView.builder( 28 | itemCount: _users.length, 29 | itemBuilder: (context, index) { 30 | return _displayUser(index); 31 | }, 32 | ), 33 | ), 34 | ); 35 | } 36 | 37 | Widget _displayUser(int index) { 38 | return Container( 39 | padding: EdgeInsets.all(2), 40 | child: Card( 41 | child: Container( 42 | height: 80, 43 | padding: EdgeInsets.only( 44 | left: 15, 45 | right: 15, 46 | top: 15, 47 | bottom: 15.0, 48 | ), 49 | child: Row( 50 | mainAxisAlignment: MainAxisAlignment.spaceAround, 51 | children: [ 52 | Text(_users[index].name), 53 | Text(_users[index].age), 54 | Text(_users[index].address), 55 | ], 56 | ), 57 | ), 58 | margin: EdgeInsets.only( 59 | top: 0, 60 | left: 8, 61 | right: 8, 62 | bottom: 0, 63 | ), 64 | shape: RoundedRectangleBorder( 65 | borderRadius: BorderRadius.all( 66 | Radius.circular(0), 67 | ), 68 | ), 69 | ), 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/page/component/msg/msg_home.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/page/component/msg/msg_list.dart'; 3 | import 'package:flutter_wyz/page/component/msg/msg_my.dart'; 4 | import 'package:flutter_wyz/page/component/msg/msg_my_care.dart'; 5 | 6 | class MsgHome extends StatefulWidget { 7 | @override 8 | _MsgHomeState createState() => _MsgHomeState(); 9 | } 10 | 11 | class _MsgHomeState extends State { 12 | final List _m = [0, 1, 2]; 13 | final List _ms = ['关注', '所有', '我的']; 14 | int _c = 1; 15 | 16 | getContent(int c) { 17 | if (c == 0) { 18 | return MsgMyCare(); 19 | } else if (c == 1) { 20 | return MsgList(); 21 | } else if (c == 2) { 22 | return MsgMy(); 23 | } 24 | } 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return Column( 29 | children: [ 30 | Row( 31 | children: [ 32 | Expanded( 33 | child: GestureDetector( 34 | onTap: () { 35 | setState(() { 36 | _c = 0; 37 | }); 38 | }, 39 | child: Container( 40 | color: Color.fromARGB(255, 255, 255, 255), 41 | height: 50, 42 | width: double.infinity, 43 | child: Center( 44 | child: Text( 45 | _ms[0], 46 | style: TextStyle( 47 | fontSize: _c == 0 ? 20 : 18, 48 | color: _c == 0 49 | ? Color.fromARGB(255, 1, 1, 1) 50 | : Color.fromARGB(255, 100, 100, 100), 51 | ), 52 | ), 53 | ), 54 | ), 55 | ), 56 | ), 57 | Expanded( 58 | child: GestureDetector( 59 | onTap: () { 60 | setState(() { 61 | _c = 1; 62 | }); 63 | }, 64 | child: Container(color: Color.fromARGB(255, 255, 255, 255), 65 | height: 50, 66 | width: double.infinity, 67 | child: Center( 68 | child: Text( 69 | _ms[1], 70 | style: TextStyle( 71 | fontSize: _c == 1 ? 20 : 18, 72 | color: _c == 1 73 | ? Color.fromARGB(255, 1, 1, 1) 74 | : Color.fromARGB(255, 100, 100, 100), 75 | ), 76 | ), 77 | ), 78 | ), 79 | ), 80 | ), 81 | Expanded( 82 | child: GestureDetector( 83 | onTap: () { 84 | setState(() { 85 | _c = 2; 86 | }); 87 | }, 88 | child: Container(color: Color.fromARGB(255, 255, 255, 255), 89 | height: 50, 90 | width: double.infinity, 91 | child: Center( 92 | child: Text( 93 | _ms[2], 94 | style: TextStyle( 95 | fontSize: _c == 2 ? 20 : 18, 96 | color: _c == 2 97 | ? Color.fromARGB(255, 1, 1, 1) 98 | : Color.fromARGB(255, 100, 100, 100), 99 | ), 100 | ), 101 | ), 102 | ), 103 | ), 104 | ), 105 | ], 106 | ), 107 | Row( 108 | children: [ 109 | Expanded( 110 | child: Container( 111 | height: 2, 112 | color: _c == 0 ? Colors.blue : Colors.black26, 113 | width: double.infinity, 114 | ), 115 | ), 116 | Expanded( 117 | child: Container( 118 | height: 2, 119 | color: _c == 1 ? Colors.blue : Colors.black26, 120 | width: double.infinity, 121 | ), 122 | ), 123 | Expanded( 124 | child: Container( 125 | height: 2, 126 | color: _c == 2 ? Colors.blue : Colors.black26, 127 | width: double.infinity, 128 | ), 129 | ), 130 | ], 131 | ), 132 | Expanded( 133 | child: Container( 134 | padding: EdgeInsets.only(top: 3), 135 | color: Color.fromARGB(255, 250, 250, 250), 136 | width: double.infinity, 137 | child: getContent(_c), 138 | ), 139 | ) 140 | ], 141 | ); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /lib/page/component/person/change_autograph/change_autograph.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/config/config.dart'; 3 | import 'package:flutter_wyz/page/index/index.dart'; 4 | import 'package:flutter_wyz/page/pojo/user.dart'; 5 | import 'package:flutter_wyz/util/Toast.dart'; 6 | import 'package:flutter_wyz/util/local_storage.dart'; 7 | import 'package:http/http.dart' as http; 8 | import 'dart:convert'; 9 | 10 | class ChangeAutograph extends StatefulWidget { 11 | @override 12 | _ChangeAutographState createState() => _ChangeAutographState(); 13 | } 14 | 15 | class _ChangeAutographState extends State { 16 | bool _pwdState = false; 17 | TextEditingController _pwdcontroller1 = new TextEditingController(); 18 | String _checkStr; 19 | User user = new User(null, null, null); 20 | 21 | _ChangeAutographState() { 22 | _initData(); 23 | } 24 | 25 | void _checkPwd() { 26 | if (_pwdcontroller1.text.isNotEmpty && 27 | _pwdcontroller1.text.trim().length >= 1) { 28 | _pwdState = true; 29 | } else { 30 | _pwdState = false; 31 | } 32 | } 33 | 34 | _initData() async { 35 | String id = await LocalStorage().get("userId"); 36 | String token = await LocalStorage().get("token"); 37 | String url = Config().host + "/user?id=" + id + "&token=" + token; 38 | final http.Response response = await http.get(url); 39 | Map data = json.decode(response.body); 40 | print(data); 41 | var result = data['code']; 42 | if (result == 0) { 43 | setState(() { 44 | user = new User.fromJson(data['data']); 45 | _pwdcontroller1.text = user.autograph; 46 | }); 47 | } else { 48 | Toast.toast(context, data['msg']); 49 | } 50 | } 51 | 52 | _changeName() async { 53 | String token = await LocalStorage().get("token"); 54 | String id = await LocalStorage().get("userId"); 55 | String url = Config().host + "/user?token=" + token; 56 | String datax = json.encode({'autograph': _pwdcontroller1.text, 'id': id}); 57 | print(datax); 58 | final http.Response response = await http.put(url, body: datax); 59 | Utf8Decoder utf8decoder = new Utf8Decoder(); 60 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 61 | print(data); 62 | var result = data['code']; 63 | if (result == 0) { 64 | await LocalStorage().set("labelId", '3'); 65 | Navigator.of(context).pushAndRemoveUntil( 66 | MaterialPageRoute(builder: (context) => Index()), 67 | (route) => route == null); 68 | } else { 69 | Toast.toast(context, data['msg']); 70 | } 71 | } 72 | 73 | @override 74 | Widget build(BuildContext context) { 75 | return Scaffold( 76 | appBar: new AppBar( 77 | title: new Text('修改签名'), 78 | ), 79 | body: new ListView( 80 | children: [ 81 | new Column( 82 | mainAxisSize: MainAxisSize.max, 83 | mainAxisAlignment: MainAxisAlignment.start, 84 | children: [ 85 | new Padding( 86 | padding: new EdgeInsets.fromLTRB(20.0, 55.0, 20.0, 40.0), 87 | child: new Row( 88 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 89 | children: [ 90 | new Padding( 91 | padding: new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 92 | child: Icon(Icons.calendar_view_day)), 93 | new Expanded( 94 | child: new TextField( 95 | controller: _pwdcontroller1, 96 | decoration: new InputDecoration( 97 | hintText: '请输入签名', 98 | suffixIcon: new IconButton( 99 | icon: 100 | new Icon(Icons.clear, color: Colors.black45), 101 | onPressed: () { 102 | _pwdcontroller1.clear(); 103 | }, 104 | ), 105 | ), 106 | obscureText: false, 107 | ), 108 | ), 109 | ]), 110 | ), 111 | new Container( 112 | width: 340.0, 113 | child: new Card( 114 | color: Colors.blue, 115 | elevation: 16.0, 116 | child: new FlatButton( 117 | child: new Padding( 118 | padding: new EdgeInsets.all(10.0), 119 | child: new Text( 120 | '修改', 121 | style: 122 | new TextStyle(color: Colors.white, fontSize: 16.0), 123 | ), 124 | ), 125 | onPressed: () { 126 | _checkStr = null; 127 | ; 128 | _checkPwd(); 129 | if (!_pwdState) { 130 | _checkStr = '不能为空!'; 131 | } 132 | 133 | print(_checkStr); 134 | if (_checkStr == null || _checkStr == "") { 135 | _changeName(); 136 | Toast.toast(context, '提交中'); 137 | } else { 138 | Toast.toast(context, _checkStr); 139 | } 140 | }, 141 | ), 142 | ), 143 | ), 144 | ], 145 | ), 146 | ], 147 | ), 148 | ); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /lib/page/component/person/change_back_img/change_back_img.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter_wyz/config/config.dart'; 3 | import 'package:flutter_wyz/page/index/index.dart'; 4 | import 'package:flutter_wyz/util/Toast.dart'; 5 | import 'package:flutter_wyz/util/local_storage.dart'; 6 | import 'package:image_crop/image_crop.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:image_picker/image_picker.dart'; 9 | import 'dart:convert'; 10 | import 'package:http/http.dart' as http; 11 | class ChangeBackImg extends StatefulWidget { 12 | @override 13 | _ChangeBackImgState createState() => _ChangeBackImgState(); 14 | } 15 | 16 | class _ChangeBackImgState extends State { 17 | String _imageUrl = null; 18 | File _image; 19 | final cropKey = GlobalKey(); 20 | 21 | Future getImage() async { 22 | var image = await ImagePicker.pickImage(source: ImageSource.gallery); 23 | 24 | setState(() { 25 | _image = image; 26 | }); 27 | } 28 | 29 | uploadPic(data1) async { 30 | var url = Config().host + '/file/uploadBase64'; 31 | try { 32 | final http.Response response = await http.post(url, body: data1); 33 | var data = json.decode(response.body); 34 | setState(() { 35 | _imageUrl = data['data']; 36 | print(_imageUrl); 37 | _updateHead(); 38 | }); 39 | } catch (e) { 40 | print("上传文件失败"); 41 | } 42 | } 43 | 44 | _updateHead() async { 45 | String token = await LocalStorage().get("token"); 46 | String id = await LocalStorage().get("userId"); 47 | String url = Config().host + "/user?token=" + token; 48 | String datax = json.encode({'backImg': _imageUrl, 'id': id}); 49 | print(datax); 50 | final http.Response response = await http.put(url, body: datax); 51 | Utf8Decoder utf8decoder = new Utf8Decoder(); 52 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 53 | print(data); 54 | var result = data['code']; 55 | if (result == 0) { 56 | await LocalStorage().set("labelId", '3'); 57 | Navigator.of(context).pushAndRemoveUntil( 58 | MaterialPageRoute(builder: (context) => Index()), 59 | (route) => route == null); 60 | } else { 61 | Toast.toast(context, data['msg']); 62 | } 63 | } 64 | 65 | pic() async { 66 | final crop = cropKey.currentState; 67 | final scale = crop.scale; 68 | print(scale); 69 | final area = crop.area; 70 | print(area); 71 | if (area == null) { 72 | print("error"); 73 | } else { 74 | final sampledFile = await ImageCrop.sampleImage( 75 | file: _image, 76 | preferredWidth: (512 / scale).round(), 77 | preferredHeight: (512 / scale).round(), 78 | ); 79 | final croppedFile = await ImageCrop.cropImage( 80 | file: sampledFile, 81 | area: crop.area, 82 | ); 83 | setState(() { 84 | _image = croppedFile; 85 | var image_base64 = base64.encode(_image.readAsBytesSync()); 86 | uploadPic(image_base64); 87 | }); 88 | } 89 | } 90 | 91 | @override 92 | Widget build(BuildContext context) { 93 | return Scaffold( 94 | appBar: AppBar( 95 | title: Text('修改背景'), 96 | ), 97 | body: Column( 98 | children: [ 99 | Offstage( 100 | offstage: _imageUrl == null, 101 | child: Column( 102 | children: [ 103 | Padding( 104 | padding: EdgeInsets.all(30), 105 | child: Center( 106 | child: Text('头像上传成功!!'), 107 | ), 108 | ), 109 | Padding( 110 | padding: EdgeInsets.all(20), 111 | child: 112 | _imageUrl == null ? Text("") : Image.network(_imageUrl), 113 | ), 114 | ], 115 | ), 116 | ), 117 | Offstage( 118 | offstage: _imageUrl != null, 119 | child: _image == null 120 | ? Center( 121 | child: Padding( 122 | padding: EdgeInsets.only( 123 | right: 0, 124 | left: 0, 125 | bottom: 0, 126 | top: 100, 127 | ), 128 | child: Text('未选择图片'), 129 | ), 130 | ) 131 | : Container( 132 | padding: EdgeInsets.all(40), 133 | height: 300, 134 | width: 400, 135 | child: Crop( 136 | key: cropKey, 137 | image: FileImage(_image), 138 | aspectRatio: 4.0 / 2.0, 139 | ), 140 | ), 141 | ), 142 | Offstage( 143 | offstage: !(_imageUrl == null && _image != null), 144 | child: Row( 145 | mainAxisAlignment: MainAxisAlignment.center, 146 | children: [ 147 | MaterialButton( 148 | color: Colors.blue, 149 | onPressed: pic, 150 | child: Text( 151 | '裁剪', 152 | style: TextStyle(color: Colors.white), 153 | ), 154 | ), 155 | ], 156 | ), 157 | ), 158 | ], 159 | ), 160 | floatingActionButton: Offstage( 161 | offstage: _image != null, 162 | child: FloatingActionButton( 163 | isExtended: true, 164 | onPressed: getImage, 165 | tooltip: 'Pick Image', 166 | child: Icon(Icons.add_a_photo), 167 | ), 168 | // ), 169 | ), 170 | ); 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /lib/page/component/person/change_head/change_head.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:exifdart/exifdart.dart'; 3 | import 'package:flutter_image_compress/flutter_image_compress.dart'; 4 | import 'package:flutter_wyz/config/config.dart'; 5 | import 'package:flutter_wyz/page/index/index.dart'; 6 | import 'package:flutter_wyz/util/Toast.dart'; 7 | import 'package:flutter_wyz/util/local_storage.dart'; 8 | import 'package:image_crop/image_crop.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:image_picker/image_picker.dart'; 11 | import 'dart:convert'; 12 | import 'package:http/http.dart' as http; 13 | import 'package:path_provider/path_provider.dart'; 14 | import 'package:simple_permissions/simple_permissions.dart'; 15 | 16 | class ChangeHead extends StatefulWidget { 17 | @override 18 | _ChangeHeadState createState() => _ChangeHeadState(); 19 | } 20 | 21 | class _ChangeHeadState extends State { 22 | bool _tjz = false; 23 | String _imageUrl = null; 24 | File _image; 25 | final cropKey = GlobalKey(); 26 | 27 | Future getImage() async { 28 | File image = await ImagePicker.pickImage(source: ImageSource.gallery); 29 | int r = await getImageRotateAngular(image.readAsBytesSync()); 30 | print(r); 31 | if (r == 0) { 32 | setState(() { 33 | _image = image; 34 | }); 35 | } else { 36 | var directory = await getExternalStorageDirectory(); 37 | bool res = await SimplePermissions.checkPermission( 38 | Permission.WriteExternalStorage); 39 | if (!res) 40 | await SimplePermissions.requestPermission( 41 | Permission.WriteExternalStorage); 42 | print(res); 43 | print(directory.path + "/tmp.jpg"); 44 | image = 45 | await testCompressAndGetFile(image, directory.path + "/tmp.jpg", r); 46 | setState(() { 47 | _image = image; 48 | }); 49 | } 50 | } 51 | 52 | Future getImageRotateAngular(List bytes) async { 53 | Map tags = await readExif(MemoryBlobReader(bytes)); 54 | if (tags == null || tags['Orientation'] == null) return 0; 55 | var orientation = tags['Orientation']; //获取该照片的拍摄方向 56 | switch (orientation) { 57 | case 3: 58 | return 180; 59 | case 6: 60 | return 90; 61 | case 8: 62 | return -90; 63 | default: 64 | return 0; 65 | } 66 | } 67 | 68 | Future testCompressAndGetFile( 69 | File file, String targetPath, int r) async { 70 | File result = await FlutterImageCompress.compressAndGetFile( 71 | file.absolute.path, 72 | targetPath, 73 | quality: 94, 74 | rotate: r, 75 | ); 76 | print(file.lengthSync()); 77 | print(result.lengthSync()); 78 | return result; 79 | } 80 | 81 | uploadPic(data1) async { 82 | var url = Config().host + '/file/uploadBase64'; 83 | try { 84 | final http.Response response = await http.post(url, body: data1); 85 | var data = json.decode(response.body); 86 | setState(() { 87 | _imageUrl = data['data']; 88 | print(_imageUrl); 89 | _updateHead(); 90 | }); 91 | } catch (e) { 92 | print("上传文件失败"); 93 | } 94 | } 95 | 96 | _updateHead() async { 97 | String token = await LocalStorage().get("token"); 98 | String id = await LocalStorage().get("userId"); 99 | String url = Config().host + "/user?token=" + token; 100 | String datax = json.encode({'headUrl': _imageUrl, 'id': id}); 101 | print(datax); 102 | final http.Response response = await http.put(url, body: datax); 103 | Utf8Decoder utf8decoder = new Utf8Decoder(); 104 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 105 | print(data); 106 | var result = data['code']; 107 | if (result == 0) { 108 | await LocalStorage().set("labelId", '3'); 109 | Navigator.of(context).pushAndRemoveUntil( 110 | MaterialPageRoute(builder: (context) => Index()), 111 | (route) => route == null); 112 | } else { 113 | Toast.toast(context, data['msg']); 114 | } 115 | } 116 | 117 | pic() async { 118 | if (!_tjz) { 119 | _tjz = true; 120 | final crop = cropKey.currentState; 121 | final scale = crop.scale; 122 | final area = crop.area; 123 | if (area == null) { 124 | print("error"); 125 | } else { 126 | final sampledFile = await ImageCrop.sampleImage( 127 | file: _image, 128 | preferredWidth: (512 / crop.scale).round(), 129 | preferredHeight: (512 / crop.scale).round(), 130 | ); 131 | final croppedFile = await ImageCrop.cropImage( 132 | file: sampledFile, 133 | area: crop.area, 134 | ); 135 | setState(() { 136 | _image = croppedFile; 137 | var image_base64 = base64.encode(_image.readAsBytesSync()); 138 | uploadPic(image_base64); 139 | }); 140 | } 141 | } 142 | } 143 | 144 | @override 145 | Widget build(BuildContext context) { 146 | return Scaffold( 147 | appBar: AppBar( 148 | title: Text('修改头像'), 149 | ), 150 | body: Column( 151 | children: [ 152 | Offstage( 153 | offstage: _imageUrl == null, 154 | child: Column( 155 | children: [ 156 | Padding( 157 | padding: EdgeInsets.all(30), 158 | child: Center( 159 | child: Text('头像上传成功!!'), 160 | ), 161 | ), 162 | Padding( 163 | padding: EdgeInsets.all(20), 164 | child: 165 | _imageUrl == null ? Text("") : Image.network(_imageUrl), 166 | ), 167 | ], 168 | ), 169 | ), 170 | Offstage( 171 | offstage: _imageUrl != null, 172 | child: _image == null 173 | ? Center( 174 | child: Padding( 175 | padding: EdgeInsets.only( 176 | right: 0, 177 | left: 0, 178 | bottom: 0, 179 | top: 100, 180 | ), 181 | child: Text('未选择图片'), 182 | ), 183 | ) 184 | : Container( 185 | padding: EdgeInsets.all(50), 186 | height: 400, 187 | width: 400, 188 | child: Crop( 189 | key: cropKey, 190 | image: FileImage(_image), 191 | aspectRatio: 1.0 / 1.0, 192 | ), 193 | ), 194 | ), 195 | Offstage( 196 | offstage: !(_imageUrl == null && _image != null), 197 | child: Row( 198 | mainAxisAlignment: MainAxisAlignment.center, 199 | children: [ 200 | MaterialButton( 201 | color: Colors.blue, 202 | onPressed: pic, 203 | child: Text( 204 | '裁剪', 205 | style: TextStyle(color: Colors.white), 206 | ), 207 | ), 208 | ], 209 | ), 210 | ), 211 | ], 212 | ), 213 | floatingActionButton: Offstage( 214 | offstage: _image != null, 215 | child: FloatingActionButton( 216 | isExtended: true, 217 | onPressed: getImage, 218 | tooltip: 'Pick Image', 219 | child: Icon(Icons.add_a_photo), 220 | ), 221 | // ), 222 | ), 223 | ); 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /lib/page/component/person/device_hj.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:async'; 3 | import 'dart:convert'; 4 | import 'package:http/http.dart' as http; 5 | import 'package:flutter_wyz/config/config.dart'; 6 | import 'package:flutter_wyz/util/Toast.dart'; 7 | import 'package:flutter_wyz/util/local_storage.dart'; 8 | 9 | class DeviceHJ extends StatefulWidget { 10 | DeviceHJ({Key key, this.id, this.name, this.cid}) : super(key: key); 11 | final String id; 12 | final String name; 13 | final String cid; 14 | 15 | @override 16 | _DeviceHJState createState() => _DeviceHJState(id, name, cid); 17 | } 18 | 19 | class _DeviceHJState extends State { 20 | @override 21 | void dispose() { 22 | if (null != _ctXl) _ctXl.cancel(); 23 | super.dispose(); 24 | } 25 | 26 | _DeviceHJState(id, name, cid) { 27 | _id = id; 28 | _name = name; 29 | _cid = cid; 30 | _readTH(); 31 | _initData(); 32 | } 33 | 34 | List> _list = []; 35 | String _cid; 36 | String _id; 37 | String _name = ''; 38 | Timer _ctXl; 39 | String _wd = "获取中"; 40 | String _sd = "获取中"; 41 | 42 | _initData() { 43 | _ctXlGx(); 44 | } 45 | 46 | _ctXlGx() { 47 | _ctXl = Timer.periodic(new Duration(milliseconds: 5000), (timer) { 48 | _readTH(); 49 | }); 50 | } 51 | 52 | _readTH() async { 53 | String token = await LocalStorage().get("token"); 54 | String url = 55 | Config().host + "/device/readTH?cid=" + _cid + "&token=" + token; 56 | final http.Response response = await http.get(url); 57 | Utf8Decoder utf8decoder = new Utf8Decoder(); 58 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 59 | print(data); 60 | var result = data['code']; 61 | if (result == 0) { 62 | Map md = new Map(); 63 | double dt = double.parse(data['data']['data']['t'].toString()); 64 | double dh = double.parse(data['data']['data']['h'].toString()); 65 | print(dt); 66 | print(dh); 67 | if (dt > -100) { 68 | _wd = dt.toString(); 69 | } 70 | if (dh > -100) { 71 | _sd = dh.toString(); 72 | } 73 | if (dt > -100 && dh > -100) { 74 | md['wd'] = dt.toString().replaceAll('.0', ''); 75 | md['sd'] = dh.toString().replaceAll('.0', ''); 76 | String at = DateTime.fromMicrosecondsSinceEpoch( 77 | DateTime.now().microsecondsSinceEpoch) 78 | .toString() 79 | .substring(0, 19); 80 | at = at.substring(11,at.length); 81 | 82 | md['time'] = at; 83 | } 84 | if(_list.length > 7){ 85 | _list.removeAt(0); 86 | } 87 | setState(() { 88 | _list.add(md); 89 | }); 90 | } else { 91 | Toast.toast(context, data['msg']); 92 | } 93 | } 94 | 95 | Widget _displayOneDevice(index) { 96 | return Container( 97 | height: 40, 98 | child: Card( 99 | child: Center( 100 | child: Text('检测时间:' + _list[index]['time'] + "温度:" + _list[index]['wd'] +"°C湿度:" +_list[index]['sd']+"%"), 101 | ), 102 | ), 103 | ); 104 | } 105 | 106 | @override 107 | Widget build(BuildContext context) { 108 | return Scaffold( 109 | backgroundColor: Color.fromARGB(255, 255, 255, 255), 110 | appBar: AppBar( 111 | title: Text(_name), 112 | ), 113 | body: Column( 114 | children: [ 115 | Container( 116 | child: SingleChildScrollView( 117 | padding: EdgeInsets.only(top: 100), 118 | child: Column( 119 | crossAxisAlignment: CrossAxisAlignment.center, 120 | children: [ 121 | Row( 122 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 123 | crossAxisAlignment: CrossAxisAlignment.center, 124 | children: [ 125 | Container( 126 | width: 80, 127 | child: Center( 128 | child: Text('温度'), 129 | ), 130 | ), 131 | Image.asset( 132 | 'img/wd.png', 133 | height: 60, 134 | width: 60, 135 | ), 136 | Container( 137 | width: 80, 138 | child: Center( 139 | child: Text(_wd.replaceAll('.0', '') + '°C'), 140 | ), 141 | ), 142 | ], 143 | ), 144 | Container( 145 | height: 60, 146 | width: double.infinity, 147 | ), 148 | Row( 149 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 150 | crossAxisAlignment: CrossAxisAlignment.center, 151 | children: [ 152 | Container( 153 | width: 80, 154 | child: Center( 155 | child: Text('湿度'), 156 | ), 157 | ), 158 | Image.asset( 159 | 'img/sd.png', 160 | height: 60, 161 | width: 60, 162 | ), 163 | Container( 164 | width: 80, 165 | child: Center( 166 | child: Text(_sd.replaceAll(".0", '') + "%"), 167 | ), 168 | ), 169 | ], 170 | ), 171 | ], 172 | ), 173 | ), 174 | ), 175 | Expanded( 176 | child: Container( 177 | padding: EdgeInsets.only(top: 15), 178 | child: ListView.builder( 179 | itemCount: _list.length, 180 | itemBuilder: (context, index) { 181 | return _displayOneDevice(index); 182 | }, 183 | ), 184 | ), 185 | ), 186 | ], 187 | )); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /lib/page/component/person/device_info.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:http/http.dart' as http; 5 | import 'package:flutter_wyz/config/config.dart'; 6 | import 'package:flutter_wyz/util/Toast.dart'; 7 | import 'package:flutter_wyz/util/local_storage.dart'; 8 | 9 | class DeviceInfo extends StatefulWidget { 10 | DeviceInfo({Key key, this.id, this.name, this.cid}) : super(key: key); 11 | final String id; 12 | final String name; 13 | final String cid; 14 | 15 | @override 16 | _DeviceInfoState createState() => _DeviceInfoState(id, name, cid); 17 | } 18 | 19 | class _DeviceInfoState extends State { 20 | _DeviceInfoState(id, name, cid) { 21 | _id = id; 22 | _name = name; 23 | _cid = cid; 24 | _initData(); 25 | } 26 | 27 | String _cid; 28 | String _id; 29 | String _name = ''; 30 | int _over = 0; 31 | String _power = ''; 32 | 33 | _initData() async { 34 | String token = await LocalStorage().get("token"); 35 | String url = Config().host + 36 | "/device/readPower?cid=" + 37 | _cid + 38 | "&pin=4" + 39 | "&token=" + 40 | token; 41 | final http.Response response = await http.get(url); 42 | Utf8Decoder utf8decoder = new Utf8Decoder(); 43 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 44 | print(data); 45 | var result = data['code']; 46 | if (result == 0) { 47 | setState(() { 48 | _power = data['data']; 49 | _over = 1; 50 | }); 51 | } else { 52 | setState(() { 53 | _power = '未知'; 54 | _over = 1; 55 | }); 56 | } 57 | } 58 | 59 | _setPower() async { 60 | String token = await LocalStorage().get("token"); 61 | int f = 0; 62 | if(_power =='OFF') 63 | f = 1; 64 | String url = Config().host + 65 | "/device/setPower?cid=" + 66 | _cid + 67 | "&pin=4" + 68 | "&token=" + 69 | token+"&fun="+f.toString(); 70 | final http.Response response = await http.get(url); 71 | Utf8Decoder utf8decoder = new Utf8Decoder(); 72 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 73 | print(data); 74 | var result = data['code']; 75 | if (result == 0) { 76 | setState(() { 77 | _initData(); 78 | }); 79 | } else { 80 | Toast.toast(context, data['msg']); 81 | } 82 | } 83 | 84 | @override 85 | Widget build(BuildContext context) { 86 | return Scaffold( 87 | backgroundColor: Color.fromARGB(255, 255, 255, 255), 88 | appBar: AppBar( 89 | title: Text(_name), 90 | ), 91 | body: _over == 0 92 | ? Container( 93 | child: Container( 94 | child: Center( 95 | child: Image.asset('img/ld.gif'), 96 | ), 97 | ), 98 | ) 99 | : Container( 100 | width: double.infinity, 101 | child: Column( 102 | crossAxisAlignment: CrossAxisAlignment.center, 103 | children: [ 104 | Container( 105 | padding: EdgeInsets.only(top: 30), 106 | height: 300, 107 | child: Image.asset(_power == 'ON' 108 | ? 'img/on.png' 109 | : _power == 'OFF' ? 'img/off.png' : 'img/lx.png'), 110 | ), 111 | Container( 112 | height: 60, 113 | width: 60, 114 | child: IconButton( 115 | iconSize: 50, 116 | icon: Icon(Icons.settings_power), 117 | onPressed: () { 118 | _setPower(); 119 | }), 120 | ) 121 | ], 122 | ), 123 | ), 124 | ); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /lib/page/component/person/device_list.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:cached_network_image/cached_network_image.dart'; 3 | import 'package:http/http.dart' as http; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_wyz/config/config.dart'; 6 | import 'package:flutter_wyz/page/pojo/device.dart'; 7 | import 'package:flutter_wyz/util/Toast.dart'; 8 | import 'package:flutter_wyz/util/local_storage.dart'; 9 | 10 | import 'add_device.dart'; 11 | import 'device_hj.dart'; 12 | import 'device_info.dart'; 13 | 14 | class DeviceList extends StatefulWidget { 15 | @override 16 | _DeviceListState createState() => _DeviceListState(); 17 | } 18 | 19 | class _DeviceListState extends State { 20 | List _list = []; 21 | 22 | _DeviceListState() { 23 | _initData(); 24 | } 25 | Future _flush() async { 26 | 27 | setState(() { 28 | _list = []; 29 | }); 30 | _initData(); 31 | return; 32 | } 33 | _initData() async { 34 | String id = await LocalStorage().get("userId"); 35 | String token = await LocalStorage().get("token"); 36 | String url = Config().host + 37 | "/device/queryByUserId?userId=" + 38 | id + 39 | "&token=" + 40 | token; 41 | final http.Response response = await http.get(url); 42 | Utf8Decoder utf8decoder = new Utf8Decoder(); 43 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 44 | print(data); 45 | var result = data['code']; 46 | if (result == 0) { 47 | List list = []; 48 | List datas = data['data']; 49 | for (int i = 0; i < datas.length; i++) { 50 | list.add(Device.fromJson(datas[i])); 51 | } 52 | setState(() { 53 | _list = list; 54 | }); 55 | } else { 56 | Toast.toast(context, data['msg']); 57 | } 58 | } 59 | 60 | Widget _displayOneDevice(index) { 61 | List _c = _list[index].remark.split("&&"); 62 | print(_c); 63 | String url = _c[2]; 64 | String status = _c[0]; 65 | String name = _c[1]; 66 | return GestureDetector( 67 | onTap: () { 68 | if (_list[index].type == 'cz') 69 | Navigator.push(context, 70 | new MaterialPageRoute(builder: (BuildContext context) { 71 | return DeviceInfo( 72 | id: _list[index].id, name: name, cid: _list[index].sn); 73 | })).then((result) { 74 | _initData(); 75 | }); 76 | else if(_list[index].type == 'hj'){ 77 | Navigator.push(context, 78 | new MaterialPageRoute(builder: (BuildContext context) { 79 | return DeviceHJ( 80 | id: _list[index].id, name: name, cid: _list[index].sn); 81 | })).then((result) { 82 | _initData(); 83 | }); 84 | } 85 | }, 86 | child: Card( 87 | child: Container( 88 | padding: EdgeInsets.all(5), 89 | height: 80, 90 | child: Row( 91 | children: [ 92 | Container( 93 | padding: EdgeInsets.only(left: 10), 94 | child: ClipRRect( 95 | borderRadius: BorderRadius.circular(5), 96 | child: CachedNetworkImage( 97 | imageUrl: 98 | url + "?x-oss-process=image/resize,m_lfit,h_60,w_60"), 99 | ), 100 | ), 101 | Expanded( 102 | child: Container( 103 | padding: EdgeInsets.only(left: 15), 104 | child: Column( 105 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 106 | crossAxisAlignment: CrossAxisAlignment.start, 107 | children: [ 108 | Text( 109 | name, 110 | style: TextStyle(fontSize: 18), 111 | ), 112 | Text(_list[index].sn), 113 | ], 114 | ), 115 | ), 116 | ), 117 | Container( 118 | padding: EdgeInsets.only(right: 15), 119 | child: Text( 120 | status, 121 | style: TextStyle(fontSize: 20), 122 | ), 123 | ) 124 | ], 125 | ), 126 | ), 127 | ), 128 | ); 129 | } 130 | 131 | @override 132 | Widget build(BuildContext context) { 133 | return Scaffold( 134 | appBar: AppBar( 135 | title: Text('主页'), 136 | ), 137 | body: getBody(), 138 | floatingActionButton: FloatingActionButton( 139 | isExtended: true, 140 | onPressed: () { 141 | Navigator.push(context, 142 | new MaterialPageRoute(builder: (BuildContext context) { 143 | return AddDevice(); 144 | })).then((result) { 145 | _initData(); 146 | }); 147 | }, 148 | tooltip: 'Pick Image', 149 | child: Icon(Icons.add), 150 | ), 151 | ); 152 | } 153 | 154 | Widget getBody() { 155 | return (_list == null || _list.length < 1) 156 | ? Container( 157 | child: Center( 158 | child: Text('暂无设备'), 159 | ), 160 | ) 161 | : Container( 162 | child: RefreshIndicator( 163 | child: ListView.builder( 164 | itemCount: _list.length, 165 | itemBuilder: (context, index) { 166 | return _displayOneDevice(index); 167 | }, 168 | ),onRefresh: _flush, 169 | ), 170 | ); 171 | } 172 | } 173 | -------------------------------------------------------------------------------- /lib/page/component/person/head_img.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/config/config.dart'; 3 | import 'package:flutter_wyz/page/component/person/change_head/change_head.dart'; 4 | import 'package:flutter_wyz/page/component/person/change_back_img/change_back_img.dart'; 5 | import 'package:flutter_wyz/page/pojo/user.dart'; 6 | import 'package:flutter_wyz/util/Toast.dart'; 7 | import 'package:flutter_wyz/util/local_storage.dart'; 8 | import 'package:http/http.dart' as http; 9 | import 'dart:convert'; 10 | 11 | class HeadImg extends StatefulWidget { 12 | @override 13 | _HeadImgState createState() => _HeadImgState(); 14 | } 15 | 16 | class _HeadImgState extends State { 17 | User user = new User(null, "", ""); 18 | List matrix = [ 19 | 0.5, 20 | 0, 21 | 0, 22 | 0, 23 | 0, 24 | 0, 25 | 0.5, 26 | 0, 27 | 0, 28 | 0, 29 | 0, 30 | 0, 31 | 0.5, 32 | 0, 33 | 0, 34 | 0, 35 | 0, 36 | 1, 37 | 0.9, 38 | 0 39 | ]; 40 | 41 | _HeadImgState() { 42 | _initData(); 43 | } 44 | 45 | _initData() async { 46 | String id = await LocalStorage().get("userId"); 47 | String token = await LocalStorage().get("token"); 48 | String url = Config().host + "/user?id=" + id + "&token=" + token; 49 | final http.Response response = await http.get(url); 50 | Utf8Decoder utf8decoder = new Utf8Decoder(); 51 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 52 | print(data); 53 | var result = data['code']; 54 | if (result == 0) { 55 | setState(() { 56 | user = new User.fromJson(data['data']); 57 | }); 58 | } else { 59 | Toast.toast(context, data['msg']); 60 | } 61 | } 62 | 63 | @override 64 | Widget build(BuildContext context) { 65 | return user.id == null 66 | ? Container() 67 | : Container( 68 | decoration: BoxDecoration( 69 | image: DecorationImage( 70 | colorFilter: ColorFilter.matrix(matrix), 71 | image: user.backImg == null 72 | ? AssetImage("img/pp.png") 73 | : NetworkImage(user.backImg), 74 | fit: BoxFit.cover), 75 | ), 76 | child: Column( 77 | children: [ 78 | GestureDetector( 79 | onTap: () { 80 | Navigator.push(context, 81 | new MaterialPageRoute(builder: (BuildContext context) { 82 | return ChangeBackImg(); 83 | })); 84 | }, 85 | child: Container( 86 | height: 120, 87 | child: Row( 88 | children: [ 89 | Padding( 90 | padding: EdgeInsets.fromLTRB(30.0, 0.0, 0, 0), 91 | child: GestureDetector( 92 | onTap: () { 93 | Navigator.push(context, new MaterialPageRoute( 94 | builder: (BuildContext context) { 95 | return ChangeHead(); 96 | })); 97 | }, 98 | child: Container( 99 | decoration: BoxDecoration( 100 | border: Border.all( 101 | color: Colors.white, 102 | width: 1, 103 | ), 104 | borderRadius: BorderRadius.all(Radius.circular(80))), 105 | height: 80, 106 | width: 80, 107 | child: ClipOval( 108 | child: Image.network(user.headUrl == null 109 | ? 'https://assets-store-cdn.48lu.cn/assets-store/5002cfc3bf41f67f51b1d979ca2bd637.png' 110 | : user.headUrl), 111 | ), 112 | ), 113 | ), 114 | ), 115 | Expanded( 116 | child: Padding( 117 | padding: EdgeInsets.fromLTRB(20, 0, 0, 20), 118 | child: Container( 119 | // color: Colors.red, 120 | color: Color.fromARGB(0, 1, 1, 1), 121 | height: 100, 122 | child: Container( 123 | height: 60, 124 | child: Column( 125 | mainAxisAlignment: MainAxisAlignment.start, 126 | crossAxisAlignment: CrossAxisAlignment.start, 127 | children: [ 128 | Padding( 129 | padding: EdgeInsets.only(top: 20), 130 | child: Text( 131 | user.name == null ? '' : user.name, 132 | style: TextStyle( 133 | color: Colors.white, fontSize: 20), 134 | ), 135 | ), 136 | Padding( 137 | padding: EdgeInsets.only(top: 10), 138 | child: Text( 139 | user.phone == null ? '' : user.phone, 140 | style: TextStyle( 141 | color: Colors.white, fontSize: 17), 142 | ), 143 | ), 144 | ], 145 | ), 146 | ), 147 | ), 148 | ), 149 | ), 150 | ], 151 | ), 152 | ), 153 | ), 154 | Center( 155 | child: Padding( 156 | padding: EdgeInsets.fromLTRB(20, 0, 20, 20), 157 | child: Text( 158 | user.autograph == null ? '未签名' : user.autograph, 159 | textAlign: TextAlign.center, 160 | maxLines: 2, 161 | style: TextStyle( 162 | height: 1.3, 163 | color: Colors.white, 164 | fontSize: 18, 165 | decoration: TextDecoration.underline, 166 | fontStyle: FontStyle.italic, 167 | decorationColor: Colors.deepOrange, 168 | wordSpacing: 22, 169 | ), 170 | ), 171 | ), 172 | ) 173 | ], 174 | ), 175 | ); 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /lib/page/component/person/menu.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/page/component/person/change_autograph/change_autograph.dart'; 3 | import 'package:flutter_wyz/page/component/person/name/change_name.dart'; 4 | import 'package:flutter_wyz/page/component/person/psd/change_password.dart'; 5 | import 'package:flutter_wyz/page/login/login.dart'; 6 | import 'package:flutter_wyz/util/Toast.dart'; 7 | import 'package:flutter_wyz/util/local_storage.dart'; 8 | 9 | import 'device_list.dart'; 10 | 11 | class Menu extends StatefulWidget { 12 | @override 13 | _MenuState createState() => _MenuState(); 14 | } 15 | 16 | class _MenuState extends State { 17 | _loginOut() async { 18 | await LocalStorage().set("userId", "-1"); 19 | await LocalStorage().set("token", "1-1"); 20 | Navigator.of(context).pushAndRemoveUntil( 21 | MaterialPageRoute(builder: (context) => Login()), 22 | (route) => route == null); 23 | } 24 | 25 | _confirm() { 26 | showDialog( 27 | context: context, 28 | barrierDismissible: false, 29 | builder: (BuildContext context) { 30 | return new AlertDialog( 31 | title: Text('提示'), 32 | content: SingleChildScrollView( 33 | child: Text('确定要退出登录吗?'), 34 | ), 35 | actions: [ 36 | Row( 37 | children: [ 38 | FlatButton( 39 | child: Text('取消'), 40 | onPressed: () { 41 | Navigator.pop(context); 42 | }, 43 | ), 44 | FlatButton( 45 | child: Text('确定'), 46 | onPressed: () { 47 | _loginOut(); 48 | }, 49 | ), 50 | ], 51 | ), 52 | ], 53 | ); 54 | }, 55 | ); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return Container( 61 | child: Expanded( 62 | child: SingleChildScrollView( 63 | child: Container( 64 | child: Column( 65 | children: [ 66 | Container( 67 | height: 2, 68 | color: Colors.black12, 69 | ), 70 | GestureDetector( 71 | onTap: () { 72 | Navigator.push(context, 73 | new MaterialPageRoute(builder: (BuildContext context) { 74 | return DeviceList(); 75 | })); 76 | }, 77 | child: Padding( 78 | padding: EdgeInsets.only(top: 1, left: 35, right: 15), 79 | child: Container( 80 | color: Colors.white, 81 | height: 45, 82 | child: Row( 83 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 84 | children: [ 85 | Text( 86 | '设备列表', 87 | style: TextStyle(fontSize: 18, color: Colors.black), 88 | ), 89 | Icon( 90 | Icons.arrow_forward_ios, 91 | color: Colors.blueAccent, 92 | ), 93 | ], 94 | ), 95 | ), 96 | ), 97 | ), 98 | Container( 99 | height: 2, 100 | color: Colors.black12, 101 | ), 102 | GestureDetector( 103 | onTap: () { 104 | Navigator.push(context, 105 | new MaterialPageRoute(builder: (BuildContext context) { 106 | return ChangePassword(); 107 | })); 108 | }, 109 | child: Padding( 110 | padding: EdgeInsets.only(top: 1, left: 35, right: 15), 111 | child: Container( 112 | color: Colors.white, 113 | height: 45, 114 | child: Row( 115 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 116 | children: [ 117 | Text( 118 | '修改密码', 119 | style: TextStyle(fontSize: 18, color: Colors.black), 120 | ), 121 | Icon( 122 | Icons.arrow_forward_ios, 123 | color: Colors.blueAccent, 124 | ), 125 | ], 126 | ), 127 | ), 128 | ), 129 | ), 130 | Container( 131 | height: 2, 132 | color: Colors.black12, 133 | ), 134 | GestureDetector( 135 | onTap: () { 136 | Navigator.push(context, 137 | new MaterialPageRoute(builder: (BuildContext context) { 138 | return ChangeAutograph(); 139 | })); 140 | }, 141 | child: Padding( 142 | padding: EdgeInsets.only(top: 1, left: 35, right: 15), 143 | child: Container( 144 | color: Colors.white, 145 | height: 45, 146 | child: Row( 147 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 148 | children: [ 149 | Text( 150 | '修改签名', 151 | style: TextStyle(fontSize: 18, color: Colors.black), 152 | ), 153 | Icon( 154 | Icons.arrow_forward_ios, 155 | color: Colors.blueAccent, 156 | ), 157 | ], 158 | ), 159 | ), 160 | ), 161 | ), 162 | Container( 163 | height: 2, 164 | color: Colors.black12, 165 | ), 166 | GestureDetector( 167 | onTap: () { 168 | Navigator.push(context, 169 | new MaterialPageRoute(builder: (BuildContext context) { 170 | return ChangeName(); 171 | })); 172 | }, 173 | child: Padding( 174 | padding: EdgeInsets.only(top: 1, left: 35, right: 15), 175 | child: Container( 176 | color: Colors.white, 177 | height: 45, 178 | child: Row( 179 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 180 | children: [ 181 | Text( 182 | '修改昵称', 183 | style: TextStyle(fontSize: 18, color: Colors.black), 184 | ), 185 | Icon( 186 | Icons.arrow_forward_ios, 187 | color: Colors.blueAccent, 188 | ), 189 | ], 190 | ), 191 | ), 192 | ), 193 | ), 194 | Container( 195 | height: 2, 196 | color: Colors.black12, 197 | ), 198 | GestureDetector( 199 | onTap: _confirm, 200 | child: Padding( 201 | padding: EdgeInsets.only(top: 1, left: 35, right: 15), 202 | child: Container( 203 | color: Colors.white, 204 | height: 45, 205 | child: Row( 206 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 207 | children: [ 208 | Text( 209 | '退出登录', 210 | style: TextStyle(fontSize: 18, color: Colors.black), 211 | ), 212 | Icon( 213 | Icons.arrow_forward_ios, 214 | color: Colors.blueAccent, 215 | ), 216 | ], 217 | ), 218 | ), 219 | ), 220 | ), 221 | Container( 222 | height: 2, 223 | color: Colors.black12, 224 | ), 225 | ], 226 | ), 227 | ), 228 | ), 229 | ), 230 | ); 231 | } 232 | } 233 | -------------------------------------------------------------------------------- /lib/page/component/person/name/change_name.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/config/config.dart'; 3 | import 'package:flutter_wyz/page/index/index.dart'; 4 | import 'package:flutter_wyz/page/pojo/user.dart'; 5 | import 'package:flutter_wyz/util/Toast.dart'; 6 | import 'package:flutter_wyz/util/local_storage.dart'; 7 | import 'package:http/http.dart' as http; 8 | import 'dart:convert'; 9 | 10 | class ChangeName extends StatefulWidget { 11 | @override 12 | _ChangeNameState createState() => _ChangeNameState(); 13 | } 14 | 15 | class _ChangeNameState extends State { 16 | bool _pwdState = false; 17 | TextEditingController _pwdcontroller1 = new TextEditingController(); 18 | String _checkStr; 19 | User user = new User(null, null, null); 20 | 21 | _ChangeNameState() { 22 | _initData(); 23 | } 24 | 25 | void _checkPwd() { 26 | if (_pwdcontroller1.text.isNotEmpty && 27 | _pwdcontroller1.text.trim().length >= 1) { 28 | _pwdState = true; 29 | } else { 30 | _pwdState = false; 31 | } 32 | } 33 | 34 | _initData() async { 35 | String id = await LocalStorage().get("userId"); 36 | String token = await LocalStorage().get("token"); 37 | String url = Config().host + "/user?id=" + id + "&token=" + token; 38 | final http.Response response = await http.get(url); 39 | Map data = json.decode(response.body); 40 | print(data); 41 | var result = data['code']; 42 | if (result == 0) { 43 | setState(() { 44 | user = new User.fromJson(data['data']); 45 | _pwdcontroller1.text = user.name; 46 | }); 47 | } else { 48 | Toast.toast(context, data['msg']); 49 | } 50 | } 51 | 52 | _changeName() async { 53 | var namel = _pwdcontroller1.text.length; 54 | if(namel>8){ 55 | showDialog( 56 | context: context, 57 | barrierDismissible: false, 58 | builder: (BuildContext context) { 59 | return new AlertDialog( 60 | title: Text('提示'), 61 | content: SingleChildScrollView( 62 | child: Text('名称不能超过8个字'), 63 | ), 64 | actions: [ 65 | Row( 66 | children: [ 67 | FlatButton( 68 | child: Text('好的'), 69 | onPressed: () { 70 | Navigator.pop(context); 71 | }, 72 | ), 73 | ], 74 | ), 75 | ], 76 | ); 77 | }, 78 | ); 79 | return; 80 | }else{ 81 | Toast.toast(context, '提交中'); 82 | } 83 | String token = await LocalStorage().get("token"); 84 | String id = await LocalStorage().get("userId"); 85 | String url = Config().host + "/user?token=" + token; 86 | String datax = json.encode({'name': _pwdcontroller1.text, 'id': id}); 87 | print(datax); 88 | final http.Response response = await http.put(url, body: datax); 89 | Utf8Decoder utf8decoder = new Utf8Decoder(); 90 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 91 | print(data); 92 | var result = data['code']; 93 | if (result == 0) { 94 | await LocalStorage().set("labelId", '3'); 95 | Navigator.of(context).pushAndRemoveUntil( 96 | MaterialPageRoute(builder: (context) => Index()), 97 | (route) => route == null); 98 | } else { 99 | Toast.toast(context, data['msg']); 100 | } 101 | } 102 | 103 | @override 104 | Widget build(BuildContext context) { 105 | return Scaffold( 106 | appBar: new AppBar( 107 | title: new Text('修改基本信息'), 108 | ), 109 | body: new ListView( 110 | children: [ 111 | new Column( 112 | mainAxisSize: MainAxisSize.max, 113 | mainAxisAlignment: MainAxisAlignment.start, 114 | children: [ 115 | new Padding( 116 | padding: new EdgeInsets.fromLTRB(20.0, 55.0, 20.0, 40.0), 117 | child: new Row( 118 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 119 | children: [ 120 | new Padding( 121 | padding: new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 122 | child: Icon(Icons.calendar_view_day)), 123 | new Expanded( 124 | child: new TextField( 125 | controller: _pwdcontroller1, 126 | decoration: new InputDecoration( 127 | hintText: '请输入昵称', 128 | suffixIcon: new IconButton( 129 | icon: 130 | new Icon(Icons.clear, color: Colors.black45), 131 | onPressed: () { 132 | _pwdcontroller1.clear(); 133 | }, 134 | ), 135 | ), 136 | obscureText: false, 137 | ), 138 | ), 139 | ]), 140 | ), 141 | new Container( 142 | width: 340.0, 143 | child: new Card( 144 | color: Colors.blue, 145 | elevation: 16.0, 146 | child: new FlatButton( 147 | child: new Padding( 148 | padding: new EdgeInsets.all(10.0), 149 | child: new Text( 150 | '修改', 151 | style: 152 | new TextStyle(color: Colors.white, fontSize: 16.0), 153 | ), 154 | ), 155 | onPressed: () { 156 | _checkStr = null; 157 | ; 158 | _checkPwd(); 159 | if (!_pwdState) { 160 | _checkStr = '请输入6-20位密码!'; 161 | } 162 | 163 | print(_checkStr); 164 | if (_checkStr == null || _checkStr == "") { 165 | _changeName(); 166 | } else { 167 | Toast.toast(context, _checkStr); 168 | } 169 | }, 170 | ), 171 | ), 172 | ), 173 | ], 174 | ), 175 | ], 176 | ), 177 | ); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /lib/page/component/person/psd/change_password.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/util/Toast.dart'; 3 | import 'package:flutter_wyz/util/local_storage.dart'; 4 | import 'package:flutter_wyz/config/config.dart'; 5 | import 'package:http/http.dart' as http; 6 | import 'dart:convert'; 7 | 8 | class ChangePassword extends StatefulWidget { 9 | @override 10 | _ChangePasswordState createState() => _ChangePasswordState(); 11 | } 12 | 13 | class _ChangePasswordState extends State { 14 | bool _pwdState = false; 15 | TextEditingController _pwdcontroller1 = new TextEditingController(); 16 | TextEditingController _pwdcontroller2 = new TextEditingController(); 17 | String _checkStr; 18 | 19 | void _checkPwd() { 20 | if (_pwdcontroller2.text.isNotEmpty && 21 | _pwdcontroller2.text.trim().length >= 6 && 22 | _pwdcontroller2.text.trim().length <= 20) { 23 | _pwdState = true; 24 | } else { 25 | _pwdState = false; 26 | } 27 | } 28 | 29 | _changePassword() async { 30 | String token = await LocalStorage().get("token"); 31 | String id = await LocalStorage().get("userId"); 32 | String url = Config().host + 33 | "/user/changePassword?token=" + 34 | token + 35 | "&oldPassword=" + 36 | _pwdcontroller1.text + 37 | "&newPassword=" + 38 | _pwdcontroller2.text + 39 | "&id=" + 40 | id; 41 | final http.Response response = await http.get(url); 42 | var data = json.decode(response.body); 43 | print(data); 44 | var result = data['code']; 45 | if (result == 0) { 46 | Navigator.pop(context); 47 | Toast.toast(context, '密码修改成功!'); 48 | } else { 49 | Toast.toast(context, data['msg']); 50 | } 51 | print(result); 52 | } 53 | 54 | @override 55 | Widget build(BuildContext context) { 56 | return Scaffold( 57 | appBar: new AppBar( 58 | title: new Text('修改密码'), 59 | ), 60 | body: new ListView( 61 | children: [ 62 | new Column( 63 | mainAxisSize: MainAxisSize.max, 64 | mainAxisAlignment: MainAxisAlignment.start, 65 | children: [ 66 | new Padding( 67 | padding: new EdgeInsets.fromLTRB(20.0, 55.0, 20.0, 40.0), 68 | child: new Row( 69 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 70 | children: [ 71 | new Padding( 72 | padding: new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 73 | child: Icon(Icons.lock)), 74 | new Expanded( 75 | child: new TextField( 76 | controller: _pwdcontroller1, 77 | decoration: new InputDecoration( 78 | hintText: '请输入旧密码', 79 | suffixIcon: new IconButton( 80 | icon: 81 | new Icon(Icons.clear, color: Colors.black45), 82 | onPressed: () { 83 | _pwdcontroller1.clear(); 84 | }, 85 | ), 86 | ), 87 | obscureText: true, 88 | ), 89 | ), 90 | ]), 91 | ), 92 | new Padding( 93 | padding: new EdgeInsets.fromLTRB(20.0, 0, 20.0, 40.0), 94 | child: new Row( 95 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 96 | children: [ 97 | new Padding( 98 | padding: new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 99 | child: Icon(Icons.lock)), 100 | new Expanded( 101 | child: new TextField( 102 | controller: _pwdcontroller2, 103 | decoration: new InputDecoration( 104 | hintText: '请输入新密码', 105 | suffixIcon: new IconButton( 106 | icon: 107 | new Icon(Icons.clear, color: Colors.black45), 108 | onPressed: () { 109 | _pwdcontroller2.clear(); 110 | }, 111 | ), 112 | ), 113 | obscureText: true, 114 | ), 115 | ), 116 | ]), 117 | ), 118 | new Container( 119 | width: 340.0, 120 | child: new Card( 121 | color: Colors.blue, 122 | elevation: 16.0, 123 | child: new FlatButton( 124 | child: new Padding( 125 | padding: new EdgeInsets.all(10.0), 126 | child: new Text( 127 | '修改', 128 | style: 129 | new TextStyle(color: Colors.white, fontSize: 16.0), 130 | ), 131 | ), 132 | onPressed: () { 133 | _checkStr = null; 134 | ; 135 | _checkPwd(); 136 | if (!_pwdState) { 137 | _checkStr = '请输入6-20位密码!'; 138 | } 139 | 140 | print(_checkStr); 141 | if (_checkStr == null || _checkStr == "") { 142 | _changePassword(); 143 | Toast.toast(context, '提交中'); 144 | } else { 145 | Toast.toast(context, _checkStr); 146 | } 147 | }, 148 | ), 149 | ), 150 | ), 151 | ], 152 | ), 153 | ], 154 | ), 155 | ); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /lib/page/component/user/add_user.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/page/component/user/qrcode.dart'; 3 | import 'package:flutter_wyz/page/component/user/user_info.dart'; 4 | 5 | class AddUser extends StatefulWidget { 6 | @override 7 | _AddUserState createState() => _AddUserState(); 8 | } 9 | 10 | class _AddUserState extends State { 11 | @override 12 | Widget build(BuildContext context) { 13 | return Container( 14 | height: 100, 15 | child: Row( 16 | mainAxisAlignment: MainAxisAlignment.spaceAround, 17 | children: [ 18 | MaterialButton( 19 | color: Colors.blue, 20 | onPressed: () { 21 | Navigator.push(context, 22 | new MaterialPageRoute(builder: (BuildContext context) { 23 | return UserInfo(); 24 | })); 25 | }, 26 | child: Text( 27 | "添加人员", 28 | style: TextStyle(color: Colors.white), 29 | ), 30 | ), 31 | MaterialButton( 32 | color: Colors.blue, 33 | onPressed: () { 34 | Navigator.push(context, 35 | new MaterialPageRoute(builder: (BuildContext context) { 36 | return Qrcode(); 37 | })); 38 | }, 39 | child: Text( 40 | "扫码添加", 41 | style: TextStyle(color: Colors.white), 42 | ), 43 | ), 44 | ], 45 | ), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/page/component/user/qrcode.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | //import 'package:qrscan/qrscan.dart' as scanner; 3 | //import 'package:simple_permissions/simple_permissions.dart'; 4 | import 'package:barcode_scan/barcode_scan.dart'; 5 | class Qrcode extends StatefulWidget { 6 | @override 7 | _QrcodeState createState() => _QrcodeState(); 8 | } 9 | 10 | class _QrcodeState extends State { 11 | String _qrcode = '未扫码'; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | // scan() async { 16 | // bool res = await SimplePermissions.checkPermission(Permission.Camera); 17 | // print(res); 18 | // if (!res) { 19 | // await SimplePermissions.requestPermission(Permission.Camera); 20 | // res = await SimplePermissions.checkPermission(Permission.Camera); 21 | // } 22 | // print(res); 23 | // if (res) { 24 | // String result = await scanner.scan(); 25 | // print(result); 26 | // if (!mounted) return; 27 | // setState(() { 28 | // _qrcode = result; 29 | // }); 30 | // } 31 | // } 32 | 33 | scan() async { 34 | print('start qr code'); 35 | try { 36 | String barcode = await BarcodeScanner.scan(); 37 | setState(() { 38 | _qrcode = barcode; 39 | }); 40 | } catch (e) { 41 | setState(() { 42 | _qrcode ='error'; 43 | }); 44 | } 45 | } 46 | 47 | return Scaffold( 48 | body: Padding( 49 | padding: EdgeInsets.all(40), 50 | child: Center( 51 | child: Column( 52 | crossAxisAlignment: CrossAxisAlignment.center, 53 | children: [ 54 | Text(_qrcode), 55 | MaterialButton( 56 | color: Colors.blue, 57 | onPressed: scan, 58 | child: Text( 59 | "扫码", 60 | style: TextStyle(color: Colors.white), 61 | ), 62 | ), 63 | ], 64 | )), 65 | ), 66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/page/component/user/user_info.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter_wyz/config/config.dart'; 3 | import 'package:flutter_wyz/util/local_storage.dart'; 4 | import 'package:image_crop/image_crop.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:image_picker/image_picker.dart'; 7 | import 'dart:convert'; 8 | import 'package:http/http.dart' as http; 9 | 10 | class UserInfo extends StatefulWidget { 11 | @override 12 | _UserInfoState createState() => _UserInfoState(); 13 | } 14 | 15 | class _UserInfoState extends State { 16 | 17 | String _imageUrl = null; 18 | File _image; 19 | final cropKey = GlobalKey(); 20 | 21 | Future getImage() async { 22 | var image = await ImagePicker.pickImage(source: ImageSource.gallery); 23 | 24 | setState(() { 25 | _image = image; 26 | }); 27 | } 28 | 29 | uploadPic(data1) async { 30 | var url = Config().host + '/file/uploadBase64'; 31 | try { 32 | final http.Response response = await http.post(url, body: data1); 33 | var data = json.decode(response.body); 34 | setState(() { 35 | _imageUrl = data['data']; 36 | print(_imageUrl); 37 | }); 38 | } catch (e) { 39 | print("上传文件失败"); 40 | } 41 | } 42 | 43 | pic() async { 44 | final crop = cropKey.currentState; 45 | final scale = crop.scale; 46 | final area = crop.area; 47 | if (area == null) { 48 | print("error"); 49 | } else { 50 | // final permissionsGranted = await ImageCrop.requestPermissions(); 51 | // print("error"); 52 | // print(permissionsGranted); 53 | final sampledFile = await ImageCrop.sampleImage( 54 | file: _image, 55 | preferredWidth: (512 / crop.scale).round(), 56 | preferredHeight: (512 / crop.scale).round(), 57 | ); 58 | final croppedFile = await ImageCrop.cropImage( 59 | file: sampledFile, 60 | area: crop.area, 61 | ); 62 | setState(() { 63 | _image = croppedFile; 64 | var image_base64 = base64.encode(_image.readAsBytesSync()); 65 | uploadPic(image_base64); 66 | }); 67 | } 68 | } 69 | 70 | @override 71 | Widget build(BuildContext context) { 72 | return Scaffold( 73 | appBar: AppBar( 74 | title: Text('Image Picker Example'), 75 | ), 76 | body: Column( 77 | children: [ 78 | Offstage( 79 | offstage: _imageUrl == null, 80 | child: Column( 81 | children: [ 82 | Padding( 83 | padding: EdgeInsets.all(30), 84 | child: Center( 85 | child: Text('头像上传成功!!'), 86 | ), 87 | ), 88 | Padding( 89 | padding: EdgeInsets.all(20), 90 | child: 91 | _imageUrl == null ? Text("") : Image.network(_imageUrl), 92 | ), 93 | ], 94 | ), 95 | ), 96 | Offstage( 97 | offstage: _imageUrl != null, 98 | child: _image == null 99 | ? Center( 100 | child: Padding( 101 | padding: EdgeInsets.only( 102 | right: 0, 103 | left: 0, 104 | bottom: 0, 105 | top: 100, 106 | ), 107 | child: Text('未选择图片'), 108 | ), 109 | ) 110 | : Container( 111 | padding: EdgeInsets.all(50), 112 | height: 400, 113 | width: 400, 114 | child: Crop( 115 | key: cropKey, 116 | image: FileImage(_image), 117 | aspectRatio: 1.0 / 1.0, 118 | ), 119 | ), 120 | ), 121 | Offstage( 122 | offstage: !(_imageUrl == null && _image != null), 123 | child: Row( 124 | mainAxisAlignment: MainAxisAlignment.center, 125 | children: [ 126 | MaterialButton( 127 | color: Colors.blue, 128 | onPressed: pic, 129 | child: Text( 130 | '裁剪', 131 | style: TextStyle(color: Colors.white), 132 | ), 133 | ), 134 | ], 135 | ), 136 | ), 137 | ], 138 | ), 139 | floatingActionButton: Offstage( 140 | offstage: _image != null, 141 | child: FloatingActionButton( 142 | isExtended: true, 143 | onPressed: getImage, 144 | tooltip: 'Pick Image', 145 | child: Icon(Icons.add_a_photo), 146 | ), 147 | // ), 148 | ), 149 | ); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /lib/page/content/airplay_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/page/component/person/head_img.dart'; 3 | import 'package:flutter_wyz/page/component/person/menu.dart'; 4 | 5 | class AirPlayScreen extends StatelessWidget{ 6 | @override 7 | Widget build(BuildContext context) { 8 | return Scaffold( 9 | appBar: AppBar(title: Text('个人中心'),), 10 | body: Column( 11 | children: [ 12 | HeadImg(), 13 | Menu(), 14 | ], 15 | ), 16 | ); 17 | } 18 | } -------------------------------------------------------------------------------- /lib/page/content/email_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/page/component/friend/friend_my.dart'; 3 | import 'package:flutter_wyz/page/component/friend/my_friend.dart'; 4 | 5 | class EmailScreen extends StatefulWidget { 6 | @override 7 | _EmailScreen createState() => _EmailScreen(); 8 | } 9 | 10 | class _EmailScreen extends State { 11 | final List _m = [0, 1]; 12 | final List _ms = ['我关注的', '关注我的']; 13 | int _c = 0; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Scaffold( 18 | appBar: AppBar( 19 | title: Text('好友'), 20 | ), 21 | body: Column( 22 | children: [ 23 | Row( 24 | children: [ 25 | Expanded( 26 | child: GestureDetector( 27 | onTap: () { 28 | setState(() { 29 | _c = 0; 30 | }); 31 | }, 32 | child: Container( 33 | color: Color.fromARGB(255, 255, 255, 255), 34 | height: 50, 35 | width: double.infinity, 36 | child: Center( 37 | child: Text( 38 | _ms[0], 39 | style: TextStyle( 40 | fontSize: _c == 0 ? 20 : 18, 41 | color: _c == 0 42 | ? Color.fromARGB(255, 1, 1, 1) 43 | : Color.fromARGB(255, 100, 100, 100), 44 | ), 45 | ), 46 | ), 47 | ), 48 | ), 49 | ), 50 | Expanded( 51 | child: GestureDetector( 52 | onTap: () { 53 | setState(() { 54 | _c = 1; 55 | }); 56 | }, 57 | child: Container( 58 | color: Color.fromARGB(255, 255, 255, 255), 59 | height: 50, 60 | width: double.infinity, 61 | child: Center( 62 | child: Text( 63 | _ms[1], 64 | style: TextStyle( 65 | fontSize: _c == 1 ? 20 : 18, 66 | color: _c == 1 67 | ? Color.fromARGB(255, 1, 1, 1) 68 | : Color.fromARGB(255, 100, 100, 100), 69 | ), 70 | ), 71 | ), 72 | ), 73 | ), 74 | ), 75 | ], 76 | ), 77 | Row( 78 | children: [ 79 | Expanded( 80 | child: Container( 81 | height: 2, 82 | color: _c == 0 ? Colors.blue : Colors.black26, 83 | width: double.infinity, 84 | ), 85 | ), 86 | Expanded( 87 | child: Container( 88 | height: 2, 89 | color: _c == 1 ? Colors.blue : Colors.black26, 90 | width: double.infinity, 91 | ), 92 | ), 93 | ], 94 | ), 95 | Expanded( 96 | child: Container( 97 | color: Color.fromARGB(255, 250, 250, 250), 98 | width: double.infinity, 99 | child: _c == 0 ? MyFriend(id: "0") : FriendMy(id: "0"), 100 | ), 101 | ) 102 | ], 103 | ), 104 | ); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /lib/page/content/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/page/component/list/user_list.dart'; 3 | import 'package:flutter_wyz/page/component/msg/msg_add.dart'; 4 | import 'package:flutter_wyz/page/component/msg/msg_home.dart'; 5 | import 'package:flutter_wyz/page/component/user/add_user.dart'; 6 | 7 | class HomeScreen extends StatefulWidget { 8 | @override 9 | _HomeScreen createState() => _HomeScreen(); 10 | } 11 | 12 | class _HomeScreen extends State { 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | appBar: AppBar( 17 | title: Text('主页'), 18 | ), 19 | body: MsgHome(), 20 | floatingActionButton: FloatingActionButton( 21 | isExtended: true, 22 | onPressed: () { 23 | Navigator.push(context, 24 | new MaterialPageRoute(builder: (BuildContext context) { 25 | return MsgAdd(); 26 | })).then((result) { 27 | if (result == 'flush') { 28 | 29 | } 30 | }); 31 | }, 32 | tooltip: 'Pick Image', 33 | child: Icon(Icons.add), 34 | ), 35 | // ), 36 | // body: Column( 37 | // children: [ 38 | // AddUser(), 39 | // UserList(), 40 | // ], 41 | // ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/page/content/pages_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_wyz/page/component/chat/chat_list.dart'; 3 | 4 | class PagesScreen extends StatelessWidget{ 5 | @override 6 | Widget build(BuildContext context) { 7 | return Scaffold( 8 | appBar: AppBar( 9 | title: Text('消息中心'), 10 | ), 11 | body: ChatList(), 12 | ); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /lib/page/index/index.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'dart:io'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:flutter_wyz/config/all_data.dart'; 6 | import 'package:http/http.dart' as http; 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_wyz/config/config.dart'; 9 | import 'package:flutter_wyz/page/content/airplay_screen.dart'; 10 | import 'package:flutter_wyz/page/content/email_screen.dart'; 11 | import 'package:flutter_wyz/page/content/home_screen.dart'; 12 | import 'package:flutter_wyz/page/content/pages_screen.dart'; 13 | import 'package:flutter_wyz/util/local_storage.dart'; 14 | import 'package:jpush_flutter/jpush_flutter.dart'; 15 | //import 'package:local_notifications/local_notifications.dart'; //android only 16 | 17 | class Index extends StatefulWidget { 18 | @override 19 | State createState() => IndexState(); 20 | } 21 | 22 | class IndexState extends State with WidgetsBindingObserver { 23 | String debugLable = 'Unknown'; 24 | final JPush jpush = new JPush(); 25 | String tsinit = "no"; 26 | bool sd = false; 27 | bool at = false; 28 | bool be = false; 29 | 30 | Future initPlatformState(id) async { 31 | String platformVersion; 32 | 33 | print('-----------fff------------->>' + id); 34 | jpush.setAlias(id); 35 | // Platform messages may fail, so we use a try/catch PlatformException. 36 | jpush.getRegistrationID().then((rid) { 37 | setState(() { 38 | debugLable = "flutter getRegistrationID: $rid"; 39 | print('000000000000000000000>>>' + rid); 40 | }); 41 | }); 42 | 43 | jpush.setup( 44 | appKey: "ce53da8fe966805f893421bb", 45 | channel: "theChannel", 46 | production: true, 47 | debug: false, 48 | ); 49 | jpush.applyPushAuthority( 50 | new NotificationSettingsIOS(sound: sd, alert: at, badge: be)); 51 | 52 | try { 53 | jpush.addEventHandler( 54 | onReceiveNotification: (Map message) async { 55 | print("flutter onReceiveNotification: $message"); 56 | await LocalStorage().set("havaNewMsg", '1'); 57 | setState(() { 58 | _msg = Icon( 59 | Icons.speaker_notes, 60 | color: Colors.redAccent, 61 | ); 62 | _onNew = false; 63 | }); 64 | setState(() { 65 | debugLable = "flutter onReceiveNotification: $message"; 66 | }); 67 | }, 68 | onOpenNotification: (Map message) async { 69 | print("flutter onOpenNotification: $message"); 70 | setState(() { 71 | debugLable = "flutter onOpenNotification: $message"; 72 | }); 73 | }, 74 | onReceiveMessage: (Map message) async { 75 | print("flutter onReceiveMessage: $message"); 76 | setState(() { 77 | debugLable = "flutter onReceiveMessage: $message"; 78 | }); 79 | }, 80 | ); 81 | } on PlatformException { 82 | platformVersion = 'Failed to get platform version.'; 83 | } 84 | 85 | // If the widget was removed from the tree while the asynchronous platform 86 | // message was in flight, we want to discard the reply rather than calling 87 | // setState to update our non-existent appearance. 88 | if (!mounted) return; 89 | 90 | setState(() { 91 | debugLable = platformVersion; 92 | }); 93 | } 94 | 95 | final _bottomNavigationColor = Colors.blue; 96 | int _currentIndex = 0; 97 | List list = List(); 98 | 99 | IndexState() { 100 | initLabel(); 101 | _idAndToken(); 102 | _tgo(); 103 | } 104 | 105 | Icon _msg = Icon( 106 | Icons.chat, 107 | color: Colors.blue, 108 | ); 109 | 110 | Timer _ct; 111 | 112 | bool _onNew = false; 113 | 114 | String _token = ""; 115 | 116 | String _id = ""; 117 | 118 | static int _idX = 0; 119 | 120 | _idAndToken() async { 121 | _id = await LocalStorage().get("userId"); 122 | // initPlatformState(_id); 123 | _token = await LocalStorage().get("token"); 124 | } 125 | 126 | void _tgo() { 127 | _ct = Timer.periodic(new Duration(seconds: 6), (timer) { 128 | if (!_onNew) { 129 | if (!sd) _chatNew(); 130 | } 131 | }); 132 | } 133 | 134 | // android only 135 | // static _onNotificationClick(String payload) { 136 | // LocalNotifications.removeNotification(_idX); 137 | // print("消息已被阅读"); 138 | // } 139 | // 140 | // static const AndroidNotificationChannel channel = 141 | // const AndroidNotificationChannel( 142 | // id: 'default_notification', 143 | // name: 'Default', 144 | // description: 'Grant this app the ability to show notifications', 145 | // importance: AndroidNotificationImportance.HIGH); 146 | 147 | _chatNew() async { 148 | try { 149 | String url = 150 | Config().host + "/chat/newMsg?userId=" + _id + "&token=" + _token; 151 | final http.Response response = await http.get(url); 152 | Utf8Decoder utf8decoder = new Utf8Decoder(); 153 | Map data = json.decode(utf8decoder.convert(response.bodyBytes)); 154 | print(data); 155 | var result = data['code']; 156 | if (result == 0) { 157 | await LocalStorage().set("havaNewMsg", '1'); 158 | if (!Platform.isAndroid) { 159 | } else { 160 | var tz = await LocalStorage().get("tz101"); 161 | if (tz == 'yes') { 162 | _idX++; 163 | 164 | //android only 165 | // await LocalNotifications.createAndroidNotificationChannel( 166 | // channel: channel); 167 | // await LocalNotifications.createNotification( 168 | // title: "遥不可及", 169 | // content: "您有新消息来了!", 170 | // id: _idX, 171 | // androidSettings: new AndroidSettings(channel: channel), 172 | // onNotificationClick: NotificationAction( 173 | // actionText: "", 174 | // callback: _onNotificationClick, 175 | // payload: "接收成功!"), 176 | // ); 177 | } 178 | } 179 | setState(() { 180 | _msg = Icon( 181 | Icons.speaker_notes, 182 | color: Colors.redAccent, 183 | ); 184 | _onNew = false; 185 | }); 186 | } 187 | } catch (e) { 188 | print('new msg get error'); 189 | } 190 | } 191 | 192 | initLabel() async { 193 | String l = await LocalStorage().get("labelId"); 194 | if (l != null && l.length == 1 && l != '0') { 195 | setState(() { 196 | _currentIndex = int.parse(l); 197 | }); 198 | await LocalStorage().set("labelId", '0'); 199 | } 200 | } 201 | 202 | @override 203 | void initState() { 204 | WidgetsBinding.instance.addObserver(this); 205 | list 206 | ..add(HomeScreen()) 207 | ..add(EmailScreen()) 208 | ..add(PagesScreen()) 209 | ..add(AirPlayScreen()); 210 | super.initState(); 211 | } 212 | 213 | @override 214 | Widget build(BuildContext context) { 215 | return WillPopScope( 216 | child: Scaffold( 217 | body: list[_currentIndex], 218 | bottomNavigationBar: BottomNavigationBar( 219 | items: [ 220 | BottomNavigationBarItem( 221 | icon: Icon( 222 | Icons.home, 223 | color: _bottomNavigationColor, 224 | ), 225 | title: Text( 226 | '主页', 227 | style: TextStyle(color: _bottomNavigationColor), 228 | )), 229 | BottomNavigationBarItem( 230 | icon: Icon( 231 | Icons.people, 232 | color: _bottomNavigationColor, 233 | ), 234 | title: Text( 235 | '好友', 236 | style: TextStyle(color: _bottomNavigationColor), 237 | )), 238 | BottomNavigationBarItem( 239 | icon: _msg, 240 | title: Text( 241 | '消息', 242 | style: TextStyle(color: _bottomNavigationColor), 243 | ), 244 | ), 245 | BottomNavigationBarItem( 246 | icon: Icon( 247 | Icons.person, 248 | color: _bottomNavigationColor, 249 | ), 250 | title: Text( 251 | '我的', 252 | style: TextStyle(color: _bottomNavigationColor), 253 | ), 254 | ), 255 | ], 256 | currentIndex: _currentIndex, 257 | onTap: (int index) { 258 | setState(() { 259 | _currentIndex = index; 260 | if (index == 2) { 261 | _msg = Icon( 262 | Icons.chat, 263 | color: Colors.blue, 264 | ); 265 | _onNew = false; 266 | } 267 | }); 268 | }, 269 | type: BottomNavigationBarType.shifting, 270 | ), 271 | ), 272 | onWillPop: () { 273 | print("---------------------------------------------"); 274 | if (Platform.isAndroid) backDeskTop(); 275 | }, 276 | ); 277 | } 278 | 279 | static const String CHANNEL = "android/back/desktop"; 280 | 281 | //设置回退到手机桌面 282 | static Future backDeskTop() async { 283 | final platform = MethodChannel(CHANNEL); 284 | //通知安卓返回,到手机桌面 285 | try { 286 | final bool out = await platform.invokeMethod('backDesktop'); 287 | if (out) debugPrint('返回到桌面'); 288 | } on PlatformException catch (e) { 289 | debugPrint("通信失败(设置回退到安卓手机桌面:设置失败)"); 290 | print(e.toString()); 291 | } 292 | return Future.value(false); 293 | } 294 | 295 | @override 296 | void didChangeAppLifecycleState(AppLifecycleState state) { 297 | // TODO: implement didChangeAppLifecycleState 298 | setState(() { 299 | _notification = state; 300 | print(_notification); 301 | if (_notification == AppLifecycleState.paused) { 302 | print("xxxx1"); 303 | _setN(); 304 | } 305 | if (_notification == AppLifecycleState.resumed) { 306 | print("xxxxxxxxxxxx"); 307 | _setNotN(); 308 | } 309 | }); 310 | super.didChangeAppLifecycleState(state); 311 | } 312 | 313 | _setNotN() async { 314 | await LocalStorage().set("tz101", 'no'); 315 | at = false; 316 | be = false; 317 | sd = false; 318 | initPlatformState(_id + "000"); 319 | // jpush.setBadge(2); 320 | } 321 | 322 | _setN() async { 323 | await LocalStorage().set("tz101", 'yes'); 324 | if (tsinit == 'no') { 325 | at = true; 326 | be = true; 327 | sd = true; 328 | initPlatformState(_id); 329 | // jpush.setBadge(1); 330 | } 331 | } 332 | 333 | @override 334 | void dispose() { 335 | WidgetsBinding.instance.removeObserver(this); 336 | super.dispose(); 337 | } 338 | 339 | AppLifecycleState _notification; 340 | } 341 | -------------------------------------------------------------------------------- /lib/page/login/forget_password.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_wyz/config/config.dart'; 5 | import 'package:flutter_wyz/page/index/index.dart'; 6 | import 'package:flutter_wyz/page/login/login.dart'; 7 | import 'package:flutter_wyz/util/Toast.dart'; 8 | import 'package:flutter_wyz/util/local_storage.dart'; 9 | import 'dart:convert'; 10 | import 'package:http/http.dart' as http; 11 | 12 | class ForgetPassword extends StatefulWidget { 13 | @override 14 | _ForgetPasswordState createState() => _ForgetPasswordState(); 15 | } 16 | 17 | class _ForgetPasswordState extends State { 18 | bool _phoneState, _pwdState, _codeState = false; 19 | String _checkStr; 20 | TextEditingController _pwdcontroller = new TextEditingController(); 21 | TextEditingController _phonecontroller = new TextEditingController(); 22 | TextEditingController _codecontroller = new TextEditingController(); 23 | String _sc = '发送'; 24 | int t = 60; 25 | Timer _ct; 26 | 27 | void _tgo() { 28 | setState(() { 29 | _sc = t.toString() + "秒"; 30 | _ct = Timer.periodic(new Duration(seconds: 1), (timer) { 31 | setState(() { 32 | if (t > 0) { 33 | t--; 34 | _sc = t.toString() + "秒"; 35 | } else { 36 | _sc = '发送'; 37 | t = 60; 38 | _ct.cancel(); 39 | _ct = null; 40 | } 41 | }); 42 | }); 43 | }); 44 | } 45 | 46 | @override 47 | void dispose(){ 48 | _ct?.cancel(); 49 | _ct = null; 50 | super.dispose(); 51 | } 52 | 53 | void _checkPhone() { 54 | if (_phonecontroller.text.isNotEmpty && 55 | _phonecontroller.text.trim().length == 11) { 56 | _phoneState = true; 57 | } else { 58 | _phoneState = false; 59 | } 60 | } 61 | 62 | void _checkPwd() { 63 | if (_pwdcontroller.text.isNotEmpty && 64 | _pwdcontroller.text.trim().length >= 6 && 65 | _pwdcontroller.text.trim().length <= 20) { 66 | _pwdState = true; 67 | } else { 68 | _pwdState = false; 69 | } 70 | } 71 | 72 | void _checkCode() { 73 | if (_codecontroller.text.isNotEmpty && 74 | _codecontroller.text.trim().length == 4) { 75 | _codeState = true; 76 | } else { 77 | _codeState = false; 78 | } 79 | } 80 | 81 | register() async { 82 | String url = Config().host + "/user/changePasswordCode"; 83 | String datax = json.encode({ 84 | 'phone': _phonecontroller.text, 85 | 'password': _pwdcontroller.text, 86 | 'code': _codecontroller.text 87 | }); 88 | print(datax); 89 | final http.Response response = await http.post(url, body: datax); 90 | var data = json.decode(response.body); 91 | print(data); 92 | var result = data['code']; 93 | if (result == 0) { 94 | Toast.toast(context, '密码已重置!'); 95 | Navigator.pop(context); 96 | } else { 97 | Toast.toast(context, data['msg']); 98 | } 99 | } 100 | 101 | sendCode() async { 102 | if (_sc == '发送') { 103 | String phone = _phonecontroller.text; 104 | if (phone != null && phone.length == 11) { 105 | String url = Config().host + "/user/sendCode?type=f&phone=" + phone; 106 | final http.Response response = await http.get(url); 107 | var data = json.decode(response.body); 108 | print(data); 109 | var result = data['code']; 110 | if (result == 0) { 111 | Toast.toast(context, '验证码发送成功!注意查收!'); 112 | _tgo(); 113 | } else { 114 | Toast.toast(context, data['msg']); 115 | } 116 | } else { 117 | Toast.toast(context, '请输入11位手机号!'); 118 | } 119 | } 120 | } 121 | 122 | @override 123 | Widget build(BuildContext context) { 124 | return MaterialApp( 125 | title: '重置密码', 126 | home: new Scaffold( 127 | appBar: new AppBar( 128 | title: new Text('重置密码'), 129 | ), 130 | body: new ListView( 131 | children: [ 132 | new Column( 133 | mainAxisSize: MainAxisSize.max, 134 | mainAxisAlignment: MainAxisAlignment.start, 135 | children: [ 136 | new Padding( 137 | padding: new EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 15.0), 138 | child: new Stack( 139 | alignment: new Alignment(1.0, 1.0), 140 | //statck 141 | children: [ 142 | new Row( 143 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 144 | children: [ 145 | new Padding( 146 | padding: 147 | new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 148 | child: Icon(Icons.phone_iphone)), 149 | new Expanded( 150 | child: new TextField( 151 | controller: _phonecontroller, 152 | keyboardType: TextInputType.phone, 153 | decoration: new InputDecoration( 154 | hintText: '请输入手机号', 155 | ), 156 | ), 157 | ), 158 | ]), 159 | new IconButton( 160 | icon: new Icon(Icons.clear, color: Colors.black45), 161 | onPressed: () { 162 | _phonecontroller.clear(); 163 | }, 164 | ), 165 | ], 166 | ), 167 | ), 168 | new Padding( 169 | padding: new EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 30.0), 170 | child: new Row( 171 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 172 | children: [ 173 | new Padding( 174 | padding: 175 | new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 176 | child: Icon(Icons.lock)), 177 | new Expanded( 178 | child: new TextField( 179 | controller: _pwdcontroller, 180 | decoration: new InputDecoration( 181 | hintText: '请输入密码', 182 | suffixIcon: new IconButton( 183 | icon: new Icon(Icons.clear, 184 | color: Colors.black45), 185 | onPressed: () { 186 | _pwdcontroller.clear(); 187 | }, 188 | ), 189 | ), 190 | obscureText: true, 191 | ), 192 | ), 193 | ]), 194 | ), 195 | new Padding( 196 | padding: new EdgeInsets.fromLTRB(20.0, 0, 20.0, 40.0), 197 | child: new Row( 198 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 199 | children: [ 200 | new Padding( 201 | padding: 202 | new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 203 | child: Icon(Icons.blur_circular)), 204 | new Expanded( 205 | child: new TextField( 206 | controller: _codecontroller, 207 | keyboardType: TextInputType.phone, 208 | decoration: new InputDecoration( 209 | hintText: '请输入验证码', 210 | suffixIcon: new IconButton( 211 | icon: new Icon(Icons.clear, 212 | color: Colors.black45), 213 | onPressed: () { 214 | _pwdcontroller.clear(); 215 | }, 216 | ), 217 | ), 218 | obscureText: false, 219 | ), 220 | ), 221 | Padding( 222 | padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), 223 | child: MaterialButton( 224 | color: Colors.blueAccent, 225 | onPressed: sendCode, 226 | child: Text( 227 | _sc, 228 | style: TextStyle(color: Colors.white), 229 | ), 230 | ), 231 | ), 232 | ]), 233 | ), 234 | new Container( 235 | width: 340.0, 236 | child: new Card( 237 | color: Colors.blue, 238 | elevation: 16.0, 239 | child: new FlatButton( 240 | child: new Padding( 241 | padding: new EdgeInsets.all(10.0), 242 | child: new Text( 243 | '提交', 244 | style: new TextStyle( 245 | color: Colors.white, fontSize: 16.0), 246 | ), 247 | ), 248 | onPressed: () { 249 | _checkStr = null; 250 | _checkPhone(); 251 | _checkPwd(); 252 | _checkCode(); 253 | if (_phoneState && _pwdState && _codeState) { 254 | // _checkStr = '页面跳转下期见咯!'; 255 | } else { 256 | if (!_phoneState) { 257 | _checkStr = '请输入11位手机号!'; 258 | } else if (!_pwdState) { 259 | _checkStr = '请输入6-10位密码!'; 260 | } else if (!_codeState) { 261 | _checkStr = '请输入4位数验证码!'; 262 | } 263 | } 264 | print(_checkStr); 265 | if (_checkStr == null || _checkStr == "") { 266 | register(); 267 | Toast.toast(context, '提交中'); 268 | } else { 269 | Toast.toast(context, _checkStr); 270 | } 271 | }, 272 | ), 273 | ), 274 | ), 275 | ], 276 | ), 277 | ], 278 | ), 279 | ), 280 | ); 281 | } 282 | } 283 | -------------------------------------------------------------------------------- /lib/page/login/register.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_wyz/config/config.dart'; 5 | import 'package:flutter_wyz/page/index/index.dart'; 6 | import 'package:flutter_wyz/util/Toast.dart'; 7 | import 'package:flutter_wyz/util/local_storage.dart'; 8 | import 'dart:convert'; 9 | import 'package:http/http.dart' as http; 10 | 11 | class Register extends StatefulWidget { 12 | @override 13 | _RegisterState createState() => _RegisterState(); 14 | } 15 | 16 | class _RegisterState extends State { 17 | 18 | bool _phoneState, _pwdState, _codeState = false; 19 | String _checkStr; 20 | TextEditingController _pwdcontroller = new TextEditingController(); 21 | TextEditingController _phonecontroller = new TextEditingController(); 22 | TextEditingController _codecontroller = new TextEditingController(); 23 | String _sc = '发送'; 24 | int t = 60; 25 | Timer _ct; 26 | 27 | void _tgo() { 28 | setState(() { 29 | _sc = t.toString() + "秒"; 30 | _ct = Timer.periodic(new Duration(seconds: 1), (timer) { 31 | setState(() { 32 | if (t > 0) { 33 | t--; 34 | _sc = t.toString() + "秒"; 35 | } else { 36 | _sc = '发送'; 37 | t = 60; 38 | _ct.cancel(); 39 | _ct = null; 40 | } 41 | }); 42 | }); 43 | }); 44 | } 45 | 46 | @override 47 | void dispose(){ 48 | _ct?.cancel(); 49 | _ct = null; 50 | super.dispose(); 51 | } 52 | 53 | void _checkPhone() { 54 | if (_phonecontroller.text.isNotEmpty && 55 | _phonecontroller.text.trim().length == 11) { 56 | _phoneState = true; 57 | } else { 58 | _phoneState = false; 59 | } 60 | } 61 | 62 | void _checkPwd() { 63 | if (_pwdcontroller.text.isNotEmpty && 64 | _pwdcontroller.text.trim().length >= 6 && 65 | _pwdcontroller.text.trim().length <= 20) { 66 | _pwdState = true; 67 | } else { 68 | _pwdState = false; 69 | } 70 | } 71 | 72 | void _checkCode() { 73 | if (_codecontroller.text.isNotEmpty && 74 | _codecontroller.text.trim().length == 4) { 75 | _codeState = true; 76 | } else { 77 | _codeState = false; 78 | } 79 | } 80 | 81 | register() async { 82 | String url = Config().host + "/user"; 83 | String datax = json.encode({ 84 | 'phone': _phonecontroller.text, 85 | 'password': _pwdcontroller.text, 86 | 'salt': _codecontroller.text 87 | }); 88 | print(datax); 89 | final http.Response response = await http.post(url, body: datax); 90 | var data = json.decode(response.body); 91 | print(data); 92 | var result = data['code']; 93 | if (result == 0) { 94 | await LocalStorage().set("token", data['data']['token']); 95 | await LocalStorage().set("userId", data['data']['id'].toString()); 96 | await LocalStorage().set("phoneLogin", _phonecontroller.text); 97 | Navigator.of(context).pushAndRemoveUntil( 98 | MaterialPageRoute(builder: (context) => Index()), 99 | (route) => route == null); 100 | } else { 101 | Toast.toast(context, data['msg']); 102 | } 103 | } 104 | 105 | sendCode() async { 106 | if (_sc == '发送') { 107 | String phone = _phonecontroller.text; 108 | if (phone != null && phone.length == 11) { 109 | String url = Config().host + "/user/sendCode?phone=" + phone; 110 | final http.Response response = await http.get(url); 111 | var data = json.decode(response.body); 112 | print(data); 113 | var result = data['code']; 114 | if (result == 0) { 115 | Toast.toast(context, '验证码发送成功!注意查收!'); 116 | _tgo(); 117 | } else { 118 | Toast.toast(context, data['msg']); 119 | } 120 | } else { 121 | Toast.toast(context, '请输入11位手机号!'); 122 | } 123 | } 124 | } 125 | 126 | @override 127 | Widget build(BuildContext context) { 128 | return MaterialApp( 129 | title: '注册', 130 | home: new Scaffold( 131 | appBar: new AppBar( 132 | title: new Text('注册'), 133 | ), 134 | body: new ListView( 135 | children: [ 136 | new Column( 137 | mainAxisSize: MainAxisSize.max, 138 | mainAxisAlignment: MainAxisAlignment.start, 139 | children: [ 140 | new Padding( 141 | padding: new EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 15.0), 142 | child: new Stack( 143 | alignment: new Alignment(1.0, 1.0), 144 | //statck 145 | children: [ 146 | new Row( 147 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 148 | children: [ 149 | new Padding( 150 | padding: 151 | new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 152 | child: Icon(Icons.phone_iphone)), 153 | new Expanded( 154 | child: new TextField( 155 | controller: _phonecontroller, 156 | keyboardType: TextInputType.phone, 157 | decoration: new InputDecoration( 158 | hintText: '请输入手机号', 159 | ), 160 | ), 161 | ), 162 | ]), 163 | new IconButton( 164 | icon: new Icon(Icons.clear, color: Colors.black45), 165 | onPressed: () { 166 | _phonecontroller.clear(); 167 | }, 168 | ), 169 | ], 170 | ), 171 | ), 172 | new Padding( 173 | padding: new EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 30.0), 174 | child: new Row( 175 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 176 | children: [ 177 | new Padding( 178 | padding: 179 | new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 180 | child: Icon(Icons.lock)), 181 | new Expanded( 182 | child: new TextField( 183 | controller: _pwdcontroller, 184 | decoration: new InputDecoration( 185 | hintText: '请输入密码', 186 | suffixIcon: new IconButton( 187 | icon: new Icon(Icons.clear, 188 | color: Colors.black45), 189 | onPressed: () { 190 | _pwdcontroller.clear(); 191 | }, 192 | ), 193 | ), 194 | obscureText: true, 195 | ), 196 | ), 197 | ]), 198 | ), 199 | new Padding( 200 | padding: new EdgeInsets.fromLTRB(20.0, 0, 20.0, 40.0), 201 | child: new Row( 202 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 203 | children: [ 204 | new Padding( 205 | padding: 206 | new EdgeInsets.fromLTRB(0.0, 0.0, 5.0, 0.0), 207 | child: Icon(Icons.blur_circular)), 208 | new Expanded( 209 | child: new TextField( 210 | controller: _codecontroller, 211 | keyboardType: TextInputType.phone, 212 | decoration: new InputDecoration( 213 | hintText: '请输入验证码', 214 | suffixIcon: new IconButton( 215 | icon: new Icon(Icons.clear, 216 | color: Colors.black45), 217 | onPressed: () { 218 | _pwdcontroller.clear(); 219 | }, 220 | ), 221 | ), 222 | obscureText: false, 223 | ), 224 | ), 225 | Padding( 226 | padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), 227 | child: MaterialButton( 228 | color: Colors.blueAccent, 229 | onPressed: sendCode, 230 | child: Text( 231 | _sc, 232 | style: TextStyle(color: Colors.white), 233 | ), 234 | ), 235 | ), 236 | ]), 237 | ), 238 | new Container( 239 | width: 340.0, 240 | child: new Card( 241 | color: Colors.blue, 242 | elevation: 16.0, 243 | child: new FlatButton( 244 | child: new Padding( 245 | padding: new EdgeInsets.all(10.0), 246 | child: new Text( 247 | '注册', 248 | style: new TextStyle( 249 | color: Colors.white, fontSize: 16.0), 250 | ), 251 | ), 252 | onPressed: () { 253 | _checkStr = null; 254 | _checkPhone(); 255 | _checkPwd(); 256 | _checkCode(); 257 | if (_phoneState && _pwdState && _codeState) { 258 | // _checkStr = '页面跳转下期见咯!'; 259 | } else { 260 | if (!_phoneState) { 261 | _checkStr = '请输入11位手机号!'; 262 | } else if (!_pwdState) { 263 | _checkStr = '请输入6-10位密码!'; 264 | } else if (!_codeState) { 265 | _checkStr = '请输入4位数验证码!'; 266 | } 267 | } 268 | print(_checkStr); 269 | if (_checkStr == null || _checkStr == "") { 270 | register(); 271 | Toast.toast(context, '注册中'); 272 | } else { 273 | Toast.toast(context, _checkStr); 274 | } 275 | }, 276 | ), 277 | ), 278 | ), 279 | ], 280 | ), 281 | ], 282 | ), 283 | ), 284 | ); 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /lib/page/pojo/chat.dart: -------------------------------------------------------------------------------- 1 | class Chat { 2 | String id; 3 | 4 | String userId; 5 | 6 | String friendId; 7 | 8 | String content; 9 | 10 | int type; 11 | 12 | int createAt; 13 | 14 | int readAt; 15 | 16 | String userName; 17 | 18 | String userHeadUrl; 19 | 20 | String myName; 21 | 22 | String myHeadUrl; 23 | 24 | Chat(){ 25 | 26 | } 27 | 28 | Chat.fromJson(Map json) { 29 | userId = json['userId'].toString(); 30 | friendId = json['friendId'].toString(); 31 | content = json['content']; 32 | type = json['type']; 33 | id = json['id'].toString(); 34 | createAt = json['createAt']; 35 | userName = json['userName']; 36 | userHeadUrl = json['userHeadUrl']; 37 | myName = json['myName']; 38 | myHeadUrl = json['myHeadUrl']; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/page/pojo/comment.dart: -------------------------------------------------------------------------------- 1 | class Comment{ 2 | String id; 3 | 4 | String userName; 5 | 6 | String userHeadUrl; 7 | 8 | String content; 9 | 10 | int createAt; 11 | 12 | int loveNumber; 13 | 14 | int commentNumber; 15 | 16 | int userId; 17 | 18 | Comment.fromJson(Map json) { 19 | this.id = json['id'].toString(); 20 | this.userId = json['userId']; 21 | this.content = json['content']; 22 | this.userName = json['userName']; 23 | this.userHeadUrl = json['userHeadUrl']; 24 | this.createAt = json['createAt']; 25 | this.loveNumber = json['loveNumber']; 26 | this.commentNumber = json['commentNumber']; 27 | } 28 | } -------------------------------------------------------------------------------- /lib/page/pojo/device.dart: -------------------------------------------------------------------------------- 1 | class Device { 2 | String id; 3 | 4 | String sn; 5 | 6 | String type; 7 | 8 | String remark; 9 | 10 | int lastHbAt; 11 | 12 | String userId; 13 | 14 | Device.fromJson(Map json) { 15 | this.id = json['id'].toString(); 16 | this.userId = json['userId']; 17 | this.type = json['type']; 18 | this.remark = json['remark']; 19 | this.sn = json['sn']; 20 | this.lastHbAt = json['lastHbAt']; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/page/pojo/msg.dart: -------------------------------------------------------------------------------- 1 | class Msg { 2 | String id; 3 | 4 | String content; 5 | 6 | String picUrls; 7 | 8 | int createAt; 9 | 10 | String userName; 11 | 12 | String userHeadUrl; 13 | 14 | int loveNumber; 15 | 16 | int commentNumber; 17 | 18 | String autograph; 19 | 20 | List pics; 21 | 22 | String userId; 23 | 24 | Msg.fromJson(Map json) { 25 | this.userId = json['userId'].toString(); 26 | this.id = json['id'].toString(); 27 | this.content = json['content']; 28 | this.picUrls = json['picUrls']; 29 | this.userName = json['userName']; 30 | this.userHeadUrl = json['userHeadUrl']; 31 | this.createAt = json['createAt']; 32 | this.loveNumber = json['loveNumber']; 33 | this.commentNumber = json['commentNumber']; 34 | if(this.loveNumber == null){ 35 | this.loveNumber = 0; 36 | } 37 | if(this.commentNumber == null){ 38 | this.commentNumber = 0; 39 | } 40 | String s = json['userAutograph']; 41 | if (s != null && s.length > 15) { 42 | s = s.substring(0, 14); 43 | } 44 | if (s == null) { 45 | s = "未签名"; 46 | } 47 | this.autograph = s; 48 | if (null != this.picUrls) { 49 | this.pics = this.picUrls.split(","); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/page/pojo/user.dart: -------------------------------------------------------------------------------- 1 | class User { 2 | String name; 3 | 4 | String age; 5 | 6 | String address; 7 | 8 | String headUrl; 9 | 10 | String id; 11 | 12 | String phone; 13 | 14 | String autograph; 15 | 16 | String backImg; 17 | 18 | User(String name, String age, String address) { 19 | this.name = name; 20 | this.address = address; 21 | this.age = age; 22 | } 23 | 24 | User.fromJson(Map json) { 25 | name = json['name']; 26 | age = json['age']; 27 | address = json['address']; 28 | headUrl = json['headUrl']; 29 | id = json['id'].toString(); 30 | phone = json['phone']; 31 | autograph = json['autograph']; 32 | backImg = json['backImg']; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/page/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zocoo/flutter-app/978fa83cdbf0cd7d210085ca3d94ae0258903c44/lib/page/readme.txt -------------------------------------------------------------------------------- /lib/page/version/version.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_wyz/config/config.dart'; 5 | import 'package:flutter_wyz/page/login/login.dart'; 6 | import 'package:flutter_wyz/util/Toast.dart'; 7 | import 'package:flutter_wyz/util/local_storage.dart'; 8 | import 'package:http/http.dart' as http; 9 | import 'dart:convert'; 10 | import 'dart:io'; 11 | import 'package:simple_permissions/simple_permissions.dart'; 12 | import 'package:package_info/package_info.dart'; 13 | import 'package:path_provider/path_provider.dart'; 14 | import 'package:flutter_downloader/flutter_downloader.dart'; 15 | import 'package:open_file/open_file.dart'; 16 | 17 | class Version extends StatefulWidget { 18 | @override 19 | _VersionState createState() => _VersionState(); 20 | } 21 | 22 | class _VersionState extends State with SingleTickerProviderStateMixin { 23 | String versionInfo = "检查版本中..."; 24 | AnimationController _controller; 25 | Animation _animation; 26 | String _url = ""; 27 | String _fileName = ""; 28 | bool _a_status = false; 29 | bool _v_status = false; 30 | BuildContext _b = null; 31 | Timer _ctXl; 32 | @override 33 | void dispose() { 34 | if (null != _ctXl) _ctXl.cancel(); 35 | super.dispose(); 36 | } 37 | _ctXlGx() async { 38 | checkVersion(); 39 | _ctXl = Timer.periodic(new Duration(milliseconds: 6000), (timer) { 40 | checkVersion(); 41 | }); 42 | } 43 | @override 44 | void initState() { 45 | super.initState(); 46 | _controller = AnimationController( 47 | duration: Duration( 48 | seconds: 1, 49 | ), 50 | vsync: this, 51 | ); 52 | _animation = Tween(begin: 0, end: 1).animate(_controller); 53 | 54 | _animation.addStatusListener((status) { 55 | if (status == AnimationStatus.completed) { 56 | if (_v_status) 57 | Navigator.of(context).pushAndRemoveUntil( 58 | MaterialPageRoute(builder: (context) => Login()), 59 | (route) => route == null); 60 | else { 61 | _b = context; 62 | _a_status = true; 63 | } 64 | } 65 | }); 66 | 67 | _controller.forward(); 68 | } 69 | 70 | _VersionState() { 71 | _ctXlGx(); 72 | } 73 | 74 | notUpdate() { 75 | if (_a_status) 76 | Navigator.of(context).pushAndRemoveUntil( 77 | new MaterialPageRoute(builder: (context) => Login()), 78 | (route) => route == null); 79 | else 80 | Navigator.of(context).pop(); 81 | } 82 | 83 | nowUpdate() async { 84 | Navigator.of(context).pop(); 85 | print(Platform.isAndroid); 86 | print(Platform.isIOS); 87 | print(Platform.isMacOS); 88 | if (Platform.isAndroid) { 89 | bool res = await SimplePermissions.checkPermission( 90 | Permission.WriteExternalStorage); 91 | print(res); 92 | if (!res) { 93 | await SimplePermissions.requestPermission( 94 | Permission.WriteExternalStorage); 95 | } 96 | print("xxxxxxxxxxxxxx"); 97 | if (true) { 98 | try { 99 | var directory = await getExternalStorageDirectory(); 100 | print(directory.path); 101 | FlutterDownloader.initialize(); 102 | FlutterDownloader.registerCallback((id, status, progress) { 103 | print( 104 | 'Download task ($id) is in status ($status) and process ($progress)'); 105 | if (status == DownloadTaskStatus.complete) { 106 | print(directory.path); 107 | print(_fileName); 108 | OpenFile.open(directory.path + "/" + _fileName); 109 | FlutterDownloader.open(taskId: id); 110 | } 111 | }); 112 | final taskId = await FlutterDownloader.enqueue( 113 | // url: "https://assets-store-cdn.48lu.cn/assets-store/c3ba1aa37bdbb78386416c703ee7eb14.apk", 114 | // url: "https://assets-store-cdn.48lu.cn/assets-store/395845999373aa6588c7659d54a92b0c.pdf", 115 | // url: "https://assets-store-cdn.48lu.cn/assets-store/6845eee23f7ec0036eed7935f827f9e5.jpg", 116 | url: _url, 117 | savedDir: directory.path, 118 | showNotification: 119 | true, // show download progress in status bar (for Android) 120 | openFileFromNotification: 121 | true, // click on notification to open downloaded file (for Android) 122 | ); 123 | } catch (e) { 124 | Toast.toast(context, '更新失败,请去官网下载!'); 125 | notUpdate(); 126 | } 127 | final tasks = await FlutterDownloader.loadTasks(); 128 | } else { 129 | notUpdate(); 130 | } 131 | } else if (Platform.isIOS) { 132 | notUpdate(); 133 | } 134 | } 135 | 136 | Widget choiceUpdate(BuildContext context) { 137 | showDialog( 138 | context: context, 139 | barrierDismissible: false, 140 | builder: (BuildContext context) { 141 | return new AlertDialog( 142 | title: Text('提示'), 143 | content: SingleChildScrollView( 144 | child: Text('发现新版本,需要更新吗?'), 145 | ), 146 | actions: [ 147 | Row( 148 | children: [ 149 | FlatButton( 150 | child: Text('取消'), 151 | onPressed: () { 152 | notUpdate(); 153 | }, 154 | ), 155 | FlatButton( 156 | child: Text('确定'), 157 | onPressed: () { 158 | nowUpdate(); 159 | }, 160 | ), 161 | ], 162 | ), 163 | ], 164 | ); 165 | }, 166 | ); 167 | } 168 | 169 | checkVersion() async { 170 | await LocalStorage().set("tz101", 'no'); 171 | var url = Config().host + '/config/selectById?id=1'; 172 | var downloadUrl = ""; 173 | var fileName = ""; 174 | int result; 175 | try { 176 | final http.Response response = await http.get(url); 177 | var data = json.decode(response.body); 178 | result = data['data']['code']; 179 | print(result); 180 | downloadUrl = data['data']['content']; 181 | print(downloadUrl); 182 | if (downloadUrl.length > 10) { 183 | List list = downloadUrl.split("/"); 184 | fileName = list[list.length - 1]; 185 | } 186 | _fileName = fileName; 187 | _url = downloadUrl; 188 | // PackageInfo packageInfo = await PackageInfo.fromPlatform(); 189 | // String version = packageInfo.version; 190 | // print(version); 191 | if (Config().version < result) { 192 | choiceUpdate(context); 193 | _ctXl.cancel(); 194 | } else { 195 | if (_a_status) 196 | Navigator.of(context).pushAndRemoveUntil( 197 | MaterialPageRoute(builder: (context) => Login()), 198 | (route) => route == null); 199 | else 200 | _v_status = true; 201 | } 202 | } catch (exception) { 203 | result = -1; 204 | } 205 | if (!mounted) return; 206 | setState(() { 207 | versionInfo = result.toString(); 208 | }); 209 | } 210 | 211 | @override 212 | Widget build(BuildContext context) { 213 | return FadeTransition( 214 | opacity: _controller, 215 | child: Image.asset( 216 | 'img/back.png', 217 | fit: BoxFit.cover, 218 | ), 219 | ); 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /lib/util/Toast.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class Toast { 5 | static OverlayEntry _overlayEntry; //toast靠它加到屏幕上 6 | static bool _showing = false; //toast是否正在showing 7 | static DateTime _startedTime; //开启一个新toast的当前时间,用于对比是否已经展示了足够时间 8 | static String _msg; 9 | static void toast( 10 | BuildContext context, 11 | String msg, 12 | ) async { 13 | assert(msg != null); 14 | _msg = msg; 15 | if(_msg == null || _msg.length < 1){ 16 | _msg = '处理中'; 17 | } 18 | print(_msg); 19 | _startedTime = DateTime.now(); 20 | //获取OverlayState 21 | OverlayState overlayState = Overlay.of(context); 22 | _showing = true; 23 | if (_overlayEntry == null) { 24 | _overlayEntry = OverlayEntry( 25 | builder: (BuildContext context) => Positioned( 26 | //top值,可以改变这个值来改变toast在屏幕中的位置 27 | top: MediaQuery.of(context).size.height * 2 / 3, 28 | child: Container( 29 | alignment: Alignment.center, 30 | width: MediaQuery.of(context).size.width, 31 | child: Padding( 32 | padding: EdgeInsets.symmetric(horizontal: 80.0), 33 | child: AnimatedOpacity( 34 | opacity: _showing ? 1.0 : 0.0, //目标透明度 35 | duration: _showing 36 | ? Duration(milliseconds: 100) 37 | : Duration(milliseconds: 400), 38 | child: _buildToastWidget(), 39 | ), 40 | )), 41 | )); 42 | overlayState.insert(_overlayEntry); 43 | } else { 44 | //重新绘制UI,类似setState 45 | _overlayEntry.markNeedsBuild(); 46 | } 47 | await Future.delayed(Duration(milliseconds: 2000)); //等待两秒 48 | 49 | //2秒后 到底消失不消失 50 | if (DateTime.now().difference(_startedTime).inMilliseconds >= 2000) { 51 | _showing = false; 52 | _overlayEntry.markNeedsBuild(); 53 | } 54 | } 55 | 56 | //toast绘制 57 | static _buildToastWidget() { 58 | return Center( 59 | child: Card( 60 | color: Colors.black26, 61 | child: Padding( 62 | padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 5.0), 63 | child: Text( 64 | _msg, 65 | style: TextStyle( 66 | fontSize: 14.0, 67 | color: Colors.white, 68 | ), 69 | ), 70 | ), 71 | ), 72 | ); 73 | } 74 | } -------------------------------------------------------------------------------- /lib/util/local_storage.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | 3 | class LocalStorage { 4 | set(key, value) async { 5 | SharedPreferences prefs = await SharedPreferences.getInstance(); 6 | prefs.setString(key, value); 7 | } 8 | 9 | get(key) async { 10 | SharedPreferences prefs = await SharedPreferences.getInstance(); 11 | String value = prefs.getString(key); 12 | return value; 13 | } 14 | 15 | remove(key) async { 16 | SharedPreferences prefs = await SharedPreferences.getInstance(); 17 | prefs.remove(key); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.0.8" 11 | barcode_scan: 12 | dependency: "direct main" 13 | description: 14 | name: barcode_scan 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "0.0.5" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.0.4" 25 | cached_network_image: 26 | dependency: "direct main" 27 | description: 28 | name: cached_network_image 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "0.5.1" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.1.2" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.14.11" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "2.1.1" 53 | cookie_jar: 54 | dependency: transitive 55 | description: 56 | name: cookie_jar 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "1.0.0" 60 | crypto: 61 | dependency: transitive 62 | description: 63 | name: crypto 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "2.0.6" 67 | cupertino_icons: 68 | dependency: "direct main" 69 | description: 70 | name: cupertino_icons 71 | url: "https://pub.flutter-io.cn" 72 | source: hosted 73 | version: "0.1.2" 74 | dio: 75 | dependency: "direct main" 76 | description: 77 | name: dio 78 | url: "https://pub.flutter-io.cn" 79 | source: hosted 80 | version: "2.1.3" 81 | exifdart: 82 | dependency: "direct main" 83 | description: 84 | name: exifdart 85 | url: "https://pub.flutter-io.cn" 86 | source: hosted 87 | version: "0.7.0+3" 88 | flutter: 89 | dependency: "direct main" 90 | description: flutter 91 | source: sdk 92 | version: "0.0.0" 93 | flutter_cache_manager: 94 | dependency: transitive 95 | description: 96 | name: flutter_cache_manager 97 | url: "https://pub.flutter-io.cn" 98 | source: hosted 99 | version: "0.2.0+1" 100 | flutter_downloader: 101 | dependency: "direct main" 102 | description: 103 | name: flutter_downloader 104 | url: "https://pub.flutter-io.cn" 105 | source: hosted 106 | version: "1.0.5" 107 | flutter_drag_scale: 108 | dependency: "direct main" 109 | description: 110 | path: "." 111 | ref: HEAD 112 | resolved-ref: "8a9fbd918bc0333216c7704342246b498c05a419" 113 | url: "https://github.com/LiuC520/flutter_drag_scale.git" 114 | source: git 115 | version: "0.0.1" 116 | flutter_image_compress: 117 | dependency: "direct main" 118 | description: 119 | name: flutter_image_compress 120 | url: "https://pub.flutter-io.cn" 121 | source: hosted 122 | version: "0.4.0" 123 | flutter_sound: 124 | dependency: "direct main" 125 | description: 126 | name: flutter_sound 127 | url: "https://pub.flutter-io.cn" 128 | source: hosted 129 | version: "1.4.0" 130 | flutter_test: 131 | dependency: "direct dev" 132 | description: flutter 133 | source: sdk 134 | version: "0.0.0" 135 | http: 136 | dependency: "direct main" 137 | description: 138 | name: http 139 | url: "https://pub.flutter-io.cn" 140 | source: hosted 141 | version: "0.12.0+2" 142 | http_parser: 143 | dependency: transitive 144 | description: 145 | name: http_parser 146 | url: "https://pub.flutter-io.cn" 147 | source: hosted 148 | version: "3.1.3" 149 | image_crop: 150 | dependency: "direct main" 151 | description: 152 | name: image_crop 153 | url: "https://pub.flutter-io.cn" 154 | source: hosted 155 | version: "0.2.0" 156 | image_picker: 157 | dependency: "direct main" 158 | description: 159 | name: image_picker 160 | url: "https://pub.flutter-io.cn" 161 | source: hosted 162 | version: "0.4.12" 163 | jpush_flutter: 164 | dependency: "direct main" 165 | description: 166 | name: jpush_flutter 167 | url: "https://pub.flutter-io.cn" 168 | source: hosted 169 | version: "0.0.11" 170 | matcher: 171 | dependency: transitive 172 | description: 173 | name: matcher 174 | url: "https://pub.flutter-io.cn" 175 | source: hosted 176 | version: "0.12.3+1" 177 | meta: 178 | dependency: transitive 179 | description: 180 | name: meta 181 | url: "https://pub.flutter-io.cn" 182 | source: hosted 183 | version: "1.1.6" 184 | open_file: 185 | dependency: "direct main" 186 | description: 187 | name: open_file 188 | url: "https://pub.flutter-io.cn" 189 | source: hosted 190 | version: "1.2.0" 191 | package_info: 192 | dependency: "direct main" 193 | description: 194 | name: package_info 195 | url: "https://pub.flutter-io.cn" 196 | source: hosted 197 | version: "0.3.2+1" 198 | path: 199 | dependency: transitive 200 | description: 201 | name: path 202 | url: "https://pub.flutter-io.cn" 203 | source: hosted 204 | version: "1.6.2" 205 | path_provider: 206 | dependency: "direct main" 207 | description: 208 | name: path_provider 209 | url: "https://pub.flutter-io.cn" 210 | source: hosted 211 | version: "0.4.1" 212 | pedantic: 213 | dependency: transitive 214 | description: 215 | name: pedantic 216 | url: "https://pub.flutter-io.cn" 217 | source: hosted 218 | version: "1.4.0" 219 | platform: 220 | dependency: transitive 221 | description: 222 | name: platform 223 | url: "https://pub.flutter-io.cn" 224 | source: hosted 225 | version: "2.2.0" 226 | quiver: 227 | dependency: transitive 228 | description: 229 | name: quiver 230 | url: "https://pub.flutter-io.cn" 231 | source: hosted 232 | version: "2.0.1" 233 | shared_preferences: 234 | dependency: "direct main" 235 | description: 236 | name: shared_preferences 237 | url: "https://pub.flutter-io.cn" 238 | source: hosted 239 | version: "0.4.0" 240 | simple_permissions: 241 | dependency: "direct main" 242 | description: 243 | name: simple_permissions 244 | url: "https://pub.flutter-io.cn" 245 | source: hosted 246 | version: "0.1.9" 247 | sky_engine: 248 | dependency: transitive 249 | description: flutter 250 | source: sdk 251 | version: "0.0.99" 252 | source_span: 253 | dependency: transitive 254 | description: 255 | name: source_span 256 | url: "https://pub.flutter-io.cn" 257 | source: hosted 258 | version: "1.5.4" 259 | stack_trace: 260 | dependency: transitive 261 | description: 262 | name: stack_trace 263 | url: "https://pub.flutter-io.cn" 264 | source: hosted 265 | version: "1.9.3" 266 | stream_channel: 267 | dependency: transitive 268 | description: 269 | name: stream_channel 270 | url: "https://pub.flutter-io.cn" 271 | source: hosted 272 | version: "1.6.8" 273 | string_scanner: 274 | dependency: transitive 275 | description: 276 | name: string_scanner 277 | url: "https://pub.flutter-io.cn" 278 | source: hosted 279 | version: "1.0.4" 280 | synchronized: 281 | dependency: transitive 282 | description: 283 | name: synchronized 284 | url: "https://pub.flutter-io.cn" 285 | source: hosted 286 | version: "1.5.3+2" 287 | term_glyph: 288 | dependency: transitive 289 | description: 290 | name: term_glyph 291 | url: "https://pub.flutter-io.cn" 292 | source: hosted 293 | version: "1.1.0" 294 | test_api: 295 | dependency: transitive 296 | description: 297 | name: test_api 298 | url: "https://pub.flutter-io.cn" 299 | source: hosted 300 | version: "0.2.2" 301 | typed_data: 302 | dependency: transitive 303 | description: 304 | name: typed_data 305 | url: "https://pub.flutter-io.cn" 306 | source: hosted 307 | version: "1.1.6" 308 | uuid: 309 | dependency: transitive 310 | description: 311 | name: uuid 312 | url: "https://pub.flutter-io.cn" 313 | source: hosted 314 | version: "1.0.3" 315 | vector_math: 316 | dependency: transitive 317 | description: 318 | name: vector_math 319 | url: "https://pub.flutter-io.cn" 320 | source: hosted 321 | version: "2.0.8" 322 | wifi: 323 | dependency: "direct main" 324 | description: 325 | name: wifi 326 | url: "https://pub.flutter-io.cn" 327 | source: hosted 328 | version: "0.1.4" 329 | sdks: 330 | dart: ">=2.1.0 <3.0.0" 331 | flutter: ">=0.1.4 <2.0.0" 332 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_wyz 2 | description: A new Flutter application. 3 | 4 | version: 1.1.1+1 5 | 6 | environment: 7 | sdk: ">=2.1.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | simple_permissions: 0.1.9 13 | package_info: 0.3.2+1 14 | path_provider: ^0.4.1 15 | flutter_downloader: 1.0.5 16 | open_file: 1.2.0 17 | image_picker: 0.4.12 18 | image_crop: ^0.2.0 19 | shared_preferences: 0.4.0 20 | flutter_image_compress: 0.4.0 21 | cupertino_icons: ^0.1.2 22 | http: ^0.12.0 23 | barcode_scan: 0.0.5 24 | cached_network_image: 0.5.1 25 | exifdart: ^0.7.0+3 26 | dio: ^2.0.0 27 | jpush_flutter: 0.0.11 28 | flutter_sound: ^1.4.0 29 | wifi: 0.1.4 30 | flutter_drag_scale: 31 | git: https://github.com/LiuC520/flutter_drag_scale.git 32 | # android only 如果在苹果手机或者苹果虚拟机上运行,请注释掉local_notifications 33 | # local_notifications: 0.0.3 34 | 35 | 36 | dev_dependencies: 37 | flutter_test: 38 | sdk: flutter 39 | 40 | flutter: 41 | uses-material-design: true 42 | assets: 43 | - img/start.jpg 44 | - img/loading.gif 45 | - img/p.jpg 46 | - img/p.png 47 | - img/pp.png 48 | - img/add.png 49 | - img/love.png 50 | - img/chat.png 51 | - img/back.png 52 | - img/ic_mic.png 53 | - img/ic_pause.png 54 | - img/ic_play.png 55 | - img/ic_stop.png 56 | - img/ic_volume_down.png 57 | - img/ic_volume_up.png 58 | - img/luyin.gif 59 | - img/luyin.png 60 | - img/yyr.png 61 | - img/yyl.png 62 | - img/ld.gif 63 | - img/on.png 64 | - img/off.png 65 | - img/lx.png 66 | - img/wd.png 67 | - img/sd.png -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_wyz/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | --------------------------------------------------------------------------------