├── .gitignore ├── README.md ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── flutterdemo │ │ │ └── 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 ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── images ├── android.jpg ├── author.png ├── cover_img.jpg ├── ic_about.png ├── ic_arrow_right.png ├── ic_avatar_default.png ├── ic_comment.png ├── ic_discover_gist.png ├── ic_discover_git.png ├── ic_discover_nearby.png ├── ic_discover_pos.png ├── ic_discover_scan.png ├── ic_discover_shake.png ├── ic_discover_softwares.png ├── ic_img_default.jpg ├── ic_is_like.png ├── ic_my_blog.png ├── ic_my_message.png ├── ic_my_question.png ├── ic_my_recommend.png ├── ic_my_team.png ├── ic_nav_discover_actived.png ├── ic_nav_discover_normal.png ├── ic_nav_my_normal.png ├── ic_nav_my_pressed.png ├── ic_nav_news_actived.png ├── ic_nav_news_normal.png ├── ic_nav_tweet_actived.png ├── ic_nav_tweet_normal.png ├── ic_set.png ├── ic_un_like.png ├── ic_xiaoxin.jpg ├── lake.jpg ├── leftmenu │ ├── dizzy_face.png │ ├── ic_about.png │ ├── ic_fabu.png │ ├── ic_settings.png │ ├── ic_xiaoheiwu.png │ └── sob.png ├── more.png └── oschina.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── 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 ├── app │ └── OsApplication.dart ├── base │ └── BaseStatefulWidget.dart ├── domain │ ├── DiscoveryBean.dart │ ├── SystemClassBean.dart │ ├── UserInfoBean.dart │ └── event │ │ └── LoginEvent.dart ├── main.dart ├── pages │ ├── DiscoveryPage.dart │ ├── MyInfoPage.dart │ ├── NewsListPage.dart │ ├── SystemPage.dart │ ├── TweetsListPage.dart │ ├── info │ │ └── UserInfoPage.dart │ ├── login │ │ ├── LoginPage.dart │ │ ├── RegisterPage.dart │ │ └── WebLoginPage.dart │ ├── menu │ │ └── SetPage.dart │ ├── news │ │ └── NewsDetailPage.dart │ ├── system │ │ ├── SystemChildPage.dart │ │ └── SystemListPage.dart │ └── tweet │ │ ├── TweetChildPage.dart │ │ └── TweetDetailPage.dart ├── utils │ ├── WidgetsUtils.dart │ ├── cache │ │ └── SpUtils.dart │ ├── net │ │ ├── Api.dart │ │ ├── Http.dart │ │ └── ParamsUtils.dart │ └── toast │ │ └── TsUtils.dart └── widgets │ ├── LeftDraw.dart │ └── SlideView.dart ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .atom/ 3 | .idea 4 | .vscode/ 5 | .packages 6 | .pub/ 7 | build/ 8 | ios/.generated/ 9 | packages 10 | pubspec.lock 11 | .flutter-plugins 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TuneAndroid 2 | 3 | 一个可供参考的FlutterDemo项目 4 | 5 | 接口来自[玩安卓](http://www.wanandroid.com/blog/show/2) 6 | 7 | ## 部分页面 8 | 9 | ![image.png](https://upload-images.jianshu.io/upload_images/1924616-455d90b17f879232.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 10 | 11 | ![首页图](https://upload-images.jianshu.io/upload_images/1924616-16f9d1698123c1e6.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 12 | 13 | 14 | ![个人中心界面](https://upload-images.jianshu.io/upload_images/1924616-17989f91a3201b86.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 15 | 16 | 17 | [下载地址](https://www.pgyer.com/Kjak) 18 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | *.class 3 | .gradle 4 | /local.properties 5 | /.idea/workspace.xml 6 | /.idea/libraries 7 | .DS_Store 8 | /build 9 | /captures 10 | GeneratedPluginRegistrant.java 11 | -------------------------------------------------------------------------------- /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 | apply plugin: 'com.android.application' 15 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 16 | 17 | android { 18 | compileSdkVersion 27 19 | 20 | lintOptions { 21 | disable 'InvalidPackage' 22 | } 23 | 24 | defaultConfig { 25 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 26 | applicationId "com.Ly.osChina.dev" 27 | minSdkVersion 16 28 | targetSdkVersion 27 29 | versionCode 1 30 | versionName "1.0" 31 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 32 | } 33 | 34 | buildTypes { 35 | release { 36 | // TODO: Add your own signing config for the release build. 37 | // Signing with the debug keys for now, so `flutter run --release` works. 38 | signingConfig signingConfigs.debug 39 | } 40 | } 41 | } 42 | 43 | flutter { 44 | source '../..' 45 | } 46 | 47 | dependencies { 48 | testImplementation 'junit:junit:4.12' 49 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 50 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 51 | } 52 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/flutterdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.flutterdemo; 2 | 3 | import android.os.Bundle; 4 | 5 | import io.flutter.app.FlutterActivity; 6 | import io.flutter.plugins.GeneratedPluginRegistrant; 7 | 8 | public class MainActivity extends FlutterActivity { 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | GeneratedPluginRegistrant.registerWith(this); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.0.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /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.1-all.zip 7 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /images/android.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/android.jpg -------------------------------------------------------------------------------- /images/author.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/author.png -------------------------------------------------------------------------------- /images/cover_img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/cover_img.jpg -------------------------------------------------------------------------------- /images/ic_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_about.png -------------------------------------------------------------------------------- /images/ic_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_arrow_right.png -------------------------------------------------------------------------------- /images/ic_avatar_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_avatar_default.png -------------------------------------------------------------------------------- /images/ic_comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_comment.png -------------------------------------------------------------------------------- /images/ic_discover_gist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_discover_gist.png -------------------------------------------------------------------------------- /images/ic_discover_git.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_discover_git.png -------------------------------------------------------------------------------- /images/ic_discover_nearby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_discover_nearby.png -------------------------------------------------------------------------------- /images/ic_discover_pos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_discover_pos.png -------------------------------------------------------------------------------- /images/ic_discover_scan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_discover_scan.png -------------------------------------------------------------------------------- /images/ic_discover_shake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_discover_shake.png -------------------------------------------------------------------------------- /images/ic_discover_softwares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_discover_softwares.png -------------------------------------------------------------------------------- /images/ic_img_default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_img_default.jpg -------------------------------------------------------------------------------- /images/ic_is_like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_is_like.png -------------------------------------------------------------------------------- /images/ic_my_blog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_my_blog.png -------------------------------------------------------------------------------- /images/ic_my_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_my_message.png -------------------------------------------------------------------------------- /images/ic_my_question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_my_question.png -------------------------------------------------------------------------------- /images/ic_my_recommend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_my_recommend.png -------------------------------------------------------------------------------- /images/ic_my_team.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_my_team.png -------------------------------------------------------------------------------- /images/ic_nav_discover_actived.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_nav_discover_actived.png -------------------------------------------------------------------------------- /images/ic_nav_discover_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_nav_discover_normal.png -------------------------------------------------------------------------------- /images/ic_nav_my_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_nav_my_normal.png -------------------------------------------------------------------------------- /images/ic_nav_my_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_nav_my_pressed.png -------------------------------------------------------------------------------- /images/ic_nav_news_actived.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_nav_news_actived.png -------------------------------------------------------------------------------- /images/ic_nav_news_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_nav_news_normal.png -------------------------------------------------------------------------------- /images/ic_nav_tweet_actived.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_nav_tweet_actived.png -------------------------------------------------------------------------------- /images/ic_nav_tweet_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_nav_tweet_normal.png -------------------------------------------------------------------------------- /images/ic_set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_set.png -------------------------------------------------------------------------------- /images/ic_un_like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_un_like.png -------------------------------------------------------------------------------- /images/ic_xiaoxin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/ic_xiaoxin.jpg -------------------------------------------------------------------------------- /images/lake.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/lake.jpg -------------------------------------------------------------------------------- /images/leftmenu/dizzy_face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/leftmenu/dizzy_face.png -------------------------------------------------------------------------------- /images/leftmenu/ic_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/leftmenu/ic_about.png -------------------------------------------------------------------------------- /images/leftmenu/ic_fabu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/leftmenu/ic_fabu.png -------------------------------------------------------------------------------- /images/leftmenu/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/leftmenu/ic_settings.png -------------------------------------------------------------------------------- /images/leftmenu/ic_xiaoheiwu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/leftmenu/ic_xiaoheiwu.png -------------------------------------------------------------------------------- /images/leftmenu/sob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/leftmenu/sob.png -------------------------------------------------------------------------------- /images/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/more.png -------------------------------------------------------------------------------- /images/oschina.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/images/oschina.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | *.pbxuser 16 | *.mode1v3 17 | *.mode2v3 18 | *.perspectivev3 19 | 20 | !default.pbxuser 21 | !default.mode1v3 22 | !default.mode2v3 23 | !default.perspectivev3 24 | 25 | xcuserdata 26 | 27 | *.moved-aside 28 | 29 | *.pyc 30 | *sync/ 31 | Icon? 32 | .tags* 33 | 34 | /Flutter/app.flx 35 | /Flutter/app.zip 36 | /Flutter/flutter_assets/ 37 | /Flutter/App.framework 38 | /Flutter/Flutter.framework 39 | /Flutter/Generated.xcconfig 40 | /ServiceDefinitions.json 41 | 42 | Pods/ 43 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | UIRequiredDeviceCapabilities 24 | 25 | arm64 26 | 27 | MinimumOSVersion 28 | 8.0 29 | 30 | 31 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; 19 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 20 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 21 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 22 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 23 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXCopyFilesBuildPhase section */ 27 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 28 | isa = PBXCopyFilesBuildPhase; 29 | buildActionMask = 2147483647; 30 | dstPath = ""; 31 | dstSubfolderSpec = 10; 32 | files = ( 33 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 34 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 35 | ); 36 | name = "Embed Frameworks"; 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXCopyFilesBuildPhase section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 43 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 44 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 45 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 46 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 47 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 48 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 49 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 50 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 51 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 52 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 53 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 55 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 57 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 58 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 67 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | /* End PBXFrameworksBuildPhase section */ 72 | 73 | /* Begin PBXGroup section */ 74 | 9740EEB11CF90186004384FC /* Flutter */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 78 | 3B80C3931E831B6300D905FE /* App.framework */, 79 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 80 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 81 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 82 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 83 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 84 | ); 85 | name = Flutter; 86 | sourceTree = ""; 87 | }; 88 | 97C146E51CF9000F007C117D = { 89 | isa = PBXGroup; 90 | children = ( 91 | 9740EEB11CF90186004384FC /* Flutter */, 92 | 97C146F01CF9000F007C117D /* Runner */, 93 | 97C146EF1CF9000F007C117D /* Products */, 94 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 97C146EF1CF9000F007C117D /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 97C146EE1CF9000F007C117D /* Runner.app */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | 97C146F01CF9000F007C117D /* Runner */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 110 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 111 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 112 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 113 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 114 | 97C147021CF9000F007C117D /* Info.plist */, 115 | 97C146F11CF9000F007C117D /* Supporting Files */, 116 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 117 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 118 | ); 119 | path = Runner; 120 | sourceTree = ""; 121 | }; 122 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 97C146F21CF9000F007C117D /* main.m */, 126 | ); 127 | name = "Supporting Files"; 128 | sourceTree = ""; 129 | }; 130 | /* End PBXGroup section */ 131 | 132 | /* Begin PBXNativeTarget section */ 133 | 97C146ED1CF9000F007C117D /* Runner */ = { 134 | isa = PBXNativeTarget; 135 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 136 | buildPhases = ( 137 | 9740EEB61CF901F6004384FC /* Run Script */, 138 | 97C146EA1CF9000F007C117D /* Sources */, 139 | 97C146EB1CF9000F007C117D /* Frameworks */, 140 | 97C146EC1CF9000F007C117D /* Resources */, 141 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 142 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = Runner; 149 | productName = Runner; 150 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 151 | productType = "com.apple.product-type.application"; 152 | }; 153 | /* End PBXNativeTarget section */ 154 | 155 | /* Begin PBXProject section */ 156 | 97C146E61CF9000F007C117D /* Project object */ = { 157 | isa = PBXProject; 158 | attributes = { 159 | LastUpgradeCheck = 0910; 160 | ORGANIZATIONNAME = "The Chromium Authors"; 161 | TargetAttributes = { 162 | 97C146ED1CF9000F007C117D = { 163 | CreatedOnToolsVersion = 7.3.1; 164 | }; 165 | }; 166 | }; 167 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 168 | compatibilityVersion = "Xcode 3.2"; 169 | developmentRegion = English; 170 | hasScannedForEncodings = 0; 171 | knownRegions = ( 172 | en, 173 | Base, 174 | ); 175 | mainGroup = 97C146E51CF9000F007C117D; 176 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 177 | projectDirPath = ""; 178 | projectRoot = ""; 179 | targets = ( 180 | 97C146ED1CF9000F007C117D /* Runner */, 181 | ); 182 | }; 183 | /* End PBXProject section */ 184 | 185 | /* Begin PBXResourcesBuildPhase section */ 186 | 97C146EC1CF9000F007C117D /* Resources */ = { 187 | isa = PBXResourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 191 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, 192 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 193 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 194 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 195 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 196 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | }; 200 | /* End PBXResourcesBuildPhase section */ 201 | 202 | /* Begin PBXShellScriptBuildPhase section */ 203 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 204 | isa = PBXShellScriptBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | ); 208 | inputPaths = ( 209 | ); 210 | name = "Thin Binary"; 211 | outputPaths = ( 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | shellPath = /bin/sh; 215 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 216 | }; 217 | 9740EEB61CF901F6004384FC /* Run Script */ = { 218 | isa = PBXShellScriptBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | ); 222 | inputPaths = ( 223 | ); 224 | name = "Run Script"; 225 | outputPaths = ( 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | shellPath = /bin/sh; 229 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 230 | }; 231 | /* End PBXShellScriptBuildPhase section */ 232 | 233 | /* Begin PBXSourcesBuildPhase section */ 234 | 97C146EA1CF9000F007C117D /* Sources */ = { 235 | isa = PBXSourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 239 | 97C146F31CF9000F007C117D /* main.m in Sources */, 240 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | /* End PBXSourcesBuildPhase section */ 245 | 246 | /* Begin PBXVariantGroup section */ 247 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 248 | isa = PBXVariantGroup; 249 | children = ( 250 | 97C146FB1CF9000F007C117D /* Base */, 251 | ); 252 | name = Main.storyboard; 253 | sourceTree = ""; 254 | }; 255 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 256 | isa = PBXVariantGroup; 257 | children = ( 258 | 97C147001CF9000F007C117D /* Base */, 259 | ); 260 | name = LaunchScreen.storyboard; 261 | sourceTree = ""; 262 | }; 263 | /* End PBXVariantGroup section */ 264 | 265 | /* Begin XCBuildConfiguration section */ 266 | 97C147031CF9000F007C117D /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 269 | buildSettings = { 270 | ALWAYS_SEARCH_USER_PATHS = NO; 271 | CLANG_ANALYZER_NONNULL = YES; 272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 273 | CLANG_CXX_LIBRARY = "libc++"; 274 | CLANG_ENABLE_MODULES = YES; 275 | CLANG_ENABLE_OBJC_ARC = YES; 276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_COMMA = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 281 | CLANG_WARN_EMPTY_BODY = YES; 282 | CLANG_WARN_ENUM_CONVERSION = YES; 283 | CLANG_WARN_INFINITE_RECURSION = YES; 284 | CLANG_WARN_INT_CONVERSION = YES; 285 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 286 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 287 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 288 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 289 | CLANG_WARN_STRICT_PROTOTYPES = YES; 290 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 291 | CLANG_WARN_UNREACHABLE_CODE = YES; 292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 293 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 294 | COPY_PHASE_STRIP = NO; 295 | DEBUG_INFORMATION_FORMAT = dwarf; 296 | ENABLE_STRICT_OBJC_MSGSEND = YES; 297 | ENABLE_TESTABILITY = YES; 298 | GCC_C_LANGUAGE_STANDARD = gnu99; 299 | GCC_DYNAMIC_NO_PIC = NO; 300 | GCC_NO_COMMON_BLOCKS = YES; 301 | GCC_OPTIMIZATION_LEVEL = 0; 302 | GCC_PREPROCESSOR_DEFINITIONS = ( 303 | "DEBUG=1", 304 | "$(inherited)", 305 | ); 306 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 307 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 308 | GCC_WARN_UNDECLARED_SELECTOR = YES; 309 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 310 | GCC_WARN_UNUSED_FUNCTION = YES; 311 | GCC_WARN_UNUSED_VARIABLE = YES; 312 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 313 | MTL_ENABLE_DEBUG_INFO = YES; 314 | ONLY_ACTIVE_ARCH = YES; 315 | SDKROOT = iphoneos; 316 | TARGETED_DEVICE_FAMILY = "1,2"; 317 | }; 318 | name = Debug; 319 | }; 320 | 97C147041CF9000F007C117D /* Release */ = { 321 | isa = XCBuildConfiguration; 322 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 323 | buildSettings = { 324 | ALWAYS_SEARCH_USER_PATHS = NO; 325 | CLANG_ANALYZER_NONNULL = YES; 326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 327 | CLANG_CXX_LIBRARY = "libc++"; 328 | CLANG_ENABLE_MODULES = YES; 329 | CLANG_ENABLE_OBJC_ARC = YES; 330 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 331 | CLANG_WARN_BOOL_CONVERSION = YES; 332 | CLANG_WARN_COMMA = YES; 333 | CLANG_WARN_CONSTANT_CONVERSION = YES; 334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 341 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 342 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 343 | CLANG_WARN_STRICT_PROTOTYPES = YES; 344 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 345 | CLANG_WARN_UNREACHABLE_CODE = YES; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 348 | COPY_PHASE_STRIP = NO; 349 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 350 | ENABLE_NS_ASSERTIONS = NO; 351 | ENABLE_STRICT_OBJC_MSGSEND = YES; 352 | GCC_C_LANGUAGE_STANDARD = gnu99; 353 | GCC_NO_COMMON_BLOCKS = YES; 354 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 355 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 356 | GCC_WARN_UNDECLARED_SELECTOR = YES; 357 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 358 | GCC_WARN_UNUSED_FUNCTION = YES; 359 | GCC_WARN_UNUSED_VARIABLE = YES; 360 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 361 | MTL_ENABLE_DEBUG_INFO = NO; 362 | SDKROOT = iphoneos; 363 | TARGETED_DEVICE_FAMILY = "1,2"; 364 | VALIDATE_PRODUCT = YES; 365 | }; 366 | name = Release; 367 | }; 368 | 97C147061CF9000F007C117D /* Debug */ = { 369 | isa = XCBuildConfiguration; 370 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 371 | buildSettings = { 372 | ARCHS = arm64; 373 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 374 | ENABLE_BITCODE = NO; 375 | FRAMEWORK_SEARCH_PATHS = ( 376 | "$(inherited)", 377 | "$(PROJECT_DIR)/Flutter", 378 | ); 379 | INFOPLIST_FILE = Runner/Info.plist; 380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 381 | LIBRARY_SEARCH_PATHS = ( 382 | "$(inherited)", 383 | "$(PROJECT_DIR)/Flutter", 384 | ); 385 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterdemo; 386 | PRODUCT_NAME = "$(TARGET_NAME)"; 387 | }; 388 | name = Debug; 389 | }; 390 | 97C147071CF9000F007C117D /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 393 | buildSettings = { 394 | ARCHS = arm64; 395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 396 | ENABLE_BITCODE = NO; 397 | FRAMEWORK_SEARCH_PATHS = ( 398 | "$(inherited)", 399 | "$(PROJECT_DIR)/Flutter", 400 | ); 401 | INFOPLIST_FILE = Runner/Info.plist; 402 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 403 | LIBRARY_SEARCH_PATHS = ( 404 | "$(inherited)", 405 | "$(PROJECT_DIR)/Flutter", 406 | ); 407 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterdemo; 408 | PRODUCT_NAME = "$(TARGET_NAME)"; 409 | }; 410 | name = Release; 411 | }; 412 | /* End XCBuildConfiguration section */ 413 | 414 | /* Begin XCConfigurationList section */ 415 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 416 | isa = XCConfigurationList; 417 | buildConfigurations = ( 418 | 97C147031CF9000F007C117D /* Debug */, 419 | 97C147041CF9000F007C117D /* Release */, 420 | ); 421 | defaultConfigurationIsVisible = 0; 422 | defaultConfigurationName = Release; 423 | }; 424 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 425 | isa = XCConfigurationList; 426 | buildConfigurations = ( 427 | 97C147061CF9000F007C117D /* Debug */, 428 | 97C147071CF9000F007C117D /* Release */, 429 | ); 430 | defaultConfigurationIsVisible = 0; 431 | defaultConfigurationName = Release; 432 | }; 433 | /* End XCConfigurationList section */ 434 | }; 435 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 436 | } 437 | -------------------------------------------------------------------------------- /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 | 8 | -------------------------------------------------------------------------------- /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 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 7 | [GeneratedPluginRegistrant registerWithRegistry:self]; 8 | // Override point for customization after application launch. 9 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/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/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinHuanTanLy/TuneAndroid/96f666d918e390d84894cb0be843772ac00ea1b1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutterdemo 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | arm64 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /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/app/OsApplication.dart: -------------------------------------------------------------------------------- 1 | import 'package:event_bus/event_bus.dart'; 2 | 3 | class OsApplication{ 4 | static String cookie; 5 | 6 | static EventBus eventBus=new EventBus(); 7 | } -------------------------------------------------------------------------------- /lib/base/BaseStatefulWidget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class BaseStatefulWidget extends StatefulWidget { 4 | @override 5 | _BaseStatefulWidgetState createState() => _BaseStatefulWidgetState(); 6 | } 7 | 8 | class _BaseStatefulWidgetState extends State { 9 | @override 10 | Widget build(BuildContext context) { 11 | return Container(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/domain/DiscoveryBean.dart: -------------------------------------------------------------------------------- 1 | class DiscoveryBean { 2 | // 菜单的资源文件 3 | var menuRes; 4 | 5 | // 菜单的按钮文字 6 | var menuMsg; 7 | 8 | // 是否跳转到webView 9 | bool isLinkWebPage; 10 | 11 | // 跳转地址 12 | String linkUrl; 13 | 14 | // 菜单是否有顶部高间距 15 | bool isMarginTop; 16 | 17 | // 菜单是否是长长的分割线 18 | bool isLongLine; 19 | 20 | DiscoveryBean( 21 | this.menuRes, 22 | this.menuMsg, 23 | this.isMarginTop, 24 | this.isLongLine, { 25 | this.isLinkWebPage=false, 26 | this.linkUrl, 27 | }); 28 | } 29 | -------------------------------------------------------------------------------- /lib/domain/SystemClassBean.dart: -------------------------------------------------------------------------------- 1 | class SystemClassBean{ 2 | int cId; 3 | String cName; 4 | 5 | SystemClassBean(this.cId, this.cName); 6 | 7 | } -------------------------------------------------------------------------------- /lib/domain/UserInfoBean.dart: -------------------------------------------------------------------------------- 1 | class UserInfoBean{ 2 | 3 | var id; 4 | var username; 5 | var email; 6 | var url; 7 | 8 | UserInfoBean(this.id, this.username, this.email); 9 | 10 | } -------------------------------------------------------------------------------- /lib/domain/event/LoginEvent.dart: -------------------------------------------------------------------------------- 1 | class LoginEvent{ 2 | var userName; 3 | 4 | LoginEvent(this.userName); 5 | 6 | } -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterdemo/pages/SystemPage.dart'; 3 | import 'package:flutterdemo/utils/net/ParamsUtils.dart'; 4 | import 'pages/NewsListPage.dart'; 5 | import 'pages/DiscoveryPage.dart'; 6 | import 'pages/MyInfoPage.dart'; 7 | import 'package:flutter/cupertino.dart'; 8 | import 'package:flutterdemo/widgets/LeftDraw.dart'; 9 | import 'package:flutter/rendering.dart'; 10 | 11 | //首页 12 | void main() { 13 | debugPaintSizeEnabled = false; 14 | runApp(new MyApp()); 15 | } 16 | 17 | //运行首页 18 | class MyApp extends StatefulWidget { 19 | @override 20 | State createState() { 21 | return new MyMainState(); 22 | } 23 | } 24 | 25 | class MyMainState extends State { 26 | // 默认索引第一个tab 27 | int _tabIndex = 0; 28 | 29 | // 正常情况的字体样式 30 | final tabTextStyleNormal = new TextStyle(color: const Color(0xff969696)); 31 | 32 | // 选中情况的字体样式 33 | final tabTextStyleSelect = new TextStyle(color: const Color(0xff63ca6c)); 34 | 35 | // 底部菜单栏图标数组 36 | var tabImages; 37 | 38 | // 页面内容 39 | var _body; 40 | 41 | // 菜单文案 42 | var tabTitles = ['文章', '体系', '发现', '我的']; 43 | 44 | // 路由map 45 | Map _routes = new Map(); 46 | 47 | // 生成image组件 48 | Image getTabImage(path) { 49 | return new Image.asset(path, width: 20.0, height: 20.0); 50 | } 51 | 52 | void initData() { 53 | // 先那一次数据,把accesstoken放到内存 54 | ParamsUtils.getParams(); 55 | if (tabImages == null) { 56 | tabImages = [ 57 | [ 58 | getTabImage('images/ic_nav_news_normal.png'), 59 | getTabImage('images/ic_nav_news_actived.png') 60 | ], 61 | [ 62 | getTabImage('images/ic_nav_tweet_normal.png'), 63 | getTabImage('images/ic_nav_tweet_actived.png') 64 | ], 65 | [ 66 | getTabImage('images/ic_nav_discover_normal.png'), 67 | getTabImage('images/ic_nav_discover_actived.png') 68 | ], 69 | [ 70 | getTabImage('images/ic_nav_my_normal.png'), 71 | getTabImage('images/ic_nav_my_pressed.png') 72 | ] 73 | ]; 74 | } 75 | _body = new IndexedStack( 76 | children: [ 77 | new NewsListPage(), 78 | new SystemPage(), 79 | new DiscoveryPage(), 80 | new MyInfoPage() 81 | ], 82 | index: _tabIndex, 83 | ); 84 | } 85 | 86 | //获取菜单栏字体样式 87 | TextStyle getTabTextStyle(int curIndex) { 88 | if (curIndex == _tabIndex) { 89 | return tabTextStyleSelect; 90 | } else { 91 | return tabTextStyleNormal; 92 | } 93 | } 94 | 95 | // 获取图标 96 | Image getTabIcon(int curIndex) { 97 | if (curIndex == _tabIndex) { 98 | return tabImages[curIndex][1]; 99 | } 100 | return tabImages[curIndex][0]; 101 | } 102 | 103 | // 获取标题文本 104 | Text getTabTitle(int curIndex) { 105 | return new Text( 106 | tabTitles[curIndex], 107 | style: getTabTextStyle(curIndex), 108 | ); 109 | } 110 | 111 | // 获取BottomNavigationBarItem 112 | List getBottomNavigationBarItem() { 113 | List list = new List(); 114 | for (int i = 0; i < 4; i++) { 115 | list.add(new BottomNavigationBarItem( 116 | icon: getTabIcon(i), title: getTabTitle(i))); 117 | } 118 | return list; 119 | } 120 | 121 | @override 122 | Widget build(BuildContext context) { 123 | initData(); 124 | return new MaterialApp( 125 | theme: new ThemeData(primaryColor: const Color(0xFF63CA6C)), 126 | routes: _routes, 127 | home: new Scaffold( 128 | appBar: new AppBar( 129 | title: new Text(tabTitles[_tabIndex], 130 | style: new TextStyle(color: Colors.white)), 131 | iconTheme: new IconThemeData(color: Colors.white), 132 | ), 133 | body: _body, 134 | bottomNavigationBar: new CupertinoTabBar( 135 | items: getBottomNavigationBarItem(), 136 | currentIndex: _tabIndex, 137 | onTap: (index) { 138 | setState(() { 139 | _tabIndex = index; 140 | }); 141 | }, 142 | ), 143 | drawer: new Container(child: new LeftDraw(),)), 144 | ); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /lib/pages/DiscoveryPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:flutterdemo/domain/DiscoveryBean.dart'; 4 | import 'package:flutterdemo/pages/news/NewsDetailPage.dart'; 5 | 6 | class DiscoveryPage extends StatelessWidget { 7 | //数据源 8 | List discoveryDataSource = []; 9 | 10 | // 菜单字体样式 11 | var menuStyle = new TextStyle(color: const Color(0xff333333), fontSize: 16.0); 12 | 13 | // listView的item的左右margin 14 | static const itemMarginLeftRight = 16.0; 15 | 16 | // listView的菜单图标的宽高 这里狂暴地定义为正方形 17 | static const itemResWidthHeight = 30.0; 18 | 19 | // listView的文字的左右margin; 20 | static const textMarginLeftRight = 10.0; 21 | 22 | // 短的分割线应该是左右margin+图标宽高+文字margin 23 | static const shortDivisionPaddingLeft = 24 | itemMarginLeftRight + itemResWidthHeight + textMarginLeftRight; 25 | 26 | DiscoveryPage() { 27 | var osSoft = new DiscoveryBean( 28 | 'images/ic_discover_softwares.png', '开源软件', true, false, 29 | isLinkWebPage: true, linkUrl: 'https://zb.oschina.net/?from=osc'); 30 | var recommend = new DiscoveryBean( 31 | 'images/ic_discover_git.png', '码云推荐', false, false, 32 | isLinkWebPage: true, linkUrl: 'https://www.oschina.net/blog'); 33 | var fragment = new DiscoveryBean( 34 | 'images/ic_discover_gist.png', '代码片段', false, true, 35 | isLinkWebPage: true, 36 | linkUrl: 'https://github.com/LinHuanTanLy/FlutterOsChina'); 37 | var qr = 38 | new DiscoveryBean('images/ic_discover_scan.png', '扫一扫', true, false); 39 | var wave = 40 | new DiscoveryBean('images/ic_discover_shake.png', '摇一摇', false, true); 41 | var nearby = new DiscoveryBean( 42 | 'images/ic_discover_nearby.png', '码云封面人物', true, false, 43 | isLinkWebPage: true, 44 | linkUrl: 45 | 'https://www.oschina.net/question/tag/%E9%AB%98%E6%89%8B%E9%97%AE%E7%AD%94'); 46 | var offline = new DiscoveryBean( 47 | 'images/ic_discover_pos.png', '线下活动', false, true, 48 | isLinkWebPage: true, linkUrl: 'https://www.oschina.net/event'); 49 | discoveryDataSource.add(osSoft); 50 | discoveryDataSource.add(recommend); 51 | discoveryDataSource.add(fragment); 52 | discoveryDataSource.add(qr); 53 | discoveryDataSource.add(wave); 54 | discoveryDataSource.add(nearby); 55 | discoveryDataSource.add(offline); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return new Center( 61 | child: initDiscoveryList(), 62 | ); 63 | } 64 | 65 | // 定义发现页面列表 66 | Widget initDiscoveryList() { 67 | return new ListView.builder( 68 | itemBuilder: renderRow, 69 | itemCount: discoveryDataSource.length, 70 | ); 71 | } 72 | 73 | Widget renderRow(BuildContext con, int index) { 74 | DiscoveryBean bean = discoveryDataSource[index]; 75 | var marginTop = bean.isMarginTop ? 20.0 : 0.0; 76 | var paddingLeft = bean.isLongLine ? 00.0 : shortDivisionPaddingLeft; 77 | return new InkWell( 78 | child: new Column( 79 | children: [ 80 | new Container( 81 | height: 50.0, 82 | margin: new EdgeInsets.fromLTRB( 83 | itemMarginLeftRight, marginTop, itemMarginLeftRight, 0.0), 84 | child: new Row( 85 | children: [ 86 | new Image.asset( 87 | bean.menuRes, 88 | width: itemResWidthHeight, 89 | height: itemResWidthHeight, 90 | ), 91 | new Expanded( 92 | child: new Padding( 93 | padding: new EdgeInsets.fromLTRB( 94 | textMarginLeftRight, 0.0, textMarginLeftRight, 0.0), 95 | child: new Text( 96 | bean.menuMsg, 97 | style: menuStyle, 98 | ), 99 | )), 100 | new Image.asset( 101 | 'images/ic_arrow_right.png', 102 | width: 16.0, 103 | height: 16.0, 104 | ) 105 | ], 106 | ), 107 | ), 108 | new Padding( 109 | padding: new EdgeInsets.fromLTRB(paddingLeft, 0.0, 0.0, 0.0), 110 | child: new Divider( 111 | height: 1.0, 112 | ), 113 | ) 114 | ], 115 | ), 116 | onTap: () { 117 | if(bean.isLinkWebPage){ 118 | Navigator.of(con).push(new MaterialPageRoute(builder: (context){ 119 | return new NewsDetailPage(bean.linkUrl,bean.menuMsg); 120 | })); 121 | }else{ 122 | 123 | } 124 | }, 125 | ); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /lib/pages/MyInfoPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterdemo/app/OsApplication.dart'; 3 | import 'package:flutterdemo/domain/event/LoginEvent.dart'; 4 | import 'package:flutterdemo/pages/info/UserInfoPage.dart'; 5 | import 'package:flutterdemo/pages/login/LoginPage.dart'; 6 | import 'package:flutterdemo/utils/cache/SpUtils.dart'; 7 | import 'package:event_bus/event_bus.dart'; 8 | 9 | class MyInfoPage extends StatefulWidget { 10 | @override 11 | _MyInfoPageState createState() => _MyInfoPageState(); 12 | } 13 | 14 | class _MyInfoPageState extends State { 15 | static const double IMAGE_ICON_WIDTH = 30.0; 16 | static const double ARROW_ICON_WIDTH = 16.0; 17 | 18 | var userAvatar; 19 | var userName; 20 | var titles = ["我的消息", "阅读记录", "我的博客", "我的问答", "我的活动", "我的团队", "邀请好友"]; 21 | var imagePaths = [ 22 | "images/ic_my_message.png", 23 | "images/ic_my_blog.png", 24 | "images/ic_my_blog.png", 25 | "images/ic_my_question.png", 26 | "images/ic_discover_pos.png", 27 | "images/ic_my_team.png", 28 | "images/ic_my_recommend.png" 29 | ]; 30 | 31 | var titleTextStyle = new TextStyle(fontSize: 16.0); 32 | var rightArrowIcon = new Image.asset( 33 | 'images/ic_arrow_right.png', 34 | width: ARROW_ICON_WIDTH, 35 | height: ARROW_ICON_WIDTH, 36 | ); 37 | 38 | @override 39 | void initState() { 40 | super.initState(); 41 | _getUserInfo(); 42 | OsApplication.eventBus.on().listen((event) { 43 | setState(() { 44 | if (event != null && event.userName != null) { 45 | userName = event.userName; 46 | userAvatar = 'http://www.wanandroid.com/resources/image/pc/logo.png'; 47 | } else { 48 | userName = null; 49 | userAvatar = null; 50 | } 51 | }); 52 | }); 53 | } 54 | 55 | @override 56 | Widget build(BuildContext context) { 57 | return initView(); 58 | } 59 | 60 | // 构建布局 61 | Widget initView() { 62 | return new CustomScrollView(reverse: false, shrinkWrap: false, slivers: < 63 | Widget>[ 64 | new SliverAppBar( 65 | pinned: false, 66 | backgroundColor: Colors.green, 67 | expandedHeight: 200.0, 68 | iconTheme: new IconThemeData(color: Colors.transparent), 69 | flexibleSpace: new InkWell( 70 | onTap: () { 71 | userAvatar == null ? _login() : _userDetail(); 72 | }, 73 | child: new Column( 74 | mainAxisAlignment: MainAxisAlignment.center, 75 | children: [ 76 | userAvatar == null 77 | ? new Image.asset( 78 | "images/ic_avatar_default.png", 79 | width: 60.0, 80 | height: 60.0, 81 | ) 82 | : new Container( 83 | width: 60.0, 84 | height: 60.0, 85 | decoration: new BoxDecoration( 86 | shape: BoxShape.circle, 87 | color: Colors.transparent, 88 | image: new DecorationImage( 89 | image: new NetworkImage(userAvatar), 90 | fit: BoxFit.cover), 91 | border: new Border.all( 92 | color: Colors.white, width: 2.0)), 93 | ), 94 | new Container( 95 | margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0), 96 | child: new Text( 97 | userName == null ? '点击头像登录' : userName, 98 | style: new TextStyle(color: Colors.white, fontSize: 16.0), 99 | ), 100 | ) 101 | ], 102 | )), 103 | ), 104 | new SliverFixedExtentList( 105 | delegate: 106 | new SliverChildBuilderDelegate((BuildContext context, int index) { 107 | String title = titles[index]; 108 | return new Container( 109 | alignment: Alignment.centerLeft, 110 | child: new InkWell( 111 | onTap: () { 112 | print("the is the item of $title"); 113 | }, 114 | child: new Column( 115 | children: [ 116 | new Padding( 117 | padding: 118 | const EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 15.0), 119 | child: new Row( 120 | children: [ 121 | new Expanded( 122 | child: new Text( 123 | title, 124 | style: titleTextStyle, 125 | )), 126 | rightArrowIcon 127 | ], 128 | ), 129 | ), 130 | new Divider( 131 | height: 1.0, 132 | ) 133 | ], 134 | ), 135 | )); 136 | }, childCount: titles.length), 137 | itemExtent: 50.0), 138 | ]); 139 | } 140 | 141 | _login() async { 142 | final result = await Navigator.of(context) 143 | .push(new MaterialPageRoute(builder: (context) { 144 | return new LoginPage(); 145 | })); 146 | if (result != null && result == 'refresh') { 147 | _getUserInfo(); 148 | } 149 | } 150 | 151 | _userDetail() { 152 | Navigator.of(context).push(new MaterialPageRoute(builder: (context) { 153 | return new UserInfoPage(); 154 | })); 155 | } 156 | 157 | _getUserInfo() async { 158 | SpUtils.getUserInfo().then((userInfoBean) { 159 | if (userInfoBean != null && userInfoBean.username != null) { 160 | setState(() { 161 | userName = userInfoBean.username; 162 | userAvatar = 'http://www.wanandroid.com/resources/image/pc/logo.png'; 163 | }); 164 | } 165 | }); 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /lib/pages/NewsListPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutterdemo/pages/news/NewsDetailPage.dart'; 6 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 7 | import 'package:flutterdemo/utils/net/Api.dart'; 8 | import 'package:flutterdemo/utils/net/Http.dart'; 9 | import 'package:flutter_refresh/flutter_refresh.dart'; 10 | import 'package:banner_view/banner_view.dart'; 11 | 12 | // 资讯列表页面 13 | class NewsListPage extends StatefulWidget { 14 | @override 15 | State createState() { 16 | return new NewsListPageState(); 17 | } 18 | } 19 | 20 | class NewsListPageState extends State { 21 | // 轮播图的数据 22 | var slideData = []; 23 | 24 | // 列表的数据(轮播图数据和列表数据分开,但是实际上轮播图和列表中的item同属于ListView的item) 25 | var listData = []; 26 | 27 | // 总数 28 | var listTotalSize; 29 | 30 | // 列表中资讯标题的样式 31 | TextStyle titleTextStyle = new TextStyle(fontSize: 15.0); 32 | 33 | // 时间文本的样式 34 | TextStyle subtitleStyle = 35 | new TextStyle(color: const Color(0xFFB5BDC0), fontSize: 12.0); 36 | 37 | // 作者style 38 | TextStyle authorStyle = new TextStyle( 39 | color: const Color(0xFF000000), fontSize: 12.0); 40 | 41 | // 分页 42 | var _mCurPage = 0; 43 | 44 | 45 | WidgetsUtils mWidgetsUtils; 46 | 47 | @override 48 | void initState() { 49 | super.initState(); 50 | getNewsList(_mCurPage); 51 | getBannerList(); 52 | } 53 | 54 | @override 55 | Widget build(BuildContext context) { 56 | mWidgetsUtils = new WidgetsUtils(context); 57 | if (listData.length == 0) { 58 | return new Center( 59 | child: new CircularProgressIndicator( 60 | backgroundColor: Colors.green, 61 | ), 62 | ); 63 | } else { 64 | return new Refresh( 65 | onFooterRefresh: onFooterRefresh, 66 | onHeaderRefresh: onHeaderRefresh, 67 | childBuilder: (BuildContext context, 68 | {ScrollController controller, ScrollPhysics physics}) { 69 | return new Container( 70 | child: new ListView.builder( 71 | // 这里itemCount是将轮播图组件、分割线和列表items都作为ListView的item算了 72 | itemCount: listData.length * 2 + 1, 73 | controller: controller, 74 | physics: physics, 75 | itemBuilder: (context, i) => renderRow(i))); 76 | }, 77 | ); 78 | } 79 | } 80 | 81 | Future onFooterRefresh() { 82 | return new Future.delayed(new Duration(seconds: 2), () { 83 | setState(() { 84 | _mCurPage++; 85 | getNewsList(_mCurPage); 86 | }); 87 | }); 88 | } 89 | 90 | Future onHeaderRefresh() { 91 | return new Future.delayed(new Duration(seconds: 2), () { 92 | setState(() { 93 | _mCurPage = 1; 94 | getBannerList(); 95 | getNewsList(_mCurPage); 96 | }); 97 | }); 98 | } 99 | 100 | // 获取Banner数据 101 | getBannerList() { 102 | Http.get(Api.HOME_BANNER).then((res) { 103 | Map map = jsonDecode(res); 104 | setState(() { 105 | slideData = map['data']; 106 | }); 107 | }); 108 | } 109 | 110 | // 获取文章列表数据 111 | getNewsList(int curPage) { 112 | var url = Api.HOME_ARTICLE + curPage.toString() + "/json"; 113 | Http.get(url).then((res) { 114 | try { 115 | Map map = jsonDecode(res); 116 | setState(() { 117 | var _listData = map['data']['datas']; 118 | if (curPage == 1) { 119 | listData.clear(); 120 | listData.addAll(_listData); 121 | } else { 122 | listData.addAll(_listData); 123 | } 124 | }); 125 | } catch (e) { 126 | print('错误catch s $e'); 127 | } 128 | }); 129 | } 130 | 131 | // 渲染列表item 132 | Widget renderRow(i) { 133 | // i为0时渲染轮播图 134 | if (i == 0) { 135 | if (slideData != null && slideData.length > 0) { 136 | return new Container( 137 | height: 180.0, 138 | child: new BannerView(mWidgetsUtils.getBannerChild(context,slideData), 139 | intervalDuration: const Duration(seconds: 3), 140 | animationDuration: const Duration(milliseconds: 500)), 141 | ); 142 | } 143 | } 144 | // i > 0时 145 | i -= 1; 146 | // i为奇数,渲染分割线 147 | if (i.isOdd) { 148 | return new Divider(height: 1.0); 149 | } 150 | // 将i取整 151 | i = i ~/ 2; 152 | // 得到列表item的数据 153 | var itemData = listData[i]; 154 | 155 | // 标题行 156 | var titleRow = new Row( 157 | children: [ 158 | 159 | // 标题充满一整行,所以用Expanded组件包裹 160 | new Expanded( 161 | child: new Text(itemData['title'], style: titleTextStyle), 162 | ) 163 | ], 164 | ); 165 | // 时间这一行包含了作者头像、时间、评论数这几个 166 | var timeRow = new Row( 167 | children: [ 168 | new Container( 169 | child: new Text( 170 | itemData['superChapterName'], 171 | style: subtitleStyle, 172 | ), 173 | ), 174 | // 这是时间文本 175 | new Padding( 176 | padding: const EdgeInsets.fromLTRB(4.0, 0.0, 0.0, 0.0), 177 | child: new Text( 178 | itemData['niceDate'], 179 | style: subtitleStyle, 180 | ), 181 | ), 182 | // 这是评论数,评论数由一个评论图标和具体的评论数构成,所以是一个Row组件 183 | new Expanded( 184 | flex: 1, 185 | child: new Row( 186 | // 为了让评论数显示在最右侧,所以需要外面的Expanded和这里的MainAxisAlignment.end 187 | mainAxisAlignment: MainAxisAlignment.end, 188 | children: [ 189 | new Text("${itemData['zan']}", style: subtitleStyle), 190 | new Padding( 191 | padding: new EdgeInsets.fromLTRB(4.0, 0.0, 0.0, 0.0), 192 | child: new Image.asset(itemData['collect']?'./images/ic_is_like.png':'./images/ic_un_like.png', 193 | width: 16.0, height: 16.0), 194 | ) 195 | ], 196 | ), 197 | ) 198 | ], 199 | ); 200 | var row = new Row( 201 | children: [ 202 | // 左边是标题,时间,评论数等信息 203 | new Expanded( 204 | flex: 1, 205 | child: new Padding( 206 | padding: const EdgeInsets.all(10.0), 207 | child: new Column( 208 | children: [ 209 | new Row(children: [ 210 | new Container( 211 | width: 14.0, 212 | height: 14.0, 213 | child: new Image.asset('./images/author.png'), 214 | margin: new EdgeInsets.fromLTRB(0.0, 0.0, 2.0, 0.0),), 215 | new Text('${itemData['author']}', style: authorStyle,) 216 | ],), 217 | new Container( 218 | margin: new EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 6.0), 219 | child: titleRow, 220 | ), 221 | new Padding( 222 | padding: const EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 0.0), 223 | child: timeRow, 224 | ) 225 | ], 226 | ), 227 | ), 228 | ), 229 | ], 230 | ); 231 | return new InkWell( 232 | child: row, 233 | onTap: () { 234 | Navigator.of(context).push(new MaterialPageRoute(builder: (context) { 235 | return new NewsDetailPage(itemData['link'],itemData['title']); 236 | })); 237 | }, 238 | ); 239 | } 240 | } 241 | -------------------------------------------------------------------------------- /lib/pages/SystemPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutterdemo/domain/SystemClassBean.dart'; 5 | import 'package:flutterdemo/utils/net/Api.dart'; 6 | import 'package:flutterdemo/utils/net/Http.dart'; 7 | import 'package:flutterdemo/pages/system/SystemListPage.dart'; 8 | 9 | class SystemPage extends StatefulWidget { 10 | @override 11 | _SystemPageState createState() => _SystemPageState(); 12 | } 13 | 14 | class _SystemPageState extends State { 15 | var _treeList = []; 16 | 17 | var _titleStyle = new TextStyle(color: Colors.black, fontSize: 16.0); 18 | var _childStyle = new TextStyle(color: Color(0xFFB5BDC0), fontSize: 14.0); 19 | 20 | @override 21 | void initState() { 22 | super.initState(); 23 | _getSystemTree(); 24 | } 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return new SafeArea( 29 | child: new CustomScrollView( 30 | shrinkWrap: true, 31 | slivers: [ 32 | new SliverAppBar( 33 | pinned: false, 34 | expandedHeight: 180.0, 35 | iconTheme: new IconThemeData(color: Colors.transparent), 36 | flexibleSpace: new Image.asset( 37 | './images/ic_xiaoxin.jpg', 38 | fit: BoxFit.fill, 39 | )), 40 | new SliverList( 41 | delegate: new SliverChildBuilderDelegate( 42 | (BuildContext context, int index) { 43 | var _tempItems = _treeList[index]; 44 | return new Container( 45 | alignment: Alignment.centerLeft, 46 | child: new InkWell( 47 | onTap: () { 48 | Navigator.of(context) 49 | .push(new MaterialPageRoute(builder: (context) { 50 | return _initClassData(_tempItems); 51 | })); 52 | }, 53 | child: new Column( 54 | children: [ 55 | new Padding( 56 | padding: 57 | const EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 0.0), 58 | child: new Column( 59 | children: [ 60 | new Container( 61 | child: new Text( 62 | _tempItems['name'], 63 | style: _titleStyle, 64 | ), 65 | alignment: Alignment.centerLeft, 66 | margin: 67 | new EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0), 68 | ), 69 | new Container( 70 | margin: 71 | new EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), 72 | child: new Text( 73 | _childStr(_tempItems), 74 | style: _childStyle, 75 | textAlign: TextAlign.start, 76 | ), 77 | alignment: Alignment.topLeft, 78 | ) 79 | ], 80 | )), 81 | new Divider( 82 | height: 1.0, 83 | ) 84 | ], 85 | ), 86 | )); 87 | }, childCount: _treeList.length)) 88 | ], 89 | )); 90 | } 91 | 92 | String _childStr(var _tempItems) { 93 | var childList = _tempItems['children'] as List; 94 | StringBuffer _resultStr = new StringBuffer(); 95 | for (var i = 0; i < childList.length; i++) { 96 | String name = childList[i]['name']; 97 | if (name.isNotEmpty) { 98 | _resultStr.write(name); 99 | _resultStr.write(' '); 100 | } 101 | } 102 | return _resultStr.toString(); 103 | } 104 | 105 | _getSystemTree() { 106 | Http.get(Api.HOME_SYSTEM).then((res) { 107 | Map map = jsonDecode(res); 108 | var _tempTreeList = map['data']; 109 | if (_tempTreeList != null) { 110 | _treeList.addAll(_tempTreeList); 111 | } 112 | }); 113 | } 114 | 115 | initItem(int i) { 116 | var _tempItems = _treeList[i]; 117 | return new Container( 118 | alignment: Alignment.centerLeft, 119 | child: new InkWell( 120 | onTap: () {}, 121 | child: new Column( 122 | children: [ 123 | new Padding( 124 | padding: const EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 0.0), 125 | child: new Column( 126 | children: [ 127 | new Text(_tempItems['name']), 128 | new Text(_childStr(_tempItems)), 129 | ], 130 | )), 131 | new Divider( 132 | height: 1.0, 133 | ) 134 | ], 135 | ), 136 | )); 137 | } 138 | 139 | Widget _initClassData(var tempData) { 140 | var childList = tempData['children'] as List; 141 | List systemCBean = []; 142 | for (var tempItem in childList) { 143 | systemCBean.add(new SystemClassBean(tempItem['id'], tempItem['name'])); 144 | } 145 | return new SystemListPage(systemCBean,tempData['name']); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /lib/pages/TweetsListPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_refresh/flutter_refresh.dart'; 6 | import 'package:flutterdemo/pages/login/LoginPage.dart'; 7 | import 'package:flutterdemo/pages/tweet/TweetChildPage.dart'; 8 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 9 | import 'package:flutterdemo/utils/cache/SpUtils.dart'; 10 | import 'package:flutterdemo/utils/net/Api.dart'; 11 | import 'package:flutterdemo/utils/net/Http.dart'; 12 | 13 | class TweetsListPage extends StatefulWidget { 14 | @override 15 | _TweetsListPageState createState() => _TweetsListPageState(); 16 | } 17 | 18 | class _TweetsListPageState extends State { 19 | @override 20 | Widget build(BuildContext context) { 21 | return new DefaultTabController( 22 | length: 3, 23 | child: new Scaffold( 24 | appBar: new TabBar( 25 | tabs: [new Tab(text: "最新动弹"), new Tab(text: "热门动弹"),new Tab(text: "我的动弹")], 26 | ), 27 | body: new TabBarView( 28 | children: [new TweetChildPage(0), new TweetChildPage(-1),new TweetChildPage(1)]), 29 | )); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/pages/info/UserInfoPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 6 | import 'package:image_picker/image_picker.dart'; 7 | 8 | class UserInfoPage extends StatefulWidget { 9 | @override 10 | _UserInfoPageState createState() => _UserInfoPageState(); 11 | } 12 | 13 | class _UserInfoPageState extends State { 14 | File _image; 15 | WidgetsUtils widgetsUtils; 16 | 17 | var _userNameController = new TextEditingController(); 18 | var _userRealNameController = new TextEditingController(); 19 | var _userJobController = new TextEditingController(); 20 | var _userMobileController = new TextEditingController(); 21 | var _userIntroController = new TextEditingController(); 22 | 23 | var leftRes = new TextStyle(fontSize: 16.0, color: Colors.black); 24 | var hintRes = new TextStyle(fontSize: 15.0, color: Color(0xff969696)); 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | widgetsUtils = new WidgetsUtils(context); 29 | return new Scaffold( 30 | appBar: new AppBar( 31 | title: widgetsUtils.getAppBar('用户信息'), 32 | iconTheme: new IconThemeData(color: Colors.white), 33 | ), 34 | body: initInputBody(), 35 | ); 36 | } 37 | 38 | Widget initInputBody() { 39 | List items = []; 40 | items.addAll(initHeaderItem(null)); 41 | items.addAll(initInputItem('用户名', '请输入用户名', _userNameController)); 42 | items.addAll(initInputItem('手机', '请输入手机号码', _userMobileController)); 43 | items.addAll(initInputItem('真实姓名', '请输入真实姓名', _userRealNameController)); 44 | items.addAll(initInputItem('职业', '请输入职业', _userJobController)); 45 | items.addAll( 46 | initInputItem('简介', '介绍下自己吧', _userIntroController, maxLines: 6)); 47 | items.add(initSubmitBtn()); 48 | return new Column( 49 | mainAxisAlignment: MainAxisAlignment.start, 50 | children: items, 51 | ); 52 | } 53 | 54 | // 显示弹窗 55 | showPickDialog() { 56 | showModalBottomSheet(context: context, builder: _bottomPick); 57 | } 58 | 59 | // 构建弹窗 60 | Widget _bottomPick(BuildContext context) { 61 | return initImgPick(); 62 | } 63 | 64 | Future getImgPick(ImageSource source) async { 65 | var tempImg = await ImagePicker.pickImage(source: source); 66 | setState(() { 67 | _image = tempImg; 68 | }); 69 | } 70 | 71 | List initHeaderItem(var userAvatar) { 72 | List item = []; 73 | item.add(new InkWell( 74 | onTap: (() { 75 | showPickDialog(); 76 | }), 77 | child: new Padding( 78 | padding: new EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), 79 | child: new Row( 80 | children: [ 81 | new Expanded( 82 | child: new Container( 83 | child: new Text( 84 | '头像', 85 | style: leftRes, 86 | ), 87 | alignment: Alignment.centerLeft, 88 | height: 80.0, 89 | ), 90 | ), 91 | initHeaderView(userAvatar) 92 | ], 93 | ), 94 | ), 95 | )); 96 | item.add(new Divider( 97 | height: 1.0, 98 | )); 99 | return item; 100 | } 101 | 102 | Widget initHeaderView(var userAvatar) { 103 | if (_image == null) { 104 | if (userAvatar == null) { 105 | return new Image.asset( 106 | "images/ic_avatar_default.png", 107 | width: 60.0, 108 | height: 60.0, 109 | ); 110 | } else { 111 | return new Container( 112 | width: 60.0, 113 | height: 60.0, 114 | decoration: new BoxDecoration( 115 | shape: BoxShape.circle, 116 | color: Colors.transparent, 117 | image: new DecorationImage( 118 | image: new NetworkImage(userAvatar), fit: BoxFit.cover), 119 | border: new Border.all(color: Colors.white, width: 2.0)), 120 | ); 121 | } 122 | } else { 123 | return new Container( 124 | width: 60.0, 125 | height: 60.0, 126 | decoration: new BoxDecoration( 127 | shape: BoxShape.circle, 128 | image: new DecorationImage( 129 | image: new FileImage(_image), fit: BoxFit.cover), 130 | border: new Border.all(color: Colors.white, width: 2.0)), 131 | ); 132 | } 133 | } 134 | 135 | // 初始化输入的item 136 | List initInputItem(var leftMsg, var hintMsg, var controller, 137 | {var maxLines = 1}) { 138 | List item = []; 139 | item.add( 140 | new Padding( 141 | padding: new EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), 142 | child: new Row( 143 | children: [ 144 | new Expanded( 145 | child: new Container( 146 | child: new Text( 147 | leftMsg, 148 | style: leftRes, 149 | ), 150 | alignment: Alignment.centerLeft, 151 | height: 50.0, 152 | ), 153 | ), 154 | new Expanded( 155 | flex: 2, 156 | child: new Padding( 157 | padding: new EdgeInsets.fromLTRB(0.0, 6.0, 0.0, 6.0), 158 | child: new TextField( 159 | style: hintRes, 160 | maxLines: maxLines, 161 | textAlign: maxLines == 1 ? TextAlign.end : TextAlign.end, 162 | controller: controller, 163 | decoration: InputDecoration.collapsed(hintText: hintMsg), 164 | obscureText: false, 165 | ), 166 | )) 167 | ], 168 | ), 169 | ), 170 | ); 171 | item.add(new Divider( 172 | height: 1.0, 173 | )); 174 | return item; 175 | } 176 | 177 | Widget initSubmitBtn() { 178 | return new Container( 179 | width: 360.0, 180 | margin: new EdgeInsets.fromLTRB(20.0, 40.0, 20.0, 0.0), 181 | child: new Card( 182 | color: Colors.green, 183 | elevation: 2.0, 184 | child: new MaterialButton( 185 | onPressed: () { 186 | 187 | }, 188 | child: new Text( 189 | '确认修改', 190 | style: new TextStyle(color: Colors.white, fontSize: 14.0), 191 | ), 192 | ), 193 | ), 194 | ); 195 | } 196 | 197 | Widget initImgPick() { 198 | return new Container( 199 | height: 170.0, 200 | child: new Column( 201 | children: [ 202 | new InkWell( 203 | child: new Container( 204 | child: new Text( 205 | '拍照', 206 | style: new TextStyle(color: Colors.black, fontSize: 15.0), 207 | ), 208 | height: 60.0, 209 | alignment: Alignment.center, 210 | ), 211 | onTap: (() { 212 | Navigator.of(context).pop(); 213 | getImgPick(ImageSource.camera); 214 | }), 215 | ), 216 | new Divider( 217 | height: 1.0, 218 | ), 219 | new InkWell( 220 | onTap: (() { 221 | Navigator.of(context).pop(); 222 | getImgPick(ImageSource.gallery); 223 | }), 224 | child: new Container( 225 | child: new Text( 226 | '从手机相册选择', 227 | style: new TextStyle(color: Colors.black, fontSize: 15.0), 228 | ), 229 | height: 60.0, 230 | alignment: Alignment.center, 231 | ), 232 | ), 233 | new Container( 234 | height: 5.0, 235 | color: new Color(0xfff2f2f2), 236 | ), 237 | new Container( 238 | child: new Text( 239 | '取消', 240 | style: new TextStyle(color: Colors.black, fontSize: 15.0), 241 | ), 242 | height: 40.0, 243 | alignment: Alignment.center, 244 | ) 245 | ], 246 | )); 247 | } 248 | } 249 | -------------------------------------------------------------------------------- /lib/pages/login/LoginPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutterdemo/app/OsApplication.dart'; 4 | import 'package:flutterdemo/domain/event/LoginEvent.dart'; 5 | import 'package:flutterdemo/pages/login/RegisterPage.dart'; 6 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 7 | import 'package:flutterdemo/utils/cache/SpUtils.dart'; 8 | import 'package:flutterdemo/utils/net/Api.dart'; 9 | import 'package:flutterdemo/utils/net/Http.dart'; 10 | import 'package:flutterdemo/utils/toast/TsUtils.dart'; 11 | 12 | class LoginPage extends StatefulWidget { 13 | @override 14 | State createState() { 15 | return new _LoginPageState(); 16 | } 17 | } 18 | 19 | class _LoginPageState extends State { 20 | var leftRightPadding = 40.0; 21 | var topBottomPadding = 4.0; 22 | var textTips = new TextStyle(fontSize: 16.0, color: Colors.black); 23 | var hintTips = new TextStyle(fontSize: 15.0, color: Colors.black26); 24 | static const LOGO = "images/android.jpg"; 25 | 26 | var _userPassController = new TextEditingController(); 27 | var _userNameController = new TextEditingController(); 28 | 29 | WidgetsUtils widgetsUtils; 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | widgetsUtils = new WidgetsUtils(context); 34 | return new Scaffold( 35 | appBar: new AppBar( 36 | title: widgetsUtils.getAppBar('登录'), 37 | iconTheme: new IconThemeData(color: Colors.white), 38 | ), 39 | body: new Column( 40 | mainAxisSize: MainAxisSize.max, 41 | mainAxisAlignment: MainAxisAlignment.start, 42 | children: [ 43 | new Container( 44 | child: new Image.asset( 45 | LOGO, 46 | fit: BoxFit.fitWidth, 47 | ), 48 | width: widgetsUtils.screenWidth, 49 | ), 50 | new Padding( 51 | padding: new EdgeInsets.fromLTRB( 52 | leftRightPadding, 40.0, leftRightPadding, topBottomPadding), 53 | child: new TextField( 54 | style: hintTips, 55 | controller: _userNameController, 56 | decoration: new InputDecoration(hintText: "请输入用户名"), 57 | obscureText: false, 58 | ), 59 | ), 60 | new Padding( 61 | padding: new EdgeInsets.fromLTRB( 62 | leftRightPadding, 30.0, leftRightPadding, topBottomPadding), 63 | child: new TextField( 64 | style: hintTips, 65 | controller: _userPassController, 66 | decoration: new InputDecoration(hintText: "请输入用户密码"), 67 | obscureText: true, 68 | ), 69 | ), 70 | new InkWell( 71 | child: new Container( 72 | alignment: Alignment.centerRight, 73 | child: new Text( 74 | '没有账号?马上注册', 75 | style: hintTips, 76 | ), 77 | padding: new EdgeInsets.fromLTRB( 78 | leftRightPadding, 10.0, leftRightPadding, 0.0)), 79 | onTap: (() { 80 | Navigator.of(context).push(new MaterialPageRoute( 81 | builder: (context) => new RegisterPage())); 82 | }), 83 | ), 84 | new Container( 85 | width: 360.0, 86 | margin: new EdgeInsets.fromLTRB(10.0, 40.0, 10.0, 0.0), 87 | padding: new EdgeInsets.fromLTRB(leftRightPadding, 88 | topBottomPadding, leftRightPadding, topBottomPadding), 89 | child: new Card( 90 | color: Color(0xFF63CA6C), 91 | elevation: 6.0, 92 | child: new FlatButton( 93 | onPressed: () { 94 | _postLogin( 95 | _userNameController.text, _userPassController.text); 96 | }, 97 | child: new Padding( 98 | padding: new EdgeInsets.all(10.0), 99 | child: new Text( 100 | '马上登录', 101 | style: 102 | new TextStyle(color: Colors.white, fontSize: 16.0), 103 | ), 104 | )), 105 | ), 106 | ) 107 | ], 108 | )); 109 | } 110 | 111 | _postLogin(String userName, String userPassword) { 112 | if (userName.isNotEmpty && userPassword.isNotEmpty) { 113 | Map params = new Map(); 114 | params['username'] = userName; 115 | params['password'] = userPassword; 116 | Http.post(Api.USER_LOGIN, params: params, saveCookie: true) 117 | .then((result) { 118 | SpUtils.map2UserInfo(result).then((userInfoBean) { 119 | if (userInfoBean != null) { 120 | OsApplication.eventBus.fire(new LoginEvent(userInfoBean.username)); 121 | SpUtils.saveUserInfo(userInfoBean); 122 | Navigator.pop(context); 123 | } 124 | }); 125 | }); 126 | } else { 127 | TsUtils.showShort('请输入用户名和密码'); 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /lib/pages/login/RegisterPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterdemo/app/OsApplication.dart'; 3 | import 'package:flutterdemo/domain/event/LoginEvent.dart'; 4 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 5 | import 'package:flutterdemo/utils/cache/SpUtils.dart'; 6 | import 'package:flutterdemo/utils/net/Api.dart'; 7 | import 'package:flutterdemo/utils/net/Http.dart'; 8 | import 'package:flutterdemo/utils/toast/TsUtils.dart'; 9 | 10 | class RegisterPage extends StatefulWidget { 11 | @override 12 | _RegisterPageState createState() => _RegisterPageState(); 13 | } 14 | 15 | class _RegisterPageState extends State { 16 | WidgetsUtils widgetsUtils; 17 | var _userPassController = new TextEditingController(); 18 | var _userNameController = new TextEditingController(); 19 | var _passWordConfirmController = new TextEditingController(); 20 | 21 | var leftRightPadding = 40.0; 22 | var topBottomPadding = 4.0; 23 | var textTips = new TextStyle(fontSize: 16.0, color: Colors.black); 24 | var hintTips = new TextStyle(fontSize: 15.0, color: Colors.black26); 25 | static const LOGO = "images/android.jpg"; 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | widgetsUtils = new WidgetsUtils(context); 30 | return new Scaffold( 31 | appBar: new AppBar( 32 | title: widgetsUtils.getAppBar('登录'), 33 | iconTheme: new IconThemeData(color: Colors.white), 34 | ), 35 | body: new Column( 36 | mainAxisSize: MainAxisSize.max, 37 | mainAxisAlignment: MainAxisAlignment.start, 38 | children: [ 39 | new Container( 40 | child: new Image.asset( 41 | LOGO, 42 | fit: BoxFit.fitWidth, 43 | ), 44 | width: widgetsUtils.screenWidth, 45 | ), 46 | new Padding( 47 | padding: new EdgeInsets.fromLTRB( 48 | leftRightPadding, 40.0, leftRightPadding, topBottomPadding), 49 | child: new TextField( 50 | style: hintTips, 51 | controller: _userNameController, 52 | decoration: new InputDecoration(hintText: "请输入用户名"), 53 | obscureText: false, 54 | ), 55 | ), 56 | new Padding( 57 | padding: new EdgeInsets.fromLTRB( 58 | leftRightPadding, 30.0, leftRightPadding, topBottomPadding), 59 | child: new TextField( 60 | style: hintTips, 61 | controller: _userPassController, 62 | decoration: new InputDecoration(hintText: "请输入用户密码"), 63 | obscureText: true, 64 | ), 65 | ), 66 | new Padding( 67 | padding: new EdgeInsets.fromLTRB( 68 | leftRightPadding, 30.0, leftRightPadding, topBottomPadding), 69 | child: new TextField( 70 | style: hintTips, 71 | controller: _passWordConfirmController, 72 | decoration: new InputDecoration(hintText: "请再次输入用户密码"), 73 | obscureText: true, 74 | ), 75 | ), 76 | new Container( 77 | width: 360.0, 78 | margin: new EdgeInsets.fromLTRB(10.0, 40.0, 10.0, 0.0), 79 | padding: new EdgeInsets.fromLTRB(leftRightPadding, 80 | topBottomPadding, leftRightPadding, topBottomPadding), 81 | child: new Card( 82 | color: Color(0xFF63CA6C), 83 | elevation: 6.0, 84 | child: new FlatButton( 85 | onPressed: () { 86 | _postRegister( 87 | _userNameController.text, 88 | _userPassController.text, 89 | _passWordConfirmController.text); 90 | }, 91 | child: new Padding( 92 | padding: new EdgeInsets.all(10.0), 93 | child: new Text( 94 | '马上登录', 95 | style: 96 | new TextStyle(color: Colors.white, fontSize: 16.0), 97 | ), 98 | )), 99 | ), 100 | ) 101 | ], 102 | )); 103 | } 104 | 105 | void _postRegister( 106 | String userName, String password, String passWordConfirm) { 107 | if (userName.isNotEmpty && password.isNotEmpty && passWordConfirm.isNotEmpty) { 108 | if(password==passWordConfirm){ 109 | Map params = new Map(); 110 | params['username'] = userName; 111 | params['password'] = password; 112 | params['repassword'] = passWordConfirm; 113 | Http.post(Api.USER_REGISTER, params: params, saveCookie: true) 114 | .then((result) { 115 | SpUtils.map2UserInfo(result).then((userInfoBean) { 116 | if (userInfoBean != null) { 117 | OsApplication.eventBus.fire(new LoginEvent(userInfoBean.username)); 118 | SpUtils.saveUserInfo(userInfoBean); 119 | Navigator.pop(context); 120 | } 121 | }); 122 | }); 123 | }else{ 124 | TsUtils.showShort('两次密码不一致哟~'); 125 | } 126 | } else { 127 | TsUtils.showShort('请输入用户名和密码'); 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /lib/pages/login/WebLoginPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; 7 | import 'package:flutterdemo/domain/UserInfoBean.dart'; 8 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 9 | import 'package:flutterdemo/utils/cache/SpUtils.dart'; 10 | import 'package:flutterdemo/utils/net/Api.dart'; 11 | 12 | class WebLoginPage extends StatefulWidget { 13 | @override 14 | _WebLoginPageState createState() => _WebLoginPageState(); 15 | } 16 | 17 | class _WebLoginPageState extends State { 18 | WidgetsUtils widgetsUtils; 19 | 20 | GlobalKey _scaffoldKey = new GlobalKey(); 21 | 22 | // URL变化监听器 23 | StreamSubscription _onUrlChanged; 24 | 25 | // 插件提供的对象,该对象用于WebView的各种操作 26 | FlutterWebviewPlugin flutterWebViewPlugin = new FlutterWebviewPlugin(); 27 | 28 | bool _isShowLoading = true; 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | widgetsUtils = new WidgetsUtils(context); 33 | return new Container(child: homeBody()); 34 | } 35 | 36 | Widget homeBody() { 37 | return new WebviewScaffold( 38 | appBar: new AppBar( 39 | title: new Column( 40 | mainAxisAlignment: MainAxisAlignment.center, 41 | children: appBarWidget(), 42 | ), 43 | iconTheme: new IconThemeData(color: Colors.white), 44 | ), 45 | url: Api.LOGIN_URL, 46 | key: _scaffoldKey, 47 | ); 48 | } 49 | 50 | List appBarWidget() { 51 | List widgets = []; 52 | widgets.add(widgetsUtils.getAppBar('登录')); 53 | if (_isShowLoading) { 54 | widgets.add(new CupertinoActivityIndicator()); 55 | } 56 | return widgets; 57 | } 58 | 59 | @override 60 | void initState() { 61 | super.initState(); 62 | _onUrlChanged = flutterWebViewPlugin.onUrlChanged.listen((url) { 63 | setState(() { 64 | _isShowLoading = false; 65 | }); 66 | if (url != null && url.length > 0 && url.contains('osc/osc.php?code=')) { 67 | new Timer(const Duration(seconds: 1), parseResult()); 68 | } 69 | }); 70 | } 71 | 72 | parseResult() { 73 | flutterWebViewPlugin.evalJavascript('get();').then((result) { 74 | if (result != null && result.length > 0) { 75 | var map = json.decode(result); 76 | if (map is String) { 77 | map = json.decode(map); 78 | } 79 | if (map != null) { 80 | SpUtils.saveTokenInfo(map); 81 | // 使用Navigator的pop返回可返回上一级,并携带一个参数 @link https://www.jianshu.com/p/cb0af52376ba 82 | Navigator.pop(context, 'refresh'); 83 | } 84 | } else { 85 | new Timer(const Duration(seconds: 1), parseResult()); 86 | } 87 | }); 88 | } 89 | 90 | @override 91 | void dispose() { 92 | _onUrlChanged.cancel(); 93 | flutterWebViewPlugin.dispose(); 94 | super.dispose(); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/pages/menu/SetPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterdemo/app/OsApplication.dart'; 3 | import 'package:flutterdemo/domain/event/LoginEvent.dart'; 4 | import 'package:flutterdemo/pages/news/NewsDetailPage.dart'; 5 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 6 | import 'package:flutterdemo/utils/cache/SpUtils.dart'; 7 | 8 | class SetPage extends StatefulWidget { 9 | @override 10 | _SetPageState createState() => _SetPageState(); 11 | } 12 | 13 | class _SetPageState extends State { 14 | List _menuList = []; 15 | WidgetsUtils widgetsUtils; 16 | TextStyle leftMenuStyle = new TextStyle(fontSize: 16.0, color: Colors.black); 17 | 18 | @override 19 | void initState() { 20 | super.initState(); 21 | _menuList.add('清除缓存'); 22 | _menuList.add('关于我们'); 23 | _menuList.add('退出登录'); 24 | } 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | widgetsUtils = new WidgetsUtils(context); 29 | return Scaffold( 30 | appBar: new AppBar( 31 | title: widgetsUtils.getAppBar('设置'), 32 | iconTheme: new IconThemeData(color: Colors.white), 33 | ), 34 | body: new ListView.builder( 35 | itemBuilder: (context, index) => initItem(index), 36 | itemCount: _menuList.length, 37 | ), 38 | ); 39 | } 40 | 41 | initItem(int index) { 42 | return new InkWell( 43 | onTap: () { 44 | switch (index) { 45 | case 0: 46 | break; 47 | case 1: 48 | Navigator.push(context, new MaterialPageRoute(builder: (context){ 49 | return NewsDetailPage('https://github.com/LinHuanTanLy','凌宇Ly'); 50 | })); 51 | break; 52 | case 2: 53 | _showDialog(); 54 | break; 55 | } 56 | }, 57 | child: new Column( 58 | children: [ 59 | new Container( 60 | child: new Row( 61 | mainAxisAlignment: MainAxisAlignment.start, 62 | mainAxisSize: MainAxisSize.max, 63 | children: [ 64 | new Text( 65 | _menuList[index], 66 | style: leftMenuStyle, 67 | ) 68 | ], 69 | ), 70 | margin: new EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 16.0), 71 | ), 72 | new Divider( 73 | height: 1.0, 74 | ) 75 | ], 76 | ), 77 | ); 78 | } 79 | 80 | 81 | 82 | 83 | _showDialog() { 84 | showDialog( 85 | builder: (context) => new AlertDialog( 86 | title: new Text('提示'), 87 | content: new Text('是否要退出登录'), 88 | actions: [ 89 | new FlatButton( 90 | onPressed: () { 91 | Navigator.pop(context); 92 | }, 93 | child: new Text('取消')), 94 | new FlatButton( 95 | onPressed: () { 96 | SpUtils.cleanUserInfo(); 97 | OsApplication.eventBus.fire(new LoginEvent(null)); 98 | Navigator.pop(context); 99 | }, 100 | child: new Text('是的')) 101 | ], 102 | ), 103 | context: context); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /lib/pages/news/NewsDetailPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 6 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; 7 | 8 | class NewsDetailPage extends StatefulWidget { 9 | String _url,_title; 10 | 11 | 12 | NewsDetailPage(this._url,this._title); 13 | 14 | @override 15 | _NewsDetailPageState createState() => _NewsDetailPageState(_url,_title); 16 | } 17 | 18 | class _NewsDetailPageState extends State { 19 | WidgetsUtils widgetsUtils; 20 | 21 | bool _isLoading = true; 22 | String _url ,_title; 23 | 24 | // 插件提供的对象,该对象用于WebView的各种操作 25 | FlutterWebviewPlugin flutterWebViewPlugin = new FlutterWebviewPlugin(); 26 | // URL变化监听器 27 | StreamSubscription _onUrlChanged; 28 | 29 | 30 | _NewsDetailPageState(this._url,this._title); 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | _onUrlChanged=flutterWebViewPlugin.onUrlChanged.listen((url){ 36 | setState(() { 37 | _isLoading=false; 38 | }); 39 | }); 40 | } 41 | 42 | @override 43 | void dispose() { 44 | _onUrlChanged.cancel(); 45 | flutterWebViewPlugin.dispose(); 46 | super.dispose(); 47 | } 48 | @override 49 | Widget build(BuildContext context) { 50 | widgetsUtils = new WidgetsUtils(context); 51 | return new WebviewScaffold( 52 | appBar: new AppBar( 53 | title: new Column( mainAxisAlignment: MainAxisAlignment.center,children: _getAppBar(),), 54 | iconTheme: new IconThemeData(color: Colors.white), 55 | actions: [ 56 | new IconButton( // action button 57 | icon: new Icon( Icons.more_vert), 58 | onPressed: () { }, 59 | ), 60 | ], 61 | ), 62 | url: _url,); 63 | } 64 | 65 | // 获取appbar 66 | List _getAppBar() { 67 | List appbarChildList = []; 68 | appbarChildList.add(widgetsUtils.getAppBar(_title)); 69 | if (_isLoading) { 70 | appbarChildList.add(new CupertinoActivityIndicator()); 71 | } 72 | return appbarChildList; 73 | } 74 | 75 | Widget _getItem(){ 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/pages/system/SystemChildPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_refresh/flutter_refresh.dart'; 6 | import 'package:flutterdemo/pages/news/NewsDetailPage.dart'; 7 | import 'package:flutterdemo/utils/net/Api.dart'; 8 | import 'package:flutterdemo/utils/net/Http.dart'; 9 | import 'package:flutterdemo/utils/toast/TsUtils.dart'; 10 | 11 | class SystemChildPage extends StatefulWidget { 12 | var _cId; 13 | 14 | SystemChildPage( this._cId); 15 | 16 | @override 17 | _SystemChildPageState createState() => _SystemChildPageState( _cId); 18 | } 19 | 20 | class _SystemChildPageState extends State 21 | with AutomaticKeepAliveClientMixin { 22 | List _listData = []; 23 | var _mCurPage = 0; 24 | var _cId; 25 | 26 | _SystemChildPageState(this._cId); // 列表中资讯标题的样式 27 | TextStyle titleTextStyle = new TextStyle(fontSize: 15.0); 28 | 29 | // 作者style 30 | TextStyle authorStyle = 31 | new TextStyle(color: const Color(0xFF000000), fontSize: 12.0); 32 | 33 | @override 34 | void initState() { 35 | _getSystemList(); 36 | super.initState(); 37 | } 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return new Refresh( 42 | onFooterRefresh: onFooterRefresh, 43 | onHeaderRefresh: onHeaderRefresh, 44 | childBuilder: (BuildContext context, 45 | {ScrollController controller, ScrollPhysics physics}) { 46 | return new Container( 47 | child: new ListView.builder( 48 | itemBuilder: (context, i) => _initItem(i), 49 | controller: controller, 50 | physics: physics, 51 | itemCount: _listData.length, 52 | ), 53 | ); 54 | }, 55 | ); 56 | } 57 | Future onFooterRefresh() { 58 | return new Future.delayed(new Duration(seconds: 2), () { 59 | setState(() { 60 | _mCurPage++; 61 | _getSystemList(); 62 | }); 63 | }); 64 | } 65 | 66 | Future onHeaderRefresh() { 67 | return new Future.delayed(new Duration(seconds: 2), () { 68 | setState(() { 69 | _mCurPage = 0; 70 | _getSystemList(); 71 | 72 | }); 73 | }); 74 | } 75 | 76 | Widget _initItem(int i) { 77 | var _data = _listData[i]; 78 | return new InkWell( 79 | onTap: () { 80 | Navigator.of(context).push(new MaterialPageRoute(builder: (context) { 81 | return NewsDetailPage(_data['link'], _data['title']); 82 | })); 83 | }, 84 | child: new Card( 85 | elevation: 1.0, 86 | child: new Container( 87 | alignment: Alignment.centerLeft, 88 | padding: new EdgeInsets.all(4.0), 89 | margin: new EdgeInsets.fromLTRB(6.0, 6.0, 6.0, 6.0), 90 | child: new Column( 91 | mainAxisAlignment: MainAxisAlignment.start, 92 | children: [ 93 | new Container( 94 | child: new Text( 95 | '作者:${_data['author']}', 96 | style: authorStyle, 97 | textAlign: TextAlign.left, 98 | ), 99 | alignment: Alignment.centerLeft, 100 | ), 101 | new Container( 102 | alignment: Alignment.centerLeft, 103 | margin: new EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 6.0), 104 | child: new Text( 105 | '${_data['title']}', 106 | textAlign: TextAlign.start, 107 | style: titleTextStyle, 108 | ), 109 | ) 110 | ], 111 | ), 112 | ), 113 | ), 114 | ); 115 | } 116 | 117 | _getSystemList() { 118 | String _url = Api.HOME_SYSTEM_CHILD + 119 | _mCurPage.toString() + 120 | "/json?cid=" + 121 | _cId.toString(); 122 | Http.get(_url).then((res) { 123 | Map map = jsonDecode(res); 124 | var _tempList = map['data']['datas'] as List; 125 | if(_tempList.isEmpty){ 126 | TsUtils.showShort('没有更多数据咯~~~///(^v^)\\\~~~'); 127 | } 128 | setState(() { 129 | if (_mCurPage == 0) { 130 | _listData.clear(); 131 | _listData.addAll(_tempList); 132 | } else { 133 | _listData.addAll(_tempList); 134 | } 135 | }); 136 | }); 137 | } 138 | 139 | @override 140 | bool get wantKeepAlive => true; 141 | } 142 | -------------------------------------------------------------------------------- /lib/pages/system/SystemListPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutterdemo/domain/SystemClassBean.dart'; 4 | import 'package:flutterdemo/pages/system/SystemChildPage.dart'; 5 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 6 | 7 | class SystemListPage extends StatefulWidget { 8 | List _classList = []; 9 | 10 | var _title = ''; 11 | SystemListPage(this._classList,this._title); 12 | 13 | @override 14 | _SystemListPageState createState() => _SystemListPageState(_classList,_title); 15 | } 16 | 17 | class _SystemListPageState extends State { 18 | WidgetsUtils widgetsUtils; 19 | List classList = []; 20 | var _title = ''; 21 | 22 | _SystemListPageState(this.classList,this._title){ 23 | debugPrint('classList------------------------'+classList.toString()); 24 | } 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | widgetsUtils = new WidgetsUtils(context); 29 | return new Scaffold( 30 | appBar: new AppBar( 31 | title: widgetsUtils.getAppBar(_title), 32 | iconTheme: new IconThemeData(color: Colors.white), 33 | ), 34 | body: new DefaultTabController( 35 | child: new Scaffold( 36 | appBar: new TabBar( 37 | isScrollable: true, 38 | tabs: _initTabs(), 39 | ), 40 | body: new TabBarView(children: _initBody())), 41 | length: classList.length, 42 | ), 43 | ); 44 | } 45 | 46 | List _initTabs() { 47 | List _tempTabList = []; 48 | for (var i = 0; i < classList.length; i++) { 49 | _tempTabList.add(new Tab(text: classList[i].cName)); 50 | } 51 | return _tempTabList; 52 | } 53 | 54 | List _initBody() { 55 | List _tempBodyList = []; 56 | for (var i = 0; i < classList.length; i++) { 57 | _tempBodyList.add(new SystemChildPage(classList[i].cId)); 58 | } 59 | return _tempBodyList; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/pages/tweet/TweetChildPage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:flutter/cupertino.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_refresh/flutter_refresh.dart'; 7 | import 'package:flutterdemo/pages/tweet/TweetDetailPage.dart'; 8 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 9 | import 'package:flutterdemo/utils/cache/SpUtils.dart'; 10 | import 'package:flutterdemo/utils/net/Api.dart'; 11 | import 'package:flutterdemo/utils/net/Http.dart'; 12 | 13 | class TweetChildPage extends StatefulWidget { 14 | var user=0; 15 | 16 | 17 | TweetChildPage(this.user); 18 | 19 | @override 20 | _TweetChildPageState createState() => _TweetChildPageState(user); 21 | } 22 | 23 | class _TweetChildPageState extends State with AutomaticKeepAliveClientMixin { 24 | 25 | 26 | _TweetChildPageState(this._user); 27 | 28 | var _user; 29 | var normalList = []; 30 | var hotList = []; 31 | WidgetsUtils mWidgetsUtils; 32 | 33 | // 动弹作者文本样式 34 | TextStyle authorTextStyle; 35 | 36 | // 动弹时间文本样式 37 | TextStyle subtitleStyle; 38 | 39 | // 动弹评论数列表 40 | TextStyle commentsStyle; 41 | 42 | // 动弹body样式 43 | TextStyle bodyStyle; 44 | 45 | 46 | double paddingLeft = 42.0; 47 | 48 | int _mCurPage = 1; 49 | 50 | var _tweetsList = []; 51 | 52 | @override 53 | void initState() { 54 | super.initState(); 55 | authorTextStyle = new TextStyle( 56 | fontSize: 15.0, fontWeight: FontWeight.normal, color: Colors.black); 57 | subtitleStyle = 58 | new TextStyle(fontSize: 12.0, color: const Color(0xFFB5BDC0)); 59 | commentsStyle = 60 | new TextStyle(fontSize: 12.0, color: const Color(0XFF1a1a1a)); 61 | bodyStyle = new TextStyle( 62 | fontSize: 14.0, 63 | color: const Color(0XFF1a1a1a), 64 | letterSpacing: 1.2, 65 | ); 66 | getTweetList(); 67 | } 68 | 69 | @override 70 | Widget build(BuildContext context) { 71 | mWidgetsUtils = new WidgetsUtils(context); 72 | return getNormalList(); 73 | } 74 | 75 | //获取普通列表 76 | Widget getNormalList() { 77 | return new Refresh( 78 | onFooterRefresh: onFooterRefresh, 79 | onHeaderRefresh: onHeaderRefresh, 80 | childBuilder: (BuildContext context, 81 | {ScrollController controller, ScrollPhysics physics}) { 82 | return new ListView.builder( 83 | itemCount: _tweetsList.length * 2 - 1, 84 | controller: controller, 85 | physics: physics, 86 | itemBuilder: (context, i) => renderNormalRow(i)); 87 | }, 88 | ); 89 | } 90 | 91 | Future onFooterRefresh() { 92 | return new Future.delayed(new Duration(seconds: 2), () { 93 | setState(() { 94 | _mCurPage++; 95 | getTweetList(); 96 | }); 97 | }); 98 | } 99 | 100 | Future onHeaderRefresh() { 101 | return new Future.delayed(new Duration(seconds: 2), () { 102 | setState(() { 103 | _mCurPage = 1; 104 | getTweetList(); 105 | }); 106 | }); 107 | } 108 | 109 | getTweetList() { 110 | String url = Api.TWEET_LIST; 111 | // SpUtils.getToken().then((str) { 112 | // if(str!=null) { 113 | // Map params = Map(); 114 | // params['access_token'] = str; 115 | // params['page/pageIndex'] = _mCurPage.toString(); 116 | // params['user'] = _user.toString(); 117 | // Http.get(url, params: params).then((result) { 118 | // Map map = json.decode(result); 119 | // var _tempTweetList = map['tweetlist']; 120 | // setState(() { 121 | // if (_mCurPage == 1) { 122 | // _tweetsList.clear(); 123 | // _tweetsList.addAll(_tempTweetList); 124 | // } else { 125 | // _tweetsList.addAll(_tempTweetList); 126 | // } 127 | // debugPrint('_tweetsList length is ${_tweetsList.length}'); 128 | // }); 129 | // }); 130 | // }else{ 131 | // 132 | // } 133 | // }); 134 | } 135 | 136 | toTweetDetail(var id){ 137 | Navigator.of(context).push(new MaterialPageRoute(builder: (context) { 138 | return new TweetDetailPage(id); 139 | })); 140 | } 141 | renderNormalRow(i) { 142 | if (i.isOdd) { 143 | return new Divider(height: 1.0); 144 | } else { 145 | i = i ~/ 2; 146 | return new InkWell( 147 | child: getNormalItem(_tweetsList[i]), 148 | onTap: () { 149 | toTweetDetail(_tweetsList[i]['id']); 150 | print("this is the click Event ${_tweetsList[i].toString()}"); 151 | }, 152 | ); 153 | } 154 | } 155 | 156 | Widget getNormalItem(Map listItem) { 157 | return new Padding( 158 | padding: new EdgeInsets.all(10.0), 159 | child: new Column( 160 | children: [ 161 | authorInfo(listItem), 162 | new Padding( 163 | padding: new EdgeInsets.fromLTRB(paddingLeft, 10.0, 6.0, 6.0), 164 | child: new Container( 165 | child: new Text( 166 | '${listItem['body']}', 167 | textAlign: TextAlign.start, 168 | style: bodyStyle, 169 | ),alignment: Alignment.centerLeft,), 170 | ), 171 | new Padding( 172 | padding: new EdgeInsets.fromLTRB(paddingLeft, 2.0, 6.0, 6.0), 173 | child: new Column( 174 | children: mWidgetsUtils.initImgGridView(listItem['imgSmall']), 175 | )), 176 | new Row( 177 | mainAxisAlignment: MainAxisAlignment.end, 178 | children: [ 179 | new Text( 180 | '${listItem['pubDate']}', 181 | style: subtitleStyle, 182 | ) 183 | ], 184 | ) 185 | ], 186 | )); 187 | } 188 | 189 | // 作者信息 190 | Widget authorInfo(Map listItem) { 191 | return new Row( 192 | children: [ 193 | new Container( 194 | width: 35.0, 195 | height: 35.0, 196 | decoration: new BoxDecoration( 197 | shape: BoxShape.circle, 198 | color: Colors.transparent, 199 | image: new DecorationImage( 200 | image: new NetworkImage(listItem['portrait']), 201 | fit: BoxFit.cover), 202 | ), 203 | ), 204 | new Padding( 205 | padding: new EdgeInsets.fromLTRB(8.0, 0.0, 4.0, 0.0), 206 | child: new Text( 207 | '${listItem['author']}', 208 | style: authorTextStyle, 209 | ), 210 | ), 211 | new Expanded( 212 | child: new Row( 213 | mainAxisAlignment: MainAxisAlignment.end, 214 | children: [ 215 | new Text( 216 | '${listItem['commentCount']}', 217 | style: commentsStyle, 218 | ), 219 | new Padding( 220 | padding: new EdgeInsets.all(3.0), 221 | child: new Image.asset( 222 | 'images/ic_comment.png', 223 | width: 16.0, 224 | height: 16.0, 225 | ), 226 | ) 227 | ], 228 | )) 229 | ], 230 | ); 231 | } 232 | 233 | @override 234 | bool get wantKeepAlive => true; 235 | } 236 | -------------------------------------------------------------------------------- /lib/pages/tweet/TweetDetailPage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterdemo/utils/WidgetsUtils.dart'; 3 | 4 | class TweetDetailPage extends StatefulWidget { 5 | var _id; 6 | 7 | TweetDetailPage(this._id) { 8 | debugPrint('the id is $_id'); 9 | } 10 | 11 | @override 12 | _TweetDetailPageState createState() => _TweetDetailPageState(_id); 13 | } 14 | 15 | class _TweetDetailPageState extends State { 16 | WidgetsUtils widgetsUtils; 17 | var _id; 18 | 19 | _TweetDetailPageState(this._id); 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | widgetsUtils = new WidgetsUtils(context); 24 | return new Scaffold( 25 | appBar: new AppBar( 26 | title: widgetsUtils.getAppBar('动弹详情'), 27 | iconTheme: new IconThemeData(color: Colors.white), 28 | ), 29 | body: new Center( 30 | child: new Text('the id is$_id'), 31 | ), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/utils/WidgetsUtils.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterdemo/pages/news/NewsDetailPage.dart'; 3 | 4 | class WidgetsUtils { 5 | // 屏幕宽度 6 | double screenWidth; 7 | 8 | WidgetsUtils(BuildContext context) { 9 | screenWidth = MediaQuery.of(context).size.width; 10 | } 11 | 12 | //根据图片list返回一个9宫格的东西 13 | List initImgGridView(String imgStr) { 14 | List widgetList = []; 15 | if (imgStr != null && imgStr.length > 0) { 16 | List imgList = imgStr.split(","); 17 | List imgUrl = new List(); 18 | for (String s in imgList) { 19 | if (s.startsWith( 20 | 'https://static.oschina.net/uploads/space/https://oscimg.oschina.net/oscnet')) { 21 | imgUrl.add(s.substring( 22 | 'https://static.oschina.net/uploads/space/'.length, s.length)); 23 | } else { 24 | imgUrl.add(s); 25 | } 26 | } 27 | debugPrint('the imgUrl list is ${imgUrl.toString()}'); 28 | List> rows = []; 29 | num len = imgUrl.length; 30 | if (len > 1) { 31 | for (var row = 0; row < getRow(len); row++) { 32 | List rowArr = []; 33 | for (var col = 0; col < 3; col++) { 34 | num index = row * 3 + col; 35 | double cellWidth = (screenWidth - 100) / 3; 36 | if (index < len) { 37 | rowArr.add(new Padding( 38 | padding: const EdgeInsets.all(2.0), 39 | child: new Image.network( 40 | imgUrl[index], 41 | width: cellWidth, 42 | height: cellWidth, 43 | ), 44 | )); 45 | } 46 | } 47 | rows.add(rowArr); 48 | } 49 | for (var row in rows) { 50 | widgetList.add(new Row( 51 | children: row, 52 | )); 53 | } 54 | } else { 55 | double cellWidth = (screenWidth - 100) / 3; 56 | widgetList.add(new Row( 57 | children: [ 58 | new Padding( 59 | padding: const EdgeInsets.all(2.0), 60 | child: new Image.network( 61 | imgUrl[0], 62 | width: cellWidth, 63 | height: cellWidth, 64 | ), 65 | ) 66 | ], 67 | )); 68 | } 69 | } 70 | 71 | debugPrint('the widgetList is ${widgetList.toString()}'); 72 | return widgetList; 73 | } 74 | 75 | // 获取行数,n表示图片的张数 76 | // 如果n取余不为0,则行数为n取整+1,否则n取整就是行数 77 | int getRow(int n) { 78 | int a = n % 3; // 取余 79 | int b = n ~/ 3; // 取整 80 | if (a != 0) { 81 | return b + 1; 82 | } 83 | return b; 84 | } 85 | 86 | // banner图片 87 | List getBannerChild(BuildContext context, List slideData) { 88 | List items = []; 89 | if (slideData != null && slideData.length > 0) { 90 | for (var i = 0; i < slideData.length; i++) { 91 | var item = slideData[i]; 92 | var imgUrl = item['imagePath']; 93 | var title = item['title']; 94 | var detailUrl = item['url']; 95 | items.add(new GestureDetector( 96 | onTap: () { 97 | // 详情跳转 98 | Navigator.of(context) 99 | .push(new MaterialPageRoute(builder: (context) { 100 | return new NewsDetailPage(detailUrl, title); 101 | })); 102 | }, 103 | child: new Stack( 104 | children: [ 105 | new Image.network(imgUrl), 106 | new Container( 107 | width: screenWidth, 108 | color: const Color(0x50000000), 109 | child: new Padding( 110 | padding: const EdgeInsets.all(10.0), 111 | child: new Text(title, 112 | maxLines: 1, 113 | style: 114 | new TextStyle(color: Colors.white, fontSize: 15.0)), 115 | )), 116 | ], 117 | ), 118 | )); 119 | } 120 | return items; 121 | } 122 | } 123 | 124 | // 获取appBar 125 | Widget getAppBar(var title) { 126 | return new Text(title, style: new TextStyle(color: Colors.white)); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /lib/utils/cache/SpUtils.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutterdemo/app/OsApplication.dart'; 2 | import 'package:flutterdemo/domain/UserInfoBean.dart'; 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | import 'dart:async'; 5 | 6 | class SpUtils { 7 | static const SP_ID = 'sp_id'; 8 | static const SP_NAME = 'sp_name'; 9 | static const SP_EMAIL = 'sp_email'; 10 | 11 | static const SP_TOKEN_TYPE = 'sp_token_type'; 12 | static const SP_EXPIRES_IN = 'sp_expires_in'; 13 | 14 | static const SP_COOKIE = 'sp_cookie'; 15 | 16 | // 保存用户信息 17 | static void saveUserInfo(UserInfoBean userInfo) async { 18 | if (userInfo != null) { 19 | SharedPreferences sharedPreferences = 20 | await SharedPreferences.getInstance(); 21 | sharedPreferences.setString(SP_ID, userInfo.id.toString()); 22 | sharedPreferences.setString(SP_NAME, userInfo.username); 23 | sharedPreferences.setString(SP_EMAIL, userInfo.email); 24 | } 25 | } 26 | 27 | // 清除用户信息 28 | static void cleanUserInfo() async { 29 | SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); 30 | sharedPreferences.setString(SP_ID, null); 31 | sharedPreferences.setString(SP_NAME, null); 32 | sharedPreferences.setString(SP_EMAIL, null); 33 | saveCookie(null); 34 | OsApplication.cookie=null; 35 | } 36 | 37 | // 获取用户信息 38 | static Future getUserInfo() async { 39 | SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); 40 | var id = sharedPreferences.getString(SP_ID); 41 | var name = sharedPreferences.getString(SP_NAME); 42 | var email = sharedPreferences.getString(SP_EMAIL); 43 | UserInfoBean userInfoBean = new UserInfoBean(id, name, email); 44 | return userInfoBean; 45 | } 46 | 47 | // 把map转为UserInfoBean 48 | static Future map2UserInfo(Map map) async { 49 | if (map != null) { 50 | var id = map['id']; 51 | var name = map['username']; 52 | var email = map['email']; 53 | UserInfoBean userInfoBean = new UserInfoBean(id, name, email); 54 | return userInfoBean; 55 | } else { 56 | return null; 57 | } 58 | } 59 | 60 | // 保存token等信息 61 | static void saveTokenInfo(Map map) async { 62 | if (map != null) { 63 | var tokenType = map['token_type']; 64 | var expiresIn = map['expires_in']; 65 | 66 | SharedPreferences sp = await SharedPreferences.getInstance(); 67 | sp.setString(SP_TOKEN_TYPE, tokenType); 68 | sp.setString(SP_EXPIRES_IN, expiresIn.toString()); 69 | } 70 | } 71 | 72 | static void saveCookie(var cookie) async { 73 | SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); 74 | sharedPreferences.setString(SP_COOKIE, cookie); 75 | } 76 | 77 | static Future getCookie() async { 78 | SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); 79 | var cookieStr = sharedPreferences.getString(SP_COOKIE); 80 | return cookieStr; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /lib/utils/net/Api.dart: -------------------------------------------------------------------------------- 1 | class Api { 2 | // baseUrl 3 | static final BASE_URL = "http://www.wanandroid.com/"; 4 | 5 | // 获取用户信息 6 | static final String USER_INFO = BASE_URL + "/action/openapi/user"; 7 | 8 | // 更新头像 9 | static final String UPDATE_AVATAR = 10 | BASE_URL + "/action/openapi/portrait_update"; 11 | 12 | // 获取动弹列表 13 | static final String TWEET_LIST = BASE_URL + '/action/openapi/tweet_list'; 14 | 15 | // 回调地址 16 | static final String REDIRECT_URL = "http://yubo725.top/osc/osc.php"; 17 | 18 | //首页地址 根据网上博客资源 19 | static const NEWS_LIST_BASE_URL = "http://osc.yubo725.top/news/list"; 20 | 21 | // 登录接口 22 | static final String LOGIN_URL = 23 | "https://www.oschina.net/action/oauth2/authorize?client_id=4rWcDXCNTV5gMWxtagxI&response_type=code&redirect_uri=" + 24 | REDIRECT_URL; 25 | 26 | // 用户注册接口 27 | static final String USER_REGISTER = 'user/register'; 28 | 29 | // 用户登录接口 30 | static final String USER_LOGIN = 'user/login'; 31 | 32 | 33 | // banner接口 34 | static final String HOME_BANNER = 'banner/json'; 35 | 36 | // 首页文章列表 37 | static final String HOME_ARTICLE = 'article/list/'; 38 | 39 | // 体系 40 | static final String HOME_SYSTEM = 'tree/json'; 41 | 42 | // 体系下的文章 43 | static final String HOME_SYSTEM_CHILD = 'article/list/'; 44 | } 45 | -------------------------------------------------------------------------------- /lib/utils/net/Http.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutterdemo/app/OsApplication.dart'; 4 | import 'package:flutterdemo/utils/net/Api.dart'; 5 | import 'package:http/http.dart' as http; 6 | import 'dart:async'; 7 | import 'package:flutterdemo/utils/toast/TsUtils.dart'; 8 | import 'package:flutterdemo/utils/cache/SpUtils.dart'; 9 | 10 | class Http { 11 | // get 请求 12 | static Future get(String url, 13 | {Map params, bool saveCookie = false}) async { 14 | if (params == null) { 15 | params = new Map(); 16 | } 17 | String _url = Api.BASE_URL + url; 18 | if (params != null && params.isNotEmpty) { 19 | StringBuffer sb = new StringBuffer("?"); 20 | params.forEach((key, value) { 21 | sb.write("$key" + "=$value" + "&"); 22 | }); 23 | String paramStr = sb.toString(); 24 | print('参数是$params'); 25 | paramStr = paramStr.substring(0, paramStr.length - 1); 26 | _url += paramStr; 27 | } 28 | print('url是$url'); 29 | http.Response res = await http.get(_url); 30 | if (res.statusCode == 200) { 31 | var cookie = res.headers['set-cookie']; 32 | if (saveCookie) { 33 | SpUtils.saveCookie(cookie); 34 | OsApplication.cookie = cookie; 35 | } 36 | String body = res.body; 37 | var jsonStr = json.decode(body); 38 | int errCode = jsonStr['errorCode']; 39 | if (errCode == 0) { 40 | dynamic data = jsonStr['data']; 41 | print('the data of method is $data'); 42 | return body; 43 | } else { 44 | TsUtils.showShort(jsonStr['errorMsg']); 45 | } 46 | } else { 47 | TsUtils.showShort('您的网络好像不太好哟~~~///(^v^)\\\~~~'); 48 | } 49 | } 50 | 51 | // post请求 52 | static Future post(String url, 53 | {Map params, bool saveCookie = false}) async { 54 | if (params == null) { 55 | params = new Map(); 56 | } 57 | String _url = Api.BASE_URL + url; 58 | if (OsApplication.cookie != null) { 59 | params['Cookie'] = OsApplication.cookie; 60 | } 61 | http.Response res = await http.post(_url, body: params); 62 | return _dealWithRes(res, saveCookie: saveCookie); 63 | } 64 | 65 | static Map _dealWithRes(var res, {bool saveCookie}) { 66 | if (res.statusCode == 200) { 67 | var cookie = res.headers['set-cookie']; 68 | if (saveCookie) { 69 | SpUtils.saveCookie(cookie); 70 | OsApplication.cookie = cookie; 71 | } 72 | String body = res.body; 73 | var jsonStr = json.decode(body); 74 | print('the jsonStr is $jsonStr'); 75 | int errCode = jsonStr['errorCode']; 76 | if (errCode == 0) { 77 | var data = jsonStr['data']; 78 | return data; 79 | } else { 80 | TsUtils.showShort(jsonStr['errorMsg']); 81 | return null; 82 | } 83 | } else { 84 | TsUtils.showShort('您的网络好像不太好哟~~~///(^v^)\\\~~~'); 85 | return null; 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /lib/utils/net/ParamsUtils.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutterdemo/utils/cache/SpUtils.dart'; 2 | 3 | class ParamsUtils { 4 | static var accessToken; 5 | 6 | 7 | 8 | static Map getParams() { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /lib/utils/toast/TsUtils.dart: -------------------------------------------------------------------------------- 1 | import 'package:fluttertoast/fluttertoast.dart'; 2 | class TsUtils{ 3 | static showShort(String msg){ 4 | Fluttertoast.showToast( 5 | msg: msg, 6 | toastLength: Toast.LENGTH_SHORT, 7 | gravity: ToastGravity.CENTER, 8 | timeInSecForIos: 1, 9 | bgcolor: "#63CA6C", 10 | textcolor: '#ffffff' 11 | ); 12 | } 13 | } -------------------------------------------------------------------------------- /lib/widgets/LeftDraw.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutterdemo/pages/menu/SetPage.dart'; 3 | 4 | //侧滑菜单 5 | class LeftDraw extends StatelessWidget { 6 | // 图标左边的图片大小 7 | static const double IMAGE_ICON_WIDTH = 30.0; 8 | 9 | // 上面的图片大小 10 | static const double IMAGE_BANNER_HEIGHT = 304.0; 11 | static const double IMAGE_BANNER_WIDTH = 304.0; 12 | 13 | // 图标后面的箭头 14 | static const double ARROW_IMAGE_ICON_WIDTH = 16.0; 15 | var rightArrowIcon = new Image.asset( 16 | 'images/ic_arrow_right.png', 17 | width: ARROW_IMAGE_ICON_WIDTH, 18 | height: ARROW_IMAGE_ICON_WIDTH, 19 | ); 20 | List menuTitles = ['发布动弹', '动弹小黑屋', '关于', '设置']; 21 | List menuIcons = [ 22 | 'images/leftmenu/ic_fabu.png', 23 | 'images/leftmenu/ic_xiaoheiwu.png', 24 | 'images/ic_about.png', 25 | 'images/ic_set.png' 26 | ]; 27 | 28 | // 菜单文本的样式 29 | TextStyle menuStyle = new TextStyle( 30 | fontSize: 15.0, 31 | ); 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return new ConstrainedBox( 36 | constraints: const BoxConstraints.expand(width: IMAGE_BANNER_WIDTH), 37 | child: new Material( 38 | elevation: 16.0, 39 | child: new Container( 40 | decoration: new BoxDecoration( 41 | color: const Color(0x000000), 42 | ), 43 | child: new ListView.builder( 44 | itemCount: menuTitles.length * 2 + 1, 45 | itemBuilder: renderRow, 46 | ), 47 | ), 48 | ), 49 | ); 50 | } 51 | 52 | Widget getIconImage(path) { 53 | return new Padding( 54 | padding: const EdgeInsets.fromLTRB(2.0, 0.0, 6.0, 0.0), 55 | child: new Image.asset(path, width: 28.0, height: 28.0)); 56 | } 57 | 58 | Widget renderRow(BuildContext con, int index) { 59 | if (index == 0) { 60 | var img = new Image.asset( 61 | 'images/cover_img.jpg', 62 | width: IMAGE_BANNER_WIDTH, 63 | height: IMAGE_BANNER_HEIGHT, 64 | fit: BoxFit.fitWidth, 65 | ); 66 | return new Container( 67 | width: IMAGE_BANNER_WIDTH, 68 | height: IMAGE_BANNER_HEIGHT, 69 | margin: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 10.0), 70 | child: img, 71 | ); 72 | } 73 | 74 | index -= 1; 75 | if (index.isOdd) { 76 | return new Divider(); 77 | } 78 | index = index ~/ 2; 79 | var listItemContent = new Padding( 80 | padding: const EdgeInsets.fromLTRB(10.0, 6.0, 10.0, 6.0), 81 | child: new Row( 82 | children: [ 83 | getIconImage(menuIcons[index]), 84 | new Expanded( 85 | child: new Text( 86 | menuTitles[index], 87 | style: menuStyle, 88 | )), 89 | rightArrowIcon 90 | ], 91 | ), 92 | ); 93 | 94 | return new InkWell( 95 | child: listItemContent, 96 | onTap: () { 97 | debugPrint('the index is $index'); 98 | switch (index) { 99 | case 3: 100 | Navigator.of(con).push(new MaterialPageRoute(builder: (con) { 101 | return new SetPage(); 102 | })); 103 | break; 104 | case 2: 105 | case 1: 106 | case 0: 107 | } 108 | }, 109 | ); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /lib/widgets/SlideView.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | //滚动viewpager 4 | class SlideView extends StatefulWidget { 5 | var data; 6 | 7 | SlideView(this.data); 8 | 9 | @override 10 | State createState() { 11 | return new SlideViewState(data); 12 | } 13 | } 14 | 15 | class SlideViewState extends State 16 | with SingleTickerProviderStateMixin { 17 | TabController tabController; 18 | List slideData; 19 | 20 | SlideViewState(this.slideData); 21 | 22 | @override 23 | void initState() { 24 | super.initState(); 25 | // 初始化控制器 26 | tabController = new TabController( 27 | length: slideData == null ? 0 : slideData.length, vsync: this); 28 | } 29 | 30 | @override 31 | void dispose() { 32 | tabController.dispose(); 33 | super.dispose(); 34 | } 35 | 36 | @override 37 | build(dynamic) { 38 | List items = []; 39 | if (slideData != null && slideData.length > 0) { 40 | for (var i = 0; i < slideData.length; i++) { 41 | var item = slideData[i]; 42 | var imgUrl = item['imgUrl']; 43 | var title = item['title']; 44 | var detailUrl = item['detailUrl']; 45 | items.add(new GestureDetector( 46 | onTap: () { 47 | // 详情跳转 48 | }, 49 | child: new Stack( 50 | children: [ 51 | new Image.network(imgUrl), 52 | new Container( 53 | width: MediaQuery.of(context).size.width, 54 | color: const Color(0x50000000), 55 | child: new Padding( 56 | padding: const EdgeInsets.all(10.0), 57 | child: new Text(title, 58 | maxLines: 1, 59 | style: 60 | new TextStyle(color: Colors.white, fontSize: 15.0)), 61 | )), 62 | ], 63 | ), 64 | )); 65 | } 66 | } 67 | return new TabBarView( 68 | children: items, 69 | controller: tabController, 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutterdemo 2 | description: A new Flutter project. 3 | 4 | dependencies: 5 | flutter: 6 | sdk: flutter 7 | # The following adds the Cupertino Icons font to your application. 8 | # Use with the CupertinoIcons class for iOS style icons. 9 | cupertino_icons: ^0.1.0 10 | english_words: ^3.1.0 11 | flutter_refresh : ^0.0.1 12 | shared_preferences: ^0.4.1 13 | banner_view: ^1.1.2 14 | flutter_webview_plugin: ^0.2.1 15 | image_picker: ^0.4.7 16 | fluttertoast: ^2.0.7 17 | event_bus: "^1.0.1" 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | 22 | 23 | # For information on the generic Dart part of this file, see the 24 | # following page: https://www.dartlang.org/tools/pub/pubspec 25 | 26 | # The following section is specific to Flutter. 27 | flutter: 28 | 29 | # The following line ensures that the Material Icons font is 30 | # included with your application, so that you can use the icons in 31 | # the material Icons class. 32 | uses-material-design: true 33 | assets: 34 | - images/ic_avatar_default.png 35 | - images/ic_nav_news_normal.png 36 | - images/ic_nav_news_actived.png 37 | - images/ic_nav_tweet_normal.png 38 | - images/ic_nav_tweet_actived.png 39 | - images/ic_nav_discover_normal.png 40 | - images/ic_nav_discover_actived.png 41 | - images/ic_nav_my_normal.png 42 | - images/ic_nav_my_pressed.png 43 | - images/leftmenu/ic_xiaoheiwu.png 44 | - images/leftmenu/ic_fabu.png 45 | - images/leftmenu/ic_about.png 46 | - images/leftmenu/ic_settings.png 47 | - images/cover_img.jpg 48 | - images/ic_arrow_right.png 49 | - images/ic_comment.png 50 | - images/ic_img_default.jpg 51 | - images/ic_discover_gist.png 52 | - images/ic_discover_git.png 53 | - images/ic_discover_nearby.png 54 | - images/ic_discover_pos.png 55 | - images/ic_discover_scan.png 56 | - images/ic_discover_shake.png 57 | - images/ic_discover_softwares.png 58 | - images/ic_my_blog.png 59 | - images/ic_my_message.png 60 | - images/ic_my_question.png 61 | - images/ic_my_recommend.png 62 | - images/ic_my_team.png 63 | - images/oschina.png 64 | - images/android.jpg 65 | - images/ic_is_like.png 66 | - images/ic_un_like.png 67 | - images/author.png 68 | - images/ic_xiaoxin.jpg 69 | - images/ic_set.png 70 | - images/ic_about.png 71 | # To add assets to your application, add an assets section, like this: 72 | # assets: 73 | # - images/a_dot_burr.jpeg 74 | # - images/a_dot_ham.jpeg 75 | 76 | # An image asset can refer to one or more resolution-specific "variants", see 77 | # https://flutter.io/assets-and-images/#resolution-aware. 78 | 79 | # For details regarding adding assets from package dependencies, see 80 | # https://flutter.io/assets-and-images/#from-packages 81 | 82 | # To add custom fonts to your application, add a fonts section here, 83 | # in this "flutter" section. Each entry in this list should have a 84 | # "family" key with the font family name, and a "fonts" key with a 85 | # list giving the asset and other descriptors for the font. For 86 | # example: 87 | # fonts: 88 | # - family: Schyler 89 | # fonts: 90 | # - asset: fonts/Schyler-Regular.ttf 91 | # - asset: fonts/Schyler-Italic.ttf 92 | # style: italic 93 | # - family: Trajan Pro 94 | # fonts: 95 | # - asset: fonts/TrajanPro.ttf 96 | # - asset: fonts/TrajanPro_Bold.ttf 97 | # weight: 700 98 | # 99 | # For details regarding fonts from package dependencies, 100 | # see https://flutter.io/custom-fonts/#from-packages 101 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter 3 | // provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to 4 | // find child widgets in the widget tree, read text, and verify that the values of widget properties 5 | // are correct. 6 | 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_test/flutter_test.dart'; 9 | 10 | import 'package:flutterdemo/main.dart'; 11 | 12 | void main() { 13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 14 | // Build our app and trigger a frame. 15 | await tester.pumpWidget(new MyApp()); 16 | 17 | // Verify that our counter starts at 0. 18 | expect(find.text('0'), findsOneWidget); 19 | expect(find.text('1'), findsNothing); 20 | 21 | // Tap the '+' icon and trigger a frame. 22 | await tester.tap(find.byIcon(Icons.add)); 23 | await tester.pump(); 24 | 25 | // Verify that our counter has incremented. 26 | expect(find.text('0'), findsNothing); 27 | expect(find.text('1'), findsOneWidget); 28 | }); 29 | } 30 | --------------------------------------------------------------------------------