├── .gitignore
├── .metadata
├── README.md
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── tino
│ │ │ └── gankio
│ │ │ └── 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
├── header.jpg
└── ic_launcher.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
├── Resource
│ ├── Dimens.dart
│ └── Strings.dart
├── api
│ ├── Api.dart
│ ├── HttpManager.dart
│ └── ResultData.dart
├── config
│ └── Config.dart
├── eventbus
│ ├── DownloadEvent.dart
│ └── HttpErrorEvent.dart
├── main.dart
├── model
│ ├── FreeTimeCategory.dart
│ ├── FreeTimeCategory.g.dart
│ ├── FreeTimeCategoryResult.dart
│ ├── FreeTimeCategoryResult.g.dart
│ ├── FreeTimeItem.dart
│ ├── FreeTimeItem.g.dart
│ ├── FreeTimeItemResult.dart
│ ├── FreeTimeItemResult.g.dart
│ ├── FreeTimeSite.dart
│ ├── FreeTimeSite.g.dart
│ ├── FreeTimeSubCategory.dart
│ ├── FreeTimeSubCategory.g.dart
│ ├── FreeTimeSubCategoryResult.dart
│ ├── FreeTimeSubCategoryResult.g.dart
│ ├── HttpResult.dart
│ ├── HttpResult.g.dart
│ ├── Post.dart
│ ├── Post.g.dart
│ ├── WelfareResult.dart
│ └── WelfareResult.g.dart
├── pages
│ ├── commom
│ │ ├── CommomLocalWebPage.dart
│ │ ├── CommomWebPage.dart
│ │ └── GankMainPage.dart
│ ├── dailynews
│ │ └── DailyNewsPage.dart
│ ├── free_time_news
│ │ ├── FreeTimeNewsList.dart
│ │ ├── FreeTimeNewsPage.dart
│ │ └── FreeTimeNewsSubPage.dart
│ ├── home
│ │ ├── AboutPage.dart
│ │ ├── MyHomePage.dart
│ │ └── SubmitPage.dart
│ └── welfare
│ │ └── WelfarePage.dart
└── widget
│ ├── LinkText.dart
│ └── LoadingDialog.dart
├── pubspec.lock
├── pubspec.yaml
├── screenshot
├── Screenshot_1539675517.png
├── Screenshot_1539675604.png
├── Screenshot_1539675631.png
├── Screenshot_1539675636.png
└── download.png
└── test
└── widget_test.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 | .packages
4 | .pub/
5 | build/
6 | .flutter-plugins
7 | *.iml
8 | .idea/
9 | .gradle/
10 | ignoreConfig.dart
11 |
12 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 3b309bda072a6b326e8aa4591a5836af600923ce
8 | channel: beta
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # gank_io
2 |
3 | a flutter gank.io app
4 |
5 | 本应用为Flutter版本Gank.io客户端,仅供个人学习交流之用
6 | 特别感谢[干货集中营](https://gank.io/)为本应用提供Api
7 |
8 | 本应用主要参考了以下两位大佬的部分代码
9 |
10 |
11 | https://github.com/ZQ330093887/GankFlutter
12 |
13 |
14 | https://github.com/CarGuo/GSYGithubAppFlutter
15 |
16 |
17 | ## 截图
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | ### 下载
27 |
28 | #### Apk下载链接: [Apk下载链接](https://fir.im/q5lk)
29 |
30 |
31 | 类型 | 二维码
32 | -------- | ---
33 | **Apk二维码**|
34 |
35 |
36 |
--------------------------------------------------------------------------------
/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 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 |
27 | android {
28 | compileSdkVersion 27
29 |
30 | lintOptions {
31 | disable 'InvalidPackage'
32 | }
33 |
34 | defaultConfig {
35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 | applicationId "com.tino.gankio"
37 | minSdkVersion 16
38 | targetSdkVersion 27
39 | versionCode flutterVersionCode.toInteger()
40 | versionName flutterVersionName
41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
42 | }
43 |
44 | buildTypes {
45 | release {
46 | // TODO: Add your own signing config for the release build.
47 | // Signing with the debug keys for now, so `flutter run --release` works.
48 | signingConfig signingConfigs.debug
49 | }
50 | }
51 | }
52 |
53 | flutter {
54 | source '../..'
55 | }
56 |
57 | dependencies {
58 | testImplementation 'junit:junit:4.12'
59 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
61 | }
62 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
17 |
21 |
28 |
32 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/tino/gankio/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.tino.gankio;
2 |
3 | import android.os.Bundle;
4 | import io.flutter.app.FlutterActivity;
5 | import io.flutter.plugins.GeneratedPluginRegistrant;
6 |
7 | public class MainActivity extends FlutterActivity {
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | GeneratedPluginRegistrant.registerWith(this);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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.1.2'
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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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.4-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/header.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/images/header.jpg
--------------------------------------------------------------------------------
/images/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/images/ic_launcher.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 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/app.flx
37 | /Flutter/app.zip
38 | /Flutter/flutter_assets/
39 | /Flutter/App.framework
40 | /Flutter/Flutter.framework
41 | /Flutter/Generated.xcconfig
42 | /ServiceDefinitions.json
43 |
44 | Pods/
45 | .symlinks/
46 |
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 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 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXCopyFilesBuildPhase section */
26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
27 | isa = PBXCopyFilesBuildPhase;
28 | buildActionMask = 2147483647;
29 | dstPath = "";
30 | dstSubfolderSpec = 10;
31 | files = (
32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
34 | );
35 | name = "Embed Frameworks";
36 | runOnlyForDeploymentPostprocessing = 0;
37 | };
38 | /* End PBXCopyFilesBuildPhase section */
39 |
40 | /* Begin PBXFileReference section */
41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
43 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
58 | /* End PBXFileReference section */
59 |
60 | /* Begin PBXFrameworksBuildPhase section */
61 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
62 | isa = PBXFrameworksBuildPhase;
63 | buildActionMask = 2147483647;
64 | files = (
65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
67 | );
68 | runOnlyForDeploymentPostprocessing = 0;
69 | };
70 | /* End PBXFrameworksBuildPhase section */
71 |
72 | /* Begin PBXGroup section */
73 | 9740EEB11CF90186004384FC /* Flutter */ = {
74 | isa = PBXGroup;
75 | children = (
76 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
77 | 3B80C3931E831B6300D905FE /* App.framework */,
78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
79 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
83 | );
84 | name = Flutter;
85 | sourceTree = "";
86 | };
87 | 97C146E51CF9000F007C117D = {
88 | isa = PBXGroup;
89 | children = (
90 | 9740EEB11CF90186004384FC /* Flutter */,
91 | 97C146F01CF9000F007C117D /* Runner */,
92 | 97C146EF1CF9000F007C117D /* Products */,
93 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
94 | );
95 | sourceTree = "";
96 | };
97 | 97C146EF1CF9000F007C117D /* Products */ = {
98 | isa = PBXGroup;
99 | children = (
100 | 97C146EE1CF9000F007C117D /* Runner.app */,
101 | );
102 | name = Products;
103 | sourceTree = "";
104 | };
105 | 97C146F01CF9000F007C117D /* Runner */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
109 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
110 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
113 | 97C147021CF9000F007C117D /* Info.plist */,
114 | 97C146F11CF9000F007C117D /* Supporting Files */,
115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
117 | );
118 | path = Runner;
119 | sourceTree = "";
120 | };
121 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
122 | isa = PBXGroup;
123 | children = (
124 | 97C146F21CF9000F007C117D /* main.m */,
125 | );
126 | name = "Supporting Files";
127 | sourceTree = "";
128 | };
129 | /* End PBXGroup section */
130 |
131 | /* Begin PBXNativeTarget section */
132 | 97C146ED1CF9000F007C117D /* Runner */ = {
133 | isa = PBXNativeTarget;
134 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
135 | buildPhases = (
136 | 9740EEB61CF901F6004384FC /* Run Script */,
137 | 97C146EA1CF9000F007C117D /* Sources */,
138 | 97C146EB1CF9000F007C117D /* Frameworks */,
139 | 97C146EC1CF9000F007C117D /* Resources */,
140 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
142 | );
143 | buildRules = (
144 | );
145 | dependencies = (
146 | );
147 | name = Runner;
148 | productName = Runner;
149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
150 | productType = "com.apple.product-type.application";
151 | };
152 | /* End PBXNativeTarget section */
153 |
154 | /* Begin PBXProject section */
155 | 97C146E61CF9000F007C117D /* Project object */ = {
156 | isa = PBXProject;
157 | attributes = {
158 | LastUpgradeCheck = 0910;
159 | ORGANIZATIONNAME = "The Chromium Authors";
160 | TargetAttributes = {
161 | 97C146ED1CF9000F007C117D = {
162 | CreatedOnToolsVersion = 7.3.1;
163 | };
164 | };
165 | };
166 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
167 | compatibilityVersion = "Xcode 3.2";
168 | developmentRegion = English;
169 | hasScannedForEncodings = 0;
170 | knownRegions = (
171 | en,
172 | Base,
173 | );
174 | mainGroup = 97C146E51CF9000F007C117D;
175 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
176 | projectDirPath = "";
177 | projectRoot = "";
178 | targets = (
179 | 97C146ED1CF9000F007C117D /* Runner */,
180 | );
181 | };
182 | /* End PBXProject section */
183 |
184 | /* Begin PBXResourcesBuildPhase section */
185 | 97C146EC1CF9000F007C117D /* Resources */ = {
186 | isa = PBXResourcesBuildPhase;
187 | buildActionMask = 2147483647;
188 | files = (
189 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
190 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
191 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
193 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
195 | );
196 | runOnlyForDeploymentPostprocessing = 0;
197 | };
198 | /* End PBXResourcesBuildPhase section */
199 |
200 | /* Begin PBXShellScriptBuildPhase section */
201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
202 | isa = PBXShellScriptBuildPhase;
203 | buildActionMask = 2147483647;
204 | files = (
205 | );
206 | inputPaths = (
207 | );
208 | name = "Thin Binary";
209 | outputPaths = (
210 | );
211 | runOnlyForDeploymentPostprocessing = 0;
212 | shellPath = /bin/sh;
213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
214 | };
215 | 9740EEB61CF901F6004384FC /* Run Script */ = {
216 | isa = PBXShellScriptBuildPhase;
217 | buildActionMask = 2147483647;
218 | files = (
219 | );
220 | inputPaths = (
221 | );
222 | name = "Run Script";
223 | outputPaths = (
224 | );
225 | runOnlyForDeploymentPostprocessing = 0;
226 | shellPath = /bin/sh;
227 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
228 | };
229 | /* End PBXShellScriptBuildPhase section */
230 |
231 | /* Begin PBXSourcesBuildPhase section */
232 | 97C146EA1CF9000F007C117D /* Sources */ = {
233 | isa = PBXSourcesBuildPhase;
234 | buildActionMask = 2147483647;
235 | files = (
236 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
237 | 97C146F31CF9000F007C117D /* main.m in Sources */,
238 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
239 | );
240 | runOnlyForDeploymentPostprocessing = 0;
241 | };
242 | /* End PBXSourcesBuildPhase section */
243 |
244 | /* Begin PBXVariantGroup section */
245 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
246 | isa = PBXVariantGroup;
247 | children = (
248 | 97C146FB1CF9000F007C117D /* Base */,
249 | );
250 | name = Main.storyboard;
251 | sourceTree = "";
252 | };
253 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
254 | isa = PBXVariantGroup;
255 | children = (
256 | 97C147001CF9000F007C117D /* Base */,
257 | );
258 | name = LaunchScreen.storyboard;
259 | sourceTree = "";
260 | };
261 | /* End PBXVariantGroup section */
262 |
263 | /* Begin XCBuildConfiguration section */
264 | 97C147031CF9000F007C117D /* Debug */ = {
265 | isa = XCBuildConfiguration;
266 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
267 | buildSettings = {
268 | ALWAYS_SEARCH_USER_PATHS = NO;
269 | CLANG_ANALYZER_NONNULL = YES;
270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
271 | CLANG_CXX_LIBRARY = "libc++";
272 | CLANG_ENABLE_MODULES = YES;
273 | CLANG_ENABLE_OBJC_ARC = YES;
274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
275 | CLANG_WARN_BOOL_CONVERSION = YES;
276 | CLANG_WARN_COMMA = YES;
277 | CLANG_WARN_CONSTANT_CONVERSION = YES;
278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
279 | CLANG_WARN_EMPTY_BODY = YES;
280 | CLANG_WARN_ENUM_CONVERSION = YES;
281 | CLANG_WARN_INFINITE_RECURSION = YES;
282 | CLANG_WARN_INT_CONVERSION = YES;
283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
287 | CLANG_WARN_STRICT_PROTOTYPES = YES;
288 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
289 | CLANG_WARN_UNREACHABLE_CODE = YES;
290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
292 | COPY_PHASE_STRIP = NO;
293 | DEBUG_INFORMATION_FORMAT = dwarf;
294 | ENABLE_STRICT_OBJC_MSGSEND = YES;
295 | ENABLE_TESTABILITY = YES;
296 | GCC_C_LANGUAGE_STANDARD = gnu99;
297 | GCC_DYNAMIC_NO_PIC = NO;
298 | GCC_NO_COMMON_BLOCKS = YES;
299 | GCC_OPTIMIZATION_LEVEL = 0;
300 | GCC_PREPROCESSOR_DEFINITIONS = (
301 | "DEBUG=1",
302 | "$(inherited)",
303 | );
304 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
305 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
306 | GCC_WARN_UNDECLARED_SELECTOR = YES;
307 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
308 | GCC_WARN_UNUSED_FUNCTION = YES;
309 | GCC_WARN_UNUSED_VARIABLE = YES;
310 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
311 | MTL_ENABLE_DEBUG_INFO = YES;
312 | ONLY_ACTIVE_ARCH = YES;
313 | SDKROOT = iphoneos;
314 | TARGETED_DEVICE_FAMILY = "1,2";
315 | };
316 | name = Debug;
317 | };
318 | 97C147041CF9000F007C117D /* Release */ = {
319 | isa = XCBuildConfiguration;
320 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
321 | buildSettings = {
322 | ALWAYS_SEARCH_USER_PATHS = NO;
323 | CLANG_ANALYZER_NONNULL = YES;
324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
325 | CLANG_CXX_LIBRARY = "libc++";
326 | CLANG_ENABLE_MODULES = YES;
327 | CLANG_ENABLE_OBJC_ARC = YES;
328 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
329 | CLANG_WARN_BOOL_CONVERSION = YES;
330 | CLANG_WARN_COMMA = YES;
331 | CLANG_WARN_CONSTANT_CONVERSION = YES;
332 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
333 | CLANG_WARN_EMPTY_BODY = YES;
334 | CLANG_WARN_ENUM_CONVERSION = YES;
335 | CLANG_WARN_INFINITE_RECURSION = YES;
336 | CLANG_WARN_INT_CONVERSION = YES;
337 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
338 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
339 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
340 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
341 | CLANG_WARN_STRICT_PROTOTYPES = YES;
342 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
343 | CLANG_WARN_UNREACHABLE_CODE = YES;
344 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
345 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
346 | COPY_PHASE_STRIP = NO;
347 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
348 | ENABLE_NS_ASSERTIONS = NO;
349 | ENABLE_STRICT_OBJC_MSGSEND = YES;
350 | GCC_C_LANGUAGE_STANDARD = gnu99;
351 | GCC_NO_COMMON_BLOCKS = YES;
352 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
353 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
354 | GCC_WARN_UNDECLARED_SELECTOR = YES;
355 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
356 | GCC_WARN_UNUSED_FUNCTION = YES;
357 | GCC_WARN_UNUSED_VARIABLE = YES;
358 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
359 | MTL_ENABLE_DEBUG_INFO = NO;
360 | SDKROOT = iphoneos;
361 | TARGETED_DEVICE_FAMILY = "1,2";
362 | VALIDATE_PRODUCT = YES;
363 | };
364 | name = Release;
365 | };
366 | 97C147061CF9000F007C117D /* Debug */ = {
367 | isa = XCBuildConfiguration;
368 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
369 | buildSettings = {
370 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
371 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
372 | ENABLE_BITCODE = NO;
373 | FRAMEWORK_SEARCH_PATHS = (
374 | "$(inherited)",
375 | "$(PROJECT_DIR)/Flutter",
376 | );
377 | INFOPLIST_FILE = Runner/Info.plist;
378 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
379 | LIBRARY_SEARCH_PATHS = (
380 | "$(inherited)",
381 | "$(PROJECT_DIR)/Flutter",
382 | );
383 | PRODUCT_BUNDLE_IDENTIFIER = com.tino.gankIo;
384 | PRODUCT_NAME = "$(TARGET_NAME)";
385 | VERSIONING_SYSTEM = "apple-generic";
386 | };
387 | name = Debug;
388 | };
389 | 97C147071CF9000F007C117D /* Release */ = {
390 | isa = XCBuildConfiguration;
391 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
392 | buildSettings = {
393 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
394 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
395 | ENABLE_BITCODE = NO;
396 | FRAMEWORK_SEARCH_PATHS = (
397 | "$(inherited)",
398 | "$(PROJECT_DIR)/Flutter",
399 | );
400 | INFOPLIST_FILE = Runner/Info.plist;
401 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
402 | LIBRARY_SEARCH_PATHS = (
403 | "$(inherited)",
404 | "$(PROJECT_DIR)/Flutter",
405 | );
406 | PRODUCT_BUNDLE_IDENTIFIER = com.tino.gankIo;
407 | PRODUCT_NAME = "$(TARGET_NAME)";
408 | VERSIONING_SYSTEM = "apple-generic";
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
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/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 | gank_io
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ios/Runner/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/Resource/Dimens.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class Dimens{
4 | static final EdgeInsets textMargin = EdgeInsets.fromLTRB(0.0, 2.0, 0.0, 2.0);
5 | }
--------------------------------------------------------------------------------
/lib/Resource/Strings.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class Strings{
4 |
5 |
6 |
7 |
8 | }
--------------------------------------------------------------------------------
/lib/api/Api.dart:
--------------------------------------------------------------------------------
1 |
2 | class Api{
3 | static final String DAILY_NEWS = '/today';
4 |
5 | static final String WELFARE = '/data/福利/';
6 |
7 | static final String FREE_TIME_NEWS_CATEGORY = '/xiandu/categories';
8 |
9 | static final String FREE_TIME_NEWS_SUB_CATEGORY = '/xiandu/category';
10 |
11 | static final String FREE_TIME_NEWS_ITEMS = '/xiandu/data';
12 | }
--------------------------------------------------------------------------------
/lib/api/HttpManager.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:io';
3 | import 'package:dio/dio.dart';
4 | import 'package:event_bus/event_bus.dart';
5 | import 'package:gank_io/eventbus/HttpErrorEvent.dart';
6 | import 'package:gank_io/eventbus/DownloadEvent.dart';
7 | import 'package:connectivity/connectivity.dart';
8 | import 'package:gank_io/config/Config.dart';
9 | import 'ResultData.dart';
10 | import 'package:path_provider/path_provider.dart';
11 | import 'package:simple_permissions/simple_permissions.dart';
12 | import 'package:fluttertoast/fluttertoast.dart';
13 |
14 | class HttpManager {
15 | static final String basicUrl = 'http://gank.io/api';
16 | static final EventBus eventBus = new EventBus();
17 | static final Options mOptions = new Options(
18 | baseUrl: basicUrl, connectTimeout: 5000, receiveTimeout: 3000);
19 |
20 | ///get请求
21 | static Future get(String url,
22 | {Map params,
23 | String baseUrl,
24 | Map headers}) async {
25 | var connectivityResult = await (Connectivity().checkConnectivity());
26 | //无网络连接
27 | if (connectivityResult == ConnectivityResult.none) {
28 | eventBus.fire(HttpErrorEvent('无网络连接'));
29 | return ResultData(true, null, '无网络连接');
30 | }
31 |
32 | Dio dio = Dio(mOptions);
33 | Response response;
34 | try {
35 | if (params != null && params.isNotEmpty) {
36 | response = await dio.get(url, data: params);
37 | } else {
38 | response = await dio.get(url);
39 | }
40 | } on DioError catch (e) {
41 | if (e.type == DioErrorType.CONNECT_TIMEOUT) {
42 | eventBus.fire(HttpErrorEvent('连接超时'));
43 | return ResultData(true, null, '连接超时');
44 | } else if (e.response != null) {
45 | eventBus.fire(HttpErrorEvent(e.message));
46 | return ResultData(true, null, e.message);
47 | } else {
48 | eventBus.fire(HttpErrorEvent('未知错误'));
49 | return ResultData(true, null, '未知错误');
50 | }
51 | } finally {
52 | if (Config.DEBUG) {
53 | print('请求url: ' + dio.options.baseUrl + url);
54 | if (response != null) {
55 | print('返回结果: ' + response.data.toString());
56 | }
57 | }
58 | }
59 |
60 | if (!response.data['error']) {
61 | return ResultData(false, response.data, null);
62 | } else {
63 | eventBus.fire(HttpErrorEvent('服务器内部错误'));
64 | return ResultData(true, null, '服务器内部错误');
65 | }
66 | }
67 |
68 | ///post请求
69 | static Future post(String url,
70 | {Map params,
71 | String baseUrl,
72 | Map headers}) async {
73 | var connectivityResult = await (Connectivity().checkConnectivity());
74 | //无网络连接
75 | if (connectivityResult == ConnectivityResult.none) {
76 | eventBus.fire(HttpErrorEvent('无网络连接'));
77 | return ResultData(true, null, '无网络连接');
78 | }
79 |
80 | Dio dio = Dio(mOptions);
81 | Response response;
82 | try {
83 | if (params != null && params.isNotEmpty) {
84 | response = await dio.get(url, data: params);
85 | } else {
86 | response = await dio.post(url);
87 | }
88 | } on DioError catch (e) {
89 | if (e.type == DioErrorType.CONNECT_TIMEOUT) {
90 | eventBus.fire(HttpErrorEvent('连接超时'));
91 | return ResultData(true, null, '连接超时');
92 | } else if (e.response != null) {
93 | eventBus.fire(HttpErrorEvent(e.message));
94 | return ResultData(true, null, e.message);
95 | } else {
96 | eventBus.fire(HttpErrorEvent('未知错误'));
97 | return ResultData(true, null, '未知错误');
98 | }
99 | } finally {
100 | if (Config.DEBUG) {
101 | String reqUrl = dio.options.baseUrl + url + "&";
102 | if (params != null) {
103 | params.forEach((key, value) {
104 | reqUrl = reqUrl + key + "=" + value + "&";
105 | });
106 | }
107 | if (reqUrl.endsWith('&')) {
108 | reqUrl = reqUrl.substring(0, reqUrl.length - 1);
109 | }
110 | print('请求url: ' + reqUrl);
111 | if (response != null) {
112 | print('返回结果: ' + response.data.toString());
113 | }
114 | }
115 | }
116 |
117 | if (!response.data['error']) {
118 | return ResultData(false, response.data, null);
119 | } else {
120 | eventBus.fire(HttpErrorEvent('服务器内部错误'));
121 | return ResultData(true, null, '服务器内部错误');
122 | }
123 | }
124 |
125 | static void downloadFile(String url, String fileName) async {
126 | var dio = new Dio();
127 |
128 | dio.onHttpClientCreate = (HttpClient client) {
129 | client.idleTimeout = new Duration(seconds: 0);
130 | };
131 |
132 | Directory appDocDir = await getApplicationDocumentsDirectory();
133 | String appDocPath = appDocDir.path;
134 | String path = '${appDocPath}/${fileName}';
135 | bool isFirst = true;
136 |
137 | if(Platform.isAndroid){
138 | path = '/storage/emulated/0/${fileName}';
139 | }
140 |
141 | SimplePermissions.requestPermission(Permission.WriteExternalStorage).then((status){
142 | if(status == PermissionStatus.authorized){
143 | dio.download(url,path ,
144 | onProgress: (received, total) {
145 | double progress = received / total;;
146 | if(isFirst) {
147 | eventBus.fire(DownloadEvent(0));
148 | isFirst = false;
149 | }else{
150 | if(progress == 1){
151 | eventBus.fire(DownloadEvent(1));
152 | Fluttertoast.showToast(msg: '下载完成');
153 | }
154 | }
155 |
156 | });
157 | }
158 | });
159 |
160 |
161 |
162 |
163 |
164 |
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/lib/api/ResultData.dart:
--------------------------------------------------------------------------------
1 |
2 | class ResultData{
3 |
4 |
5 | bool error;
6 | var data;
7 | String message;
8 |
9 | ResultData(this.error, this.data, this.message);
10 |
11 |
12 | }
--------------------------------------------------------------------------------
/lib/config/Config.dart:
--------------------------------------------------------------------------------
1 | class Config{
2 | static const DEBUG = true;
3 | }
--------------------------------------------------------------------------------
/lib/eventbus/DownloadEvent.dart:
--------------------------------------------------------------------------------
1 |
2 | class DownloadEvent{
3 | int progress;
4 |
5 | DownloadEvent(this.progress);
6 |
7 | }
--------------------------------------------------------------------------------
/lib/eventbus/HttpErrorEvent.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | class HttpErrorEvent {
4 | final String message;
5 |
6 | HttpErrorEvent(this.message);
7 | }
8 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:gank_io/pages/commom/GankMainPage.dart';
3 |
4 | void main() => runApp(MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | @override
8 | Widget build(BuildContext context) {
9 | return MaterialApp(
10 | title: 'Gank.io',
11 | theme: ThemeData(
12 | primarySwatch: Colors.lightBlue,
13 | primaryColor: Colors.lightBlue,
14 | primaryColorDark: Colors.blue,
15 | accentColor: Colors.green,
16 | ),
17 | home: GankMainPage(),
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/lib/model/FreeTimeCategory.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | part 'FreeTimeCategory.g.dart';
3 |
4 | @JsonSerializable()
5 | class FreeTimeCategory{
6 | @JsonKey(name: '_id')
7 | String id;
8 | String en_name;
9 | String name;
10 | int rank;
11 |
12 |
13 | FreeTimeCategory(this.id, this.en_name, this.name, this.rank);
14 |
15 | factory FreeTimeCategory.fromJson(Map json) => _$FreeTimeCategoryFromJson(json);
16 |
17 |
18 | Map toJson() => _$FreeTimeCategoryToJson(this);
19 |
20 | }
--------------------------------------------------------------------------------
/lib/model/FreeTimeCategory.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'FreeTimeCategory.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | FreeTimeCategory _$FreeTimeCategoryFromJson(Map json) {
10 | return FreeTimeCategory(json['_id'] as String, json['en_name'] as String,
11 | json['name'] as String, json['rank'] as int);
12 | }
13 |
14 | Map _$FreeTimeCategoryToJson(FreeTimeCategory instance) =>
15 | {
16 | '_id': instance.id,
17 | 'en_name': instance.en_name,
18 | 'name': instance.name,
19 | 'rank': instance.rank
20 | };
21 |
--------------------------------------------------------------------------------
/lib/model/FreeTimeCategoryResult.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | import 'package:gank_io/model/FreeTimeCategory.dart';
3 | part 'FreeTimeCategoryResult.g.dart';
4 |
5 | @JsonSerializable()
6 | class FreeTimeCategoryResult{
7 | bool error;
8 | List results;
9 |
10 | FreeTimeCategoryResult(this.error, this.results);
11 |
12 | factory FreeTimeCategoryResult.fromJson(Map json) => _$FreeTimeCategoryResultFromJson(json);
13 |
14 |
15 | Map toJson() => _$FreeTimeCategoryResultToJson(this);
16 | }
--------------------------------------------------------------------------------
/lib/model/FreeTimeCategoryResult.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'FreeTimeCategoryResult.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | FreeTimeCategoryResult _$FreeTimeCategoryResultFromJson(
10 | Map json) {
11 | return FreeTimeCategoryResult(
12 | json['error'] as bool,
13 | (json['results'] as List)
14 | ?.map((e) => e == null
15 | ? null
16 | : FreeTimeCategory.fromJson(e as Map))
17 | ?.toList());
18 | }
19 |
20 | Map _$FreeTimeCategoryResultToJson(
21 | FreeTimeCategoryResult instance) =>
22 | {'error': instance.error, 'results': instance.results};
23 |
--------------------------------------------------------------------------------
/lib/model/FreeTimeItem.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | import 'FreeTimeSite.dart';
3 | part 'FreeTimeItem.g.dart';
4 |
5 | @JsonSerializable()
6 | class FreeTimeItem{
7 | @JsonKey(name: '_id')
8 | String id;
9 | String content;
10 | String cover;
11 | int crawled;
12 | String created_at;
13 | bool deleted;
14 | String published_at;
15 | String raw;
16 | FreeTimeSite site;
17 | String title;
18 | String uid;
19 | String url;
20 |
21 | FreeTimeItem(this.id, this.content, this.cover, this.crawled, this.created_at,
22 | this.deleted, this.published_at, this.raw, this.site, this.title,
23 | this.uid, this.url);
24 |
25 | factory FreeTimeItem.fromJson(Map json) => _$FreeTimeItemFromJson(json);
26 |
27 |
28 | Map toJson() => _$FreeTimeItemToJson(this);
29 |
30 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/lib/model/FreeTimeItem.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'FreeTimeItem.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | FreeTimeItem _$FreeTimeItemFromJson(Map json) {
10 | return FreeTimeItem(
11 | json['_id'] as String,
12 | json['content'] as String,
13 | json['cover'] as String,
14 | json['crawled'] as int,
15 | json['created_at'] as String,
16 | json['deleted'] as bool,
17 | json['published_at'] as String,
18 | json['raw'] as String,
19 | json['site'] == null
20 | ? null
21 | : FreeTimeSite.fromJson(json['site'] as Map),
22 | json['title'] as String,
23 | json['uid'] as String,
24 | json['url'] as String);
25 | }
26 |
27 | Map _$FreeTimeItemToJson(FreeTimeItem instance) =>
28 | {
29 | '_id': instance.id,
30 | 'content': instance.content,
31 | 'cover': instance.cover,
32 | 'crawled': instance.crawled,
33 | 'created_at': instance.created_at,
34 | 'deleted': instance.deleted,
35 | 'published_at': instance.published_at,
36 | 'raw': instance.raw,
37 | 'site': instance.site,
38 | 'title': instance.title,
39 | 'uid': instance.uid,
40 | 'url': instance.url
41 | };
42 |
--------------------------------------------------------------------------------
/lib/model/FreeTimeItemResult.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | import 'package:gank_io/model/FreeTimeItem.dart';
3 | part 'FreeTimeItemResult.g.dart';
4 |
5 | @JsonSerializable()
6 | class FreeTimeItemResult{
7 | bool error;
8 | List results;
9 |
10 | FreeTimeItemResult(this.error, this.results);
11 |
12 | factory FreeTimeItemResult.fromJson(Map json) => _$FreeTimeItemResultFromJson(json);
13 |
14 |
15 | Map toJson() => _$FreeTimeItemResultToJson(this);
16 | }
--------------------------------------------------------------------------------
/lib/model/FreeTimeItemResult.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'FreeTimeItemResult.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | FreeTimeItemResult _$FreeTimeItemResultFromJson(Map json) {
10 | return FreeTimeItemResult(
11 | json['error'] as bool,
12 | (json['results'] as List)
13 | ?.map((e) => e == null
14 | ? null
15 | : FreeTimeItem.fromJson(e as Map))
16 | ?.toList());
17 | }
18 |
19 | Map _$FreeTimeItemResultToJson(FreeTimeItemResult instance) =>
20 | {'error': instance.error, 'results': instance.results};
21 |
--------------------------------------------------------------------------------
/lib/model/FreeTimeSite.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | part 'FreeTimeSite.g.dart';
3 |
4 | @JsonSerializable()
5 | class FreeTimeSite{
6 | String cat_cn;
7 | String cat_en;
8 | String desc;
9 | String feed_id;
10 | String icon;
11 | String id;
12 | String name;
13 | int subscribers;
14 | String type;
15 | String url;
16 |
17 | FreeTimeSite(this.cat_cn, this.cat_en, this.desc, this.feed_id, this.icon,
18 | this.id, this.name, this.subscribers, this.type, this.url);
19 |
20 | factory FreeTimeSite.fromJson(Map json) => _$FreeTimeSiteFromJson(json);
21 |
22 |
23 | Map toJson() => _$FreeTimeSiteToJson(this);
24 |
25 |
26 | }
--------------------------------------------------------------------------------
/lib/model/FreeTimeSite.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'FreeTimeSite.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | FreeTimeSite _$FreeTimeSiteFromJson(Map json) {
10 | return FreeTimeSite(
11 | json['cat_cn'] as String,
12 | json['cat_en'] as String,
13 | json['desc'] as String,
14 | json['feed_id'] as String,
15 | json['icon'] as String,
16 | json['id'] as String,
17 | json['name'] as String,
18 | json['subscribers'] as int,
19 | json['type'] as String,
20 | json['url'] as String);
21 | }
22 |
23 | Map _$FreeTimeSiteToJson(FreeTimeSite instance) =>
24 | {
25 | 'cat_cn': instance.cat_cn,
26 | 'cat_en': instance.cat_en,
27 | 'desc': instance.desc,
28 | 'feed_id': instance.feed_id,
29 | 'icon': instance.icon,
30 | 'id': instance.id,
31 | 'name': instance.name,
32 | 'subscribers': instance.subscribers,
33 | 'type': instance.type,
34 | 'url': instance.url
35 | };
36 |
--------------------------------------------------------------------------------
/lib/model/FreeTimeSubCategory.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | part 'FreeTimeSubCategory.g.dart';
3 |
4 | @JsonSerializable()
5 | class FreeTimeSubCategory{
6 | @JsonKey(name: '_id')
7 | String cid;
8 | String created_at;
9 | String icon;
10 | String id;
11 | String title;
12 |
13 |
14 | FreeTimeSubCategory(this.cid, this.created_at, this.icon, this.id, this.title);
15 |
16 | factory FreeTimeSubCategory.fromJson(Map json) => _$FreeTimeSubCategoryFromJson(json);
17 |
18 |
19 | Map toJson() => _$FreeTimeSubCategoryToJson(this);
20 |
21 | }
--------------------------------------------------------------------------------
/lib/model/FreeTimeSubCategory.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'FreeTimeSubCategory.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | FreeTimeSubCategory _$FreeTimeSubCategoryFromJson(Map json) {
10 | return FreeTimeSubCategory(
11 | json['_id'] as String,
12 | json['created_at'] as String,
13 | json['icon'] as String,
14 | json['id'] as String,
15 | json['title'] as String);
16 | }
17 |
18 | Map _$FreeTimeSubCategoryToJson(
19 | FreeTimeSubCategory instance) =>
20 | {
21 | '_id': instance.cid,
22 | 'created_at': instance.created_at,
23 | 'icon': instance.icon,
24 | 'id': instance.id,
25 | 'title': instance.title
26 | };
27 |
--------------------------------------------------------------------------------
/lib/model/FreeTimeSubCategoryResult.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | import 'package:gank_io/model/FreeTimeSubCategory.dart';
3 | part 'FreeTimeSubCategoryResult.g.dart';
4 |
5 | @JsonSerializable()
6 | class FreeTimeSubCategoryResult{
7 | bool error;
8 | List results;
9 |
10 | FreeTimeSubCategoryResult(this.error, this.results);
11 |
12 | factory FreeTimeSubCategoryResult.fromJson(Map json) => _$FreeTimeSubCategoryResultFromJson(json);
13 |
14 |
15 | Map toJson() => _$FreeTimeSubCategoryResultToJson(this);
16 | }
--------------------------------------------------------------------------------
/lib/model/FreeTimeSubCategoryResult.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'FreeTimeSubCategoryResult.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | FreeTimeSubCategoryResult _$FreeTimeSubCategoryResultFromJson(
10 | Map json) {
11 | return FreeTimeSubCategoryResult(
12 | json['error'] as bool,
13 | (json['results'] as List)
14 | ?.map((e) => e == null
15 | ? null
16 | : FreeTimeSubCategory.fromJson(e as Map))
17 | ?.toList());
18 | }
19 |
20 | Map _$FreeTimeSubCategoryResultToJson(
21 | FreeTimeSubCategoryResult instance) =>
22 | {'error': instance.error, 'results': instance.results};
23 |
--------------------------------------------------------------------------------
/lib/model/HttpResult.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | import 'package:gank_io/model/Post.dart';
3 | part 'HttpResult.g.dart';
4 |
5 | @JsonSerializable()
6 | class HttpResult {
7 | List category;
8 | bool error;
9 | Map> results;
10 |
11 |
12 | HttpResult({this.category, this.error, this.results});
13 |
14 | factory HttpResult.fromJson(Map json) => _$HttpResultFromJson(json);
15 |
16 |
17 | Map toJson() => _$HttpResultToJson(this);
18 | }
--------------------------------------------------------------------------------
/lib/model/HttpResult.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'HttpResult.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | HttpResult _$HttpResultFromJson(Map json) {
10 | return HttpResult(
11 | category: (json['category'] as List)?.map((e) => e as String)?.toList(),
12 | error: json['error'] as bool,
13 | results: (json['results'] as Map)?.map((k, e) =>
14 | MapEntry(
15 | k,
16 | (e as List)
17 | ?.map((e) => e == null
18 | ? null
19 | : Post.fromJson(e as Map))
20 | ?.toList())));
21 | }
22 |
23 | Map _$HttpResultToJson(HttpResult instance) =>
24 | {
25 | 'category': instance.category,
26 | 'error': instance.error,
27 | 'results': instance.results
28 | };
29 |
--------------------------------------------------------------------------------
/lib/model/Post.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | part 'Post.g.dart';
3 |
4 | @JsonSerializable()
5 | class Post{
6 | @JsonKey(name: '_id')
7 | String id;
8 | String createdAt;
9 | String desc;
10 | List images;
11 | String publishedAt;
12 | String source;
13 | String type;
14 | String url;
15 | bool used;
16 | String who;
17 |
18 | Post({this.id, this.createdAt, this.desc, this.images, this.publishedAt,
19 | this.source, this.type, this.url, this.used, this.who});
20 |
21 | factory Post.fromJson(Map json) => _$PostFromJson(json);
22 |
23 |
24 | Map toJson() => _$PostToJson(this);
25 |
26 | }
--------------------------------------------------------------------------------
/lib/model/Post.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'Post.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | Post _$PostFromJson(Map json) {
10 | return Post(
11 | id: json['_id'] as String,
12 | createdAt: json['createdAt'] as String,
13 | desc: json['desc'] as String,
14 | images: (json['images'] as List)?.map((e) => e as String)?.toList(),
15 | publishedAt: json['publishedAt'] as String,
16 | source: json['source'] as String,
17 | type: json['type'] as String,
18 | url: json['url'] as String,
19 | used: json['used'] as bool,
20 | who: json['who'] as String);
21 | }
22 |
23 | Map _$PostToJson(Post instance) => {
24 | '_id': instance.id,
25 | 'createdAt': instance.createdAt,
26 | 'desc': instance.desc,
27 | 'images': instance.images,
28 | 'publishedAt': instance.publishedAt,
29 | 'source': instance.source,
30 | 'type': instance.type,
31 | 'url': instance.url,
32 | 'used': instance.used,
33 | 'who': instance.who
34 | };
35 |
--------------------------------------------------------------------------------
/lib/model/WelfareResult.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 | import 'package:gank_io/model/Post.dart';
3 | part 'WelfareResult.g.dart';
4 |
5 | @JsonSerializable()
6 | class WelfareResult {
7 | bool error;
8 | List results;
9 |
10 |
11 | WelfareResult({ this.error, this.results});
12 |
13 | factory WelfareResult.fromJson(Map json) => _$WelfareResultFromJson(json);
14 |
15 |
16 | Map toJson() => _$WelfareResultToJson(this);
17 | }
--------------------------------------------------------------------------------
/lib/model/WelfareResult.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'WelfareResult.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | WelfareResult _$WelfareResultFromJson(Map json) {
10 | return WelfareResult(
11 | error: json['error'] as bool,
12 | results: (json['results'] as List)
13 | ?.map((e) =>
14 | e == null ? null : Post.fromJson(e as Map))
15 | ?.toList());
16 | }
17 |
18 | Map _$WelfareResultToJson(WelfareResult instance) =>
19 | {'error': instance.error, 'results': instance.results};
20 |
--------------------------------------------------------------------------------
/lib/pages/commom/CommomLocalWebPage.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:io';
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
5 | import 'package:path_provider/path_provider.dart';
6 |
7 | class CommomLocalWebPage extends StatefulWidget {
8 | String title;
9 | String content;
10 |
11 |
12 | CommomLocalWebPage(this.title, this.content, {Key key}) : super(key: key);
13 |
14 | @override
15 | State createState() => new CommomLocalWebPageState();
16 | }
17 |
18 | class CommomLocalWebPageState extends State {
19 | final flutterWebviewPlugin = new FlutterWebviewPlugin();
20 | bool isLoading = true;
21 | String localUrl;
22 | StreamSubscription _onStateChanged;
23 | File localHtml;
24 |
25 | @override
26 | void initState() {
27 | super.initState();
28 | flutterWebviewPlugin.close();
29 | _onStateChanged = flutterWebviewPlugin.onStateChanged.listen(
30 | (WebViewStateChanged state) {
31 | switch (state.type) {
32 | case WebViewState.shouldStart:
33 | // 准备加载 可以考虑下showdialog
34 |
35 | break;
36 | case WebViewState.startLoad:
37 | // 开始加载
38 | break;
39 | case WebViewState.finishLoad:
40 | // 加载完成
41 | setState(() {
42 | isLoading = false;
43 | });
44 | break;
45 | }
46 | },
47 | );
48 | dealLocalHtml();
49 | }
50 |
51 | void dealLocalHtml() async{
52 | Directory tempDir = await getTemporaryDirectory();
53 | localHtml = File('${tempDir.path}/temp.html');
54 | localHtml.exists().then((isExists){
55 | if(isExists){
56 | localHtml.delete();
57 | localHtml.create();
58 | localHtml.writeAsString(widget.content).then((file){
59 | setState(() {
60 | localUrl = file.path;
61 | });
62 | });
63 | }else{
64 | localHtml.create();
65 | localHtml.writeAsString(widget.content).then((file){
66 | setState(() {
67 | localUrl = file.path;
68 | });
69 | });
70 | }
71 | });
72 | }
73 |
74 | @override
75 | void dispose() {
76 | //界面销毁时取消监听
77 | //_onUrlChanged.cancel();
78 | _onStateChanged.cancel();
79 | flutterWebviewPlugin.dispose();
80 | super.dispose();
81 | }
82 |
83 | @override
84 | Widget build(BuildContext context) {
85 | //获取当前state所属的widget
86 | var appBar = AppBar(
87 | title: Text(
88 | widget.title,
89 | style: TextStyle(color: Colors.white),
90 | ),
91 | iconTheme: IconThemeData(color: Colors.white),
92 | );
93 |
94 | return WebviewScaffold(
95 | url: localUrl,
96 | appBar: appBar,
97 | withJavascript: true,
98 | withLocalStorage: true,
99 | withLocalUrl: true,
100 | withZoom: true,
101 | );
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/lib/pages/commom/CommomWebPage.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
5 |
6 | class CommomWebPage extends StatefulWidget {
7 | String title;
8 | String url;
9 |
10 | CommomWebPage(this.title, this.url, {Key key}) : super(key: key);
11 |
12 | @override
13 | State createState() => new CommomWebPageState();
14 | }
15 |
16 | class CommomWebPageState extends State {
17 | final flutterWebviewPlugin = new FlutterWebviewPlugin();
18 | bool isLoading = true;
19 |
20 | StreamSubscription _onStateChanged;
21 |
22 | @override
23 | void initState() {
24 | super.initState();
25 | flutterWebviewPlugin.close();
26 | /*_onUrlChanged = flutterWebviewPlugin.onUrlChanged.listen((url) {
27 | setState(() {
28 | isLoading = false;
29 | });
30 | });*/
31 | _onStateChanged = flutterWebviewPlugin.onStateChanged.listen(
32 | (WebViewStateChanged state) {
33 | switch (state.type) {
34 | case WebViewState.shouldStart:
35 | // 准备加载 可以考虑下showdialog
36 |
37 | break;
38 | case WebViewState.startLoad:
39 | // 开始加载
40 | break;
41 | case WebViewState.finishLoad:
42 | // 加载完成
43 | setState(() {
44 | isLoading = false;
45 | });
46 | break;
47 | }
48 | },
49 | );
50 | }
51 |
52 | @override
53 | void dispose() {
54 | //界面销毁时取消监听
55 | //_onUrlChanged.cancel();
56 | _onStateChanged.cancel();
57 | flutterWebviewPlugin.dispose();
58 | super.dispose();
59 | }
60 |
61 | @override
62 | Widget build(BuildContext context) {
63 | //获取当前state所属的widget
64 | var appBar = AppBar(
65 | title: Text(
66 | widget.title,
67 | style: TextStyle(color: Colors.white),
68 | ),
69 | iconTheme: IconThemeData(color: Colors.white),
70 | );
71 |
72 | return WebviewScaffold(
73 | url: widget.url,
74 | appBar: appBar,
75 | withJavascript: true,
76 | withLocalStorage: true,
77 | withLocalUrl: true,
78 | withZoom: true,
79 | );
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/lib/pages/commom/GankMainPage.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:fluttertoast/fluttertoast.dart';
5 | import 'package:gank_io/api/HttpManager.dart';
6 | import 'package:gank_io/eventbus/HttpErrorEvent.dart';
7 | import 'package:gank_io/pages/dailyNews/DailyNewsPage.dart';
8 | import 'package:gank_io/pages/free_time_news/FreeTimeNewsPage.dart';
9 | import 'package:gank_io/pages/home/MyHomePage.dart';
10 | import 'package:gank_io/pages/welfare/WelfarePage.dart';
11 |
12 | class GankMainPage extends StatefulWidget {
13 | @override
14 | State createState() => _GankMainPageState();
15 | }
16 |
17 | class _GankMainPageState extends State {
18 | StreamSubscription errorSubscription;
19 | static const _titles = ['每日干货', '闲读新闻', '美女福利', '我的主页'];
20 | var _currentTitle = _titles[0];
21 | var _currentIndex = 0;
22 |
23 | PageController pageController;
24 | //底部tab控件list
25 | final List _bottomTabs = [
26 | BottomNavigationBarItem(
27 | icon: Icon(Icons.home),
28 | title: Text(_titles[0]),
29 | backgroundColor: Colors.lightBlue),
30 | BottomNavigationBarItem(
31 | icon: Icon(Icons.phone_iphone),
32 | title: Text(_titles[1]),
33 | backgroundColor: Colors.lightBlue),
34 | BottomNavigationBarItem(
35 | icon: Icon(Icons.image),
36 | title: Text(_titles[2]),
37 | backgroundColor: Colors.lightBlue),
38 | BottomNavigationBarItem(
39 | icon: Icon(Icons.person),
40 | title: Text(_titles[3]),
41 | backgroundColor: Colors.lightBlue)
42 | ];
43 |
44 | @override
45 | void initState() {
46 | super.initState();
47 | pageController = new PageController(initialPage: _currentIndex);
48 | errorSubscription =
49 | HttpManager.eventBus.on().listen((event) {
50 | Fluttertoast.showToast(msg: event.message);
51 | });
52 | }
53 |
54 | @override
55 | void dispose() {
56 | ///要在父类方法之前执行
57 | pageController.dispose();
58 | errorSubscription.cancel();
59 | super.dispose();
60 | }
61 |
62 | @override
63 | Widget build(BuildContext context) {
64 | return Scaffold(
65 | appBar: AppBar(
66 | title: Text(
67 | _currentTitle,
68 | style: TextStyle(color: Colors.white),
69 | ),
70 | centerTitle: true,
71 | elevation: 0.0,
72 | ),
73 | body: PageView(
74 | controller: pageController,
75 | children: [
76 | DailyNewsPage(),
77 | FreeTimeNewsPage(),
78 | WelfarePage(),
79 | MyHomePage(),
80 | ],
81 | onPageChanged: _onPageChanged,
82 | ),
83 | bottomNavigationBar: BottomNavigationBar(
84 | items: _bottomTabs,
85 | currentIndex: _currentIndex,
86 | //默认 tab数量等于3 BottomNavigationBarType.fixed
87 | //否则BottomNavigationBarType.shifting
88 | type: BottomNavigationBarType.fixed,
89 | //点击改变底部tab选中状态
90 | onTap: (int index) {
91 | pageController.animateToPage(index,
92 | duration: Duration(milliseconds: 300), curve: Curves.ease);
93 | },
94 | ));
95 | }
96 |
97 | ///底部tab改变调用该方法
98 | void _onPageChanged(int index) {
99 | setState(() {
100 | _currentIndex = index;
101 | switch (index) {
102 | case 0:
103 | _currentTitle = _titles[0];
104 | break;
105 | case 1:
106 | _currentTitle = _titles[1];
107 | break;
108 | case 2:
109 | _currentTitle = _titles[2];
110 | break;
111 | case 3:
112 | _currentTitle = _titles[3];
113 | break;
114 | }
115 | });
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/lib/pages/dailynews/DailyNewsPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:gank_io/api/HttpManager.dart';
3 | import 'package:gank_io/api/Api.dart';
4 | import 'package:gank_io/model/HttpResult.dart';
5 | import 'package:gank_io/model/Post.dart';
6 | import 'package:gank_io/Resource/Dimens.dart';
7 | import 'package:gank_io/pages/commom/CommomWebPage.dart';
8 |
9 | class DailyNewsPage extends StatefulWidget {
10 | @override
11 | State createState() => new DailyNewsState();
12 | }
13 |
14 | class DailyNewsState extends State {
15 | List _categories = List();
16 | Map> _dailyNews = new Map();
17 | @override
18 | void initState() {
19 | super.initState();
20 | HttpManager.get(Api.DAILY_NEWS).then((resultData) {
21 | HttpResult result = HttpResult.fromJson(resultData.data);
22 | if (result != null && !result.error) {
23 | setState(() {
24 | _dailyNews.clear();
25 | _dailyNews.addAll(result.results);
26 | //这里不能直接用HttpResult.category 和详细数据顺序不一致
27 | _categories.clear();
28 | _dailyNews.forEach((key,value){
29 | _categories.add(key);
30 | });
31 |
32 |
33 | });
34 | }
35 | });
36 | }
37 |
38 | ListView _getDailyList(List dailyNews) {
39 | List items = List();
40 | dailyNews.forEach((dailyNew) {
41 | items.add(_buildItem(dailyNew));
42 | });
43 | return ListView(
44 | children: items,
45 | );
46 | }
47 |
48 | Widget _buildItem(Post dailyNew) {
49 | return Card(
50 | elevation: 2.0,
51 | shape: const RoundedRectangleBorder(
52 | borderRadius: BorderRadius.all(Radius.circular(8.0)),
53 | ),
54 | margin: EdgeInsets.all(8.0),
55 | child: InkWell(
56 | onTap: (){
57 | Navigator.of(context).push( MaterialPageRoute(builder: (context){
58 | return CommomWebPage(dailyNew.desc, dailyNew.url);
59 | }));
60 | },
61 | child: Container(
62 | padding: EdgeInsets.all(8.0),
63 | child: Row(
64 | children: [
65 | Expanded(child: Column(
66 | crossAxisAlignment: CrossAxisAlignment.start,
67 | children: [
68 | Container(
69 | margin: Dimens.textMargin,
70 | child: Row(
71 | children: [
72 | Container(child: new Icon(Icons.timer),margin: EdgeInsets.fromLTRB(0.0, 0.0, 4.0, 0.0),),
73 | Expanded(child: new Text(_getTimeStr(dailyNew.publishedAt))),
74 | ],
75 | ),
76 | ),
77 | Container(
78 | margin: Dimens.textMargin,
79 | child: Text(
80 | dailyNew.desc,
81 | textAlign: TextAlign.left,
82 | ),
83 | ),
84 | Container(
85 | margin: Dimens.textMargin,
86 | child: Row(
87 | children: [
88 | Text(
89 | '作者:',
90 | style: TextStyle(color: Colors.grey),
91 | ),
92 | Text(
93 | dailyNew.who,
94 | style: TextStyle(color: Colors.lightBlue),
95 | ),
96 | ],
97 | ),
98 | ),
99 | ],
100 | ),
101 | ),
102 | //注意 Image控件 当url为空时 不会显示 大小为0
103 | Image.network((dailyNew.images == null || dailyNew.images.length == 0)?'':dailyNew.images[0],width: 80.0,height: 80.0,)
104 | ],
105 | )
106 | ),
107 | ),
108 | );
109 | }
110 |
111 | String _getTimeStr(String str){
112 | DateTime dateTime = DateTime.parse(str);
113 | return '${dateTime.year}年${dateTime.month}月${dateTime.day}日' ;
114 | }
115 |
116 |
117 |
118 | @override
119 | Widget build(BuildContext context) {
120 | if (_categories.length == 0) {
121 | return Center(
122 | //圆形进度条
123 | child: CircularProgressIndicator(),
124 | );
125 | } else {
126 | List tabs = List();
127 | List widgets = List();
128 | _categories.forEach((category) {
129 | tabs.add( Tab(text: category));
130 | });
131 | _dailyNews.forEach((key, value) {
132 | widgets.add(_getDailyList(value));
133 | });
134 |
135 | return DefaultTabController(
136 | length: _categories.length,
137 | child: Scaffold(
138 | appBar: AppBar(
139 | title: TabBar(
140 | tabs: tabs, isScrollable: true, labelColor: Colors.white),
141 | ),
142 | body: TabBarView(children: widgets),
143 | ));
144 | }
145 |
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/lib/pages/free_time_news/FreeTimeNewsList.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:gank_io/model/FreeTimeSubCategory.dart';
3 | import 'package:gank_io/model/FreeTimeItemResult.dart';
4 | import 'package:gank_io/model/FreeTimeItem.dart';
5 | import 'package:gank_io/api/Api.dart';
6 | import 'package:gank_io/api/HttpManager.dart';
7 | import 'package:gank_io/pages/commom/CommomWebPage.dart';
8 |
9 | class FreeTimeNewsList extends StatefulWidget {
10 | FreeTimeSubCategory _subCategory;
11 |
12 | FreeTimeNewsList(this._subCategory, {Key key}) : super(key: key);
13 |
14 | @override
15 | State createState() => FreeTimeNewsListState();
16 | }
17 |
18 | class FreeTimeNewsListState extends State {
19 | int _page = 1;
20 | static final int _pageSize = 10;
21 | List _items = List();
22 | ScrollController _controller = new ScrollController();
23 |
24 | @override
25 | void initState() {
26 | super.initState();
27 | _controller.addListener(() {
28 | //最大可滑动距离
29 | var maxScroll = _controller.position.maxScrollExtent;
30 | //当前距离
31 | var pixels = _controller.position.pixels;
32 | //滑动到底部
33 | if (maxScroll == pixels) {
34 | _page++;
35 | _getItems();
36 | }
37 | });
38 | _getItems();
39 | }
40 |
41 | @override
42 | void dispose() {
43 | _controller.dispose();
44 | super.dispose();
45 | }
46 |
47 | void _getItems() {
48 | HttpManager.get(Api.FREE_TIME_NEWS_ITEMS +
49 | '/id/${widget._subCategory.id}/count/${_pageSize}/page/${_page}')
50 | .then((resultData) {
51 | FreeTimeItemResult result = FreeTimeItemResult.fromJson(resultData.data);
52 | if (result != null && !result.error) {
53 | setState(() {
54 | if (_page == 1) {
55 | _items.clear();
56 | }
57 | _items.addAll(result.results);
58 | });
59 | }
60 | });
61 | }
62 |
63 | @override
64 | Widget build(BuildContext context) {
65 | String _getTimeStr(String str) {
66 | DateTime dateTime = DateTime.parse(str);
67 | return '${dateTime.year}年${dateTime.month}月${dateTime.day}日';
68 | }
69 |
70 | Widget _buildItem(int position) {
71 | FreeTimeItem item = _items[position];
72 | return Card(
73 | elevation: 2.0,
74 | shape: const RoundedRectangleBorder(
75 | borderRadius: BorderRadius.all(Radius.circular(8.0))),
76 | margin: const EdgeInsets.all(8.0),
77 | child: InkWell(
78 | onTap: () {
79 | Navigator.push(context, MaterialPageRoute(builder: (context) {
80 | return CommomWebPage(item.title, item.url);
81 | }));
82 | },
83 | child: Row(
84 | children: [
85 | SizedBox(
86 | width: 180.0,
87 | height: 120.0,
88 | child: Container(
89 | margin: const EdgeInsets.all(8.0),
90 | child: Column(
91 | children: [
92 | Expanded(child: Text(item.title, maxLines: 3)),
93 | Text(
94 | _getTimeStr(item.published_at),
95 | style: TextStyle(color: Colors.grey),
96 | )
97 | ],
98 | ),
99 | )),
100 | Expanded(
101 | child: Image.network(
102 | (item.cover == null || item.cover == "none")
103 | ? "http://img.zcool.cn/community/010ad7575faad10000012e7e0be5bb.gif"
104 | : item.cover,
105 | height: 120.0,
106 | fit: BoxFit.fill,
107 | ))
108 | ],
109 | ),
110 | ));
111 | }
112 |
113 | Future _pullToRefresh() async {
114 | _page = 1;
115 | _getItems();
116 | return null;
117 | }
118 |
119 | return RefreshIndicator(
120 | child: ListView.builder(
121 | itemBuilder: (context, position) {
122 | return _buildItem(position);
123 | },
124 | controller: _controller,
125 | itemCount: _items.length,
126 | ),
127 | onRefresh: _pullToRefresh);
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/lib/pages/free_time_news/FreeTimeNewsPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:gank_io/api/HttpManager.dart';
3 | import 'package:gank_io/api/Api.dart';
4 | import 'package:gank_io/model/FreeTimeCategory.dart';
5 | import 'package:gank_io/model/FreeTimeCategoryResult.dart';
6 | import 'FreeTimeNewsSubPage.dart';
7 |
8 | class FreeTimeNewsPage extends StatefulWidget {
9 | @override
10 | State createState() => FreeTimeNewsPageState();
11 | }
12 |
13 | class FreeTimeNewsPageState extends State {
14 | List _categories = List();
15 |
16 | @override
17 | void initState() {
18 | super.initState();
19 | HttpManager.get(Api.FREE_TIME_NEWS_CATEGORY).then((result) {
20 | FreeTimeCategoryResult categoryResult =
21 | FreeTimeCategoryResult.fromJson(result.data);
22 | if (categoryResult != null && !categoryResult.error) {
23 | setState(() {
24 | _categories.addAll(categoryResult.results);
25 | });
26 | }
27 | });
28 | }
29 |
30 | @override
31 | Widget build(BuildContext context) {
32 | Widget _buildItem(FreeTimeCategory category) {
33 | return GestureDetector(
34 | onTap: (){
35 | Navigator.push(context, MaterialPageRoute(builder: (context){
36 | return FreeTimeNewsSubPage(category);
37 | }));
38 |
39 | },
40 | child: Card(
41 | elevation: 2.0,
42 | shape: const RoundedRectangleBorder(
43 | borderRadius: BorderRadius.all(Radius.circular(8.0)),
44 | ),
45 | margin: EdgeInsets.all(8.0),
46 | child: SizedBox(
47 | width: 200.0,
48 | height: 200.0,
49 | child: Stack(
50 | alignment: AlignmentDirectional.center,
51 | children: [
52 | Positioned.fill(
53 | child: Image.network(
54 | 'https://img.ithome.com/newsuploadfiles/2017/11/20171116_224242_334.jpg',
55 | fit: BoxFit.cover,
56 | )),
57 | Center(
58 | child: Text(
59 | category.name,
60 | style: TextStyle(color: Colors.white, fontSize: 20.0),
61 | ),
62 | )
63 | ],
64 | ),
65 | )));
66 | }
67 |
68 | if (_categories.length == 0) {
69 | return Center(
70 | //圆形进度条
71 | child: CircularProgressIndicator(),
72 | );
73 | } else {
74 | return Scaffold(
75 | body: ListView.builder(
76 | itemBuilder: (context, position) {
77 | return _buildItem(_categories[position]);
78 | },
79 | itemCount: _categories.length,
80 | ));
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/lib/pages/free_time_news/FreeTimeNewsSubPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:gank_io/api/HttpManager.dart';
3 | import 'package:gank_io/api/Api.dart';
4 | import 'package:gank_io/model/FreeTimeCategory.dart';
5 | import 'package:gank_io/model/FreeTimeSubCategory.dart';
6 | import 'package:gank_io/model/FreeTimeSubCategoryResult.dart';
7 | import 'FreeTimeNewsList.dart';
8 |
9 | class FreeTimeNewsSubPage extends StatefulWidget {
10 | FreeTimeCategory _category;
11 |
12 | FreeTimeNewsSubPage(this._category, {Key key}) : super(key: key);
13 |
14 | @override
15 | State createState() => FreeTimeNewsSubPageState();
16 | }
17 |
18 | class FreeTimeNewsSubPageState extends State {
19 | List _subCategories = new List();
20 | List _tabs = new List();
21 | List _contents = new List();
22 | @override
23 | void initState() {
24 | super.initState();
25 | HttpManager.get(
26 | Api.FREE_TIME_NEWS_SUB_CATEGORY + '/${widget._category.en_name}')
27 | .then((data) {
28 | FreeTimeSubCategoryResult result =
29 | FreeTimeSubCategoryResult.fromJson(data.data);
30 | if (result.error == false && result.results != null) {
31 | setState(() {
32 | _subCategories.clear();
33 | _subCategories.addAll(result.results);
34 | });
35 | }
36 | });
37 | }
38 |
39 | List getTabs() {
40 | _tabs.clear();
41 | _subCategories.forEach((subCategory) {
42 | _tabs.add(Tab(
43 | text: subCategory.title.contains('湾区日报') ? '湾区日报' : subCategory.title,
44 | icon: SizedBox(
45 | width: 24.0,
46 | height: 24.0,
47 | child: Image.network(subCategory.icon,fit: BoxFit.cover,),
48 | )));
49 | });
50 | return _tabs;
51 | }
52 |
53 | List getContents() {
54 | _contents.clear();
55 | _subCategories.forEach((subCategory) {
56 | _contents.add(FreeTimeNewsList(subCategory));
57 | });
58 | return _contents;
59 | }
60 |
61 | @override
62 | Widget build(BuildContext context) {
63 | if (_subCategories.length == 0) {
64 | return Center(
65 | //圆形进度条
66 | child: CircularProgressIndicator(),
67 | );
68 | } else {
69 | return DefaultTabController(
70 | length: _subCategories.length,
71 | child: Scaffold(
72 | appBar: AppBar(
73 | iconTheme: IconThemeData(color: Colors.white),
74 | centerTitle: true,
75 | title: Title(
76 | color: Colors.white,
77 | child: Text(
78 | widget._category.name,
79 | style: TextStyle(color: Colors.white),
80 | )),
81 | bottom: TabBar(
82 | tabs: getTabs(),
83 | isScrollable: true,
84 | labelColor: Colors.white),
85 | ),
86 | body: TabBarView(children: getContents()),
87 | ));
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/lib/pages/home/AboutPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:gank_io/widget/LinkText.dart';
3 |
4 | class AboutPage extends StatelessWidget {
5 | @override
6 | Widget build(BuildContext context) {
7 | return Scaffold(
8 | appBar: AppBar(
9 | centerTitle: true,
10 | title: Title(
11 | color: Colors.white,
12 | child: Text(
13 | '关于应用',
14 | style: TextStyle(color: Colors.white),
15 | )),
16 | iconTheme: IconThemeData(color: Colors.white),
17 | ),
18 | body: Container(
19 | padding: EdgeInsets.all(20.0),
20 | child: Column(
21 | crossAxisAlignment: CrossAxisAlignment.start,
22 | children: [
23 | Row(
24 | children: [
25 | Image.asset('images/ic_launcher.png',
26 | width: 60.0, height: 60.0),
27 | Padding(padding: const EdgeInsets.all(8.0)),
28 | Text(
29 | 'Gank.io Flutter客户端',
30 | style: TextStyle(fontSize: 20.0),
31 | )
32 | ],
33 | ),
34 | Padding(padding: const EdgeInsets.all(8.0)),
35 | Text('本项目地址:\n'),
36 | Padding(padding: const EdgeInsets.all(8.0)),
37 | LinkText('https://github.com/txy199292/gank_io',
38 | 'https://github.com/txy199292/gank_io', Colors.green),
39 | Padding(padding: const EdgeInsets.all(8.0)),
40 | Text(
41 | '本应用为Flutter版本Gank.io客户端,应供个人学习交流之用。\n\n特别感谢Gank.io为本应用提供Api:\n'),
42 | LinkText('https://gank.io/', 'https://gank.io/', Colors.green),
43 | Padding(padding: const EdgeInsets.all(8.0)),
44 | Text('本应用主要参考了以下两位大佬的部分代码:'),
45 | Padding(padding: const EdgeInsets.all(8.0)),
46 | LinkText(
47 | 'https://github.com/CarGuo/GSYGithubAppFlutter',
48 | 'https://github.com/CarGuo/GSYGithubAppFlutter',
49 | Colors.green),
50 | Padding(padding: const EdgeInsets.all(8.0)),
51 | LinkText('https://github.com/ZQ330093887/GankFlutter',
52 | 'https://github.com/ZQ330093887/GankFlutter', Colors.green),
53 | ],
54 | ),
55 | ));
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/lib/pages/home/MyHomePage.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:gank_io/pages/commom/CommomWebPage.dart';
5 | import 'package:gank_io/pages/home/AboutPage.dart';
6 | import 'package:gank_io/pages/home/SubmitPage.dart';
7 | import 'package:image_picker/image_picker.dart';
8 |
9 | class MyHomePage extends StatefulWidget {
10 | @override
11 | State createState() => MyHomePageState();
12 | }
13 |
14 | class MyHomePageState extends State {
15 | String userAvatar;
16 | String userName;
17 | var commomItems = [
18 | Item('我的设置', Icons.settings),
19 | Item('提交干货', Icons.cloud_upload),
20 | Item('项目地址', Icons.computer),
21 | Item('关于应用', Icons.toys),
22 | Item('退出应用', Icons.exit_to_app)
23 | ];
24 | final TextEditingController _textController = TextEditingController();
25 |
26 | @override
27 | void dispose() {
28 | _textController.dispose();
29 | super.dispose();
30 | }
31 |
32 | @override
33 | Widget build(BuildContext context) {
34 | Future getImage() async {
35 | var image = await ImagePicker.pickImage(source: ImageSource.gallery);
36 | setState(() {
37 | userAvatar = image.path;
38 | });
39 | }
40 |
41 | var header = Container(
42 | color: Colors.lightBlue,
43 | child: Center(
44 | child: Column(
45 | children: [
46 | GestureDetector(
47 | child: SizedBox(
48 | width: 70.0,
49 | height: 70.0,
50 | child: CircleAvatar(
51 | backgroundColor: Colors.yellow,
52 | backgroundImage: userAvatar == null
53 | ? AssetImage('images/header.jpg')
54 | : AssetImage(userAvatar),
55 | ),
56 | ),
57 | onTap: () {
58 | getImage();
59 | },
60 | ),
61 | Padding(padding: const EdgeInsets.all(8.0)),
62 | GestureDetector(
63 | child: Row(
64 | mainAxisAlignment: MainAxisAlignment.center,
65 | children: [
66 | Text(
67 | userName == null ? "点击设置昵称" : userName,
68 | style: new TextStyle(color: Colors.white, fontSize: 16.0),
69 | maxLines: 1,
70 | ),
71 | Padding(padding: const EdgeInsets.all(2.0)),
72 | Icon(
73 | Icons.create,
74 | color: Colors.white,
75 | )
76 | ],
77 | ),
78 | onTap: () {
79 | showDialog(
80 | context: context,
81 | barrierDismissible: false,
82 | builder: (context) {
83 | return new AlertDialog(
84 | title: Center(
85 | child: Text(
86 | '设置昵称',
87 | style: TextStyle(color: Colors.green),
88 | ),
89 | ),
90 | content: TextField(
91 | maxLines: 2,
92 | maxLength: 20,
93 | controller: _textController,
94 | decoration: InputDecoration(
95 | hintText: '请输入昵称',
96 | border: OutlineInputBorder(
97 | borderSide: BorderSide(color: Colors.green),
98 | borderRadius:
99 | BorderRadius.all(Radius.circular(8.0)))),
100 | ),
101 | actions: [
102 | new FlatButton(
103 | onPressed: () {
104 | Navigator.of(context).pop();
105 | },
106 | child: Text('取消')),
107 | new FlatButton(
108 | onPressed: () {
109 | setState(() {
110 | userName = _textController.text;
111 | });
112 | _textController.clear();
113 | Navigator.of(context).pop();
114 | },
115 | child: new Text('确定'))
116 | ],
117 | );
118 | });
119 | },
120 | ),
121 | Padding(padding: const EdgeInsets.all(8.0)),
122 | ],
123 | ),
124 | ),
125 | );
126 |
127 | List getItems() {
128 | List items = List();
129 | items.add(header);
130 |
131 | commomItems.forEach((item) {
132 | items.add(Divider(
133 | height: 1.0,
134 | ));
135 |
136 | items.add(InkWell(
137 | child: ListTile(
138 | leading: Icon(item.icon, color: Colors.lightBlue),
139 | title: Text(item.title),
140 | trailing: Icon(
141 | Icons.keyboard_arrow_right,
142 | ),
143 | onTap: () {
144 | switch (item.title) {
145 | case '我的设置':
146 | break;
147 | case '提交干货':
148 | Navigator.push(context, MaterialPageRoute(builder: (context) {
149 | return SubmitPage();
150 | }));
151 | break;
152 | case '项目地址':
153 | Navigator.push(context, MaterialPageRoute(builder: (context) {
154 | return CommomWebPage(
155 | '项目地址', 'https://github.com/txy199292/gank_io');
156 | }));
157 | break;
158 | case '关于应用':
159 | Navigator.push(context, MaterialPageRoute(builder: (context) {
160 | return AboutPage();
161 | }));
162 | break;
163 | case '退出应用':
164 | exit(0);
165 | break;
166 | }
167 | },
168 | ),
169 | ));
170 | });
171 |
172 | items.add(Divider(
173 | height: 1.0,
174 | ));
175 | return items;
176 | }
177 |
178 | return ListView(
179 | children: getItems(),
180 | );
181 | }
182 | }
183 |
184 | class Item {
185 | String title;
186 | IconData icon;
187 |
188 | Item(this.title, this.icon);
189 | }
190 |
--------------------------------------------------------------------------------
/lib/pages/home/SubmitPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:fluttertoast/fluttertoast.dart';
3 |
4 | class SubmitPage extends StatefulWidget {
5 | @override
6 | State createState() => SubmitPageState();
7 | }
8 |
9 | class SubmitPageState extends State {
10 | TextEditingController _controller = TextEditingController();
11 | static final List categories = [
12 | 'Android',
13 | 'iOS',
14 | '前端',
15 | '瞎推荐',
16 | '休息视频',
17 | '拓展资源',
18 | '福利',
19 | 'App'
20 | ];
21 | String selectCategory = categories[0];
22 |
23 | @override
24 | Widget build(BuildContext context) {
25 | return Scaffold(
26 | appBar: AppBar(
27 | centerTitle: true,
28 | title: Title(
29 | color: Colors.white,
30 | child: Text(
31 | '关于应用',
32 | style: TextStyle(color: Colors.white),
33 | )),
34 | iconTheme: IconThemeData(color: Colors.white),
35 | ),
36 | body: ListView(
37 | padding: EdgeInsets.all(16.0),
38 | children: [
39 | Center(
40 | child: Text(
41 | '提交干货只需三步',
42 | style: TextStyle(fontSize: 18.0),
43 | ),
44 | ),
45 | Padding(padding: const EdgeInsets.all(2.0)),
46 | Text(
47 | 'Step0:',
48 | style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold),
49 | ),
50 | Padding(padding: const EdgeInsets.all(2.0)),
51 | Text('阅读优秀干货的定义:',
52 | style: TextStyle(
53 | fontSize: 18.0,
54 | )),
55 | Padding(padding: const EdgeInsets.all(2.0)),
56 | Text('功能专一,文档完备,国际化,能加速开发的开源库或者框架',
57 | style: TextStyle(
58 | fontSize: 14.0,
59 | )),
60 | Padding(padding: const EdgeInsets.all(2.0)),
61 | Text('新颖技术架构的完整 App 项目',
62 | style: TextStyle(
63 | fontSize: 14.0,
64 | )),
65 | Padding(padding: const EdgeInsets.all(2.0)),
66 | Text('原创,深入浅出的文章(非简单入门)',
67 | style: TextStyle(
68 | fontSize: 14.0,
69 | )),
70 | Padding(padding: const EdgeInsets.all(2.0)),
71 | Text('激发灵感的展示性项目',
72 | style: TextStyle(
73 | fontSize: 14.0,
74 | )),
75 | Padding(padding: const EdgeInsets.all(2.0)),
76 | Text('// 只要满足以上一条或多条,均可被发表',
77 | style: TextStyle(fontSize: 14.0, color: Colors.green)),
78 | Padding(padding: const EdgeInsets.all(8.0)),
79 | Text(
80 | 'Step1:',
81 | style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold),
82 | ),
83 | Padding(padding: const EdgeInsets.all(2.0)),
84 | Text('请对着神圣的PHP发誓,接下来提交的满足上述其一!',
85 | style: TextStyle(
86 | fontSize: 18.0,
87 | )),
88 | Padding(padding: const EdgeInsets.all(2.0)),
89 | Text('// 如果没有此圣物,请刷新页面',
90 | style: TextStyle(fontSize: 14.0, color: Colors.green)),
91 | Padding(padding: const EdgeInsets.all(8.0)),
92 | Text(
93 | 'Step2:',
94 | style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold),
95 | ),
96 | Padding(padding: const EdgeInsets.all(8.0)),
97 | Row(
98 | children: [
99 | Expanded(
100 | flex: 1,
101 | child: Column(
102 | children: [
103 | Text(
104 | '分类:',
105 | style: TextStyle(
106 | fontSize: 14.0, fontWeight: FontWeight.bold),
107 | ),
108 | DropdownButton(
109 | value: selectCategory,
110 | onChanged: (category) {
111 | setState(() {
112 | selectCategory = category;
113 | });
114 | },
115 | items: categories
116 | .map>((String category) {
117 | return DropdownMenuItem(
118 | value: category,
119 | child: Text(category),
120 | );
121 | }).toList(),
122 | ),
123 | ],
124 | )),
125 | Expanded(
126 | flex: 2,
127 | child: Column(
128 | children: [
129 | Text(
130 | '地址:',
131 | style: TextStyle(
132 | fontSize: 14.0, fontWeight: FontWeight.bold),
133 | ),
134 | TextField(
135 | maxLines: 1,
136 | controller: _controller,
137 | decoration: InputDecoration(hintText: '干货的URL地址'),
138 | ),
139 | ],
140 | )),
141 | ],
142 | ),
143 | Padding(padding: const EdgeInsets.all(8.0)),
144 | Text(
145 | '描述:',
146 | style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold),
147 | ),
148 | Padding(padding: const EdgeInsets.all(2.0)),
149 | TextField(
150 | maxLines: 1,
151 | controller: _controller,
152 | decoration: InputDecoration(
153 | hintText: '不要超过这一行...太长会被人嫌弃,太短会过不了审核,最少15字',
154 | hintStyle: TextStyle(fontSize: 12.0)),
155 | ),
156 | Padding(padding: const EdgeInsets.all(8.0)),
157 | Text(
158 | 'Step3:',
159 | style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold),
160 | ),
161 | Center(
162 | child: RaisedButton(
163 | child: SizedBox(
164 | width: 160.0,
165 | height: 40.0,
166 | child: Center(
167 | child: Text('(๑´∀`๑)发射!'),
168 | ),
169 | ),
170 | onPressed: () {
171 | Fluttertoast.showToast(msg: 'QAQ该功能尚未开发完成');
172 | },
173 | color: Colors.lightBlue,
174 | textColor: Colors.white,
175 | shape: const RoundedRectangleBorder(
176 | borderRadius: BorderRadius.all(Radius.circular(8.0)),
177 | ),
178 | ),
179 | )
180 | ],
181 | ),
182 | );
183 | }
184 | }
185 |
--------------------------------------------------------------------------------
/lib/pages/welfare/WelfarePage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:gank_io/model/Post.dart';
3 | import 'package:gank_io/model/WelfareResult.dart';
4 | import 'package:gank_io/api/Api.dart';
5 | import 'package:gank_io/api/HttpManager.dart';
6 | import 'package:photo_view/photo_view.dart';
7 | import 'package:gank_io/eventbus/DownloadEvent.dart';
8 | import 'package:gank_io/widget/LoadingDialog.dart';
9 | import 'dart:async';
10 |
11 | class WelfarePage extends StatefulWidget {
12 | @override
13 | State createState() => WelfarePageState();
14 | }
15 |
16 | class WelfarePageState extends State {
17 | int _page = 1;
18 | static final int _pageSize = 10;
19 | List _images = List();
20 | ScrollController _controller = new ScrollController();
21 |
22 | @override
23 | void initState() {
24 | super.initState();
25 | _controller.addListener(() {
26 | //最大可滑动距离
27 | var maxScroll = _controller.position.maxScrollExtent;
28 | //当前距离
29 | var pixels = _controller.position.pixels;
30 | //滑动到底部
31 | if (maxScroll == pixels) {
32 | _page++;
33 | _getImages();
34 | }
35 | });
36 | _getImages();
37 | HttpManager.eventBus.on().listen((event) {
38 | if (event.progress == 0) {
39 | showDialog(
40 | context: context,
41 | barrierDismissible: false,
42 | builder: (context) {
43 | return new LoadingDialog(text: '下载中');
44 | });
45 | } else {
46 | Navigator.pop(context);
47 | }
48 | });
49 | }
50 |
51 | @override
52 | void dispose() {
53 | _controller.dispose();
54 | super.dispose();
55 | }
56 |
57 | void _getImages() {
58 | HttpManager.get(Api.WELFARE + '/${_pageSize}/${_page}').then((resultData) {
59 | WelfareResult result = WelfareResult.fromJson(resultData.data);
60 | if (result != null && !result.error) {
61 | setState(() {
62 | if (_page == 1) {
63 | _images.clear();
64 | }
65 | _images.addAll(result.results);
66 | });
67 | }
68 | });
69 | }
70 |
71 | void showPhoto(Post post, BuildContext context) {
72 | Navigator.push(context,
73 | MaterialPageRoute(builder: (BuildContext context) {
74 | return Scaffold(
75 | appBar: AppBar(
76 | title: Text(
77 | '美女福利',
78 | style: TextStyle(color: Colors.white),
79 | ),
80 | centerTitle: true,
81 | iconTheme: IconThemeData(color: Colors.white),
82 | ),
83 | body: GestureDetector(
84 | child: PhotoView(
85 | imageProvider: NetworkImage(post.url),
86 | ),
87 | onLongPress: () {
88 | showDialog(
89 | context: context,
90 | barrierDismissible: false,
91 | builder: (context) {
92 | return new AlertDialog(
93 | content: new Text('确定下载该图片?'),
94 | actions: [
95 | new FlatButton(
96 | onPressed: () {
97 | Navigator.of(context).pop();
98 | },
99 | child: Text('取消')),
100 | new FlatButton(
101 | onPressed: () {
102 | String fileNmae = post.url.split('/').last;
103 | HttpManager.downloadFile(post.url, fileNmae);
104 | Navigator.of(context).pop();
105 | },
106 | child: new Text('确定'))
107 | ],
108 | );
109 | });
110 | },
111 | ),
112 | );
113 | }));
114 | }
115 |
116 | @override
117 | Widget build(BuildContext context) {
118 | Widget _buildItem(Post post) {
119 | return new GestureDetector(
120 | child: Image.network(post.url, fit: BoxFit.cover),
121 | onTap: () {
122 | showPhoto(post, context);
123 | },
124 | );
125 | }
126 |
127 | List _getItemList(List posts) {
128 | List widgets = List();
129 | posts.forEach((post) {
130 | widgets.add(_buildItem(post));
131 | });
132 | return widgets;
133 | }
134 |
135 | Future _pullToRefresh() async {
136 | _page = 1;
137 | _getImages();
138 | return null;
139 | }
140 |
141 | if (_images.length == 0) {
142 | return Center(
143 | //圆形进度条
144 | child: CircularProgressIndicator(),
145 | );
146 | } else {
147 | return RefreshIndicator(
148 | child: GridView.count(
149 | crossAxisCount: 2,
150 | padding: EdgeInsets.all(8.0),
151 | mainAxisSpacing: 8.0, //主轴方向间距 (竖直方向)
152 | crossAxisSpacing: 8.0, //横向间距
153 | primary: false,
154 | children: _getItemList(_images),
155 | controller: _controller,
156 | ),
157 | onRefresh: _pullToRefresh, //必须是返回值是Future 的异步方法
158 | );
159 | }
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/lib/widget/LinkText.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:gank_io/pages/commom/CommomWebPage.dart';
3 |
4 | class LinkText extends StatefulWidget {
5 | String text;
6 | String url;
7 | Color color;
8 |
9 | LinkText(this.text, this.url, this.color, {Key key}) : super(key: key);
10 |
11 | @override
12 | State createState() => LinkTextState();
13 | }
14 |
15 | class LinkTextState extends State {
16 | @override
17 | Widget build(BuildContext context) {
18 | return GestureDetector(
19 | child: Text(
20 | widget.text,
21 | style: TextStyle(
22 | color: widget.color, decoration: TextDecoration.underline),
23 | ),
24 | onTap: () {
25 | Navigator.push(context, MaterialPageRoute(builder: (context) {
26 | return CommomWebPage(widget.text, widget.url);
27 | }));
28 | },
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/lib/widget/LoadingDialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class LoadingDialog extends Dialog {
4 | String text;
5 |
6 | LoadingDialog({Key key, @required this.text}) : super(key: key);
7 |
8 | @override
9 | Widget build(BuildContext context) {
10 | return new Material(
11 | ////创建透明层
12 | type: MaterialType.transparency,
13 | child: new Center(
14 | child: new SizedBox(
15 | //sizebox无界面 确定内部控件大小
16 | width: 120.0,
17 | height: 120.0,
18 | child: new Container(
19 | decoration: ShapeDecoration( //图形装饰器
20 | shape: new RoundedRectangleBorder( //圆角矩形边框
21 | borderRadius: BorderRadius.all(
22 | new Radius.circular(8.0),
23 | ))),
24 | child: new Column(
25 | children: [
26 | new CircularProgressIndicator(),
27 | new Padding(
28 | padding: EdgeInsets.only(top: 20.0),
29 | child: new Text(
30 | text,
31 | style: new TextStyle(fontSize: 12.0),
32 | ),
33 | )
34 | ],
35 | ),
36 | ),
37 | )),
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile
3 | packages:
4 | after_layout:
5 | dependency: transitive
6 | description:
7 | name: after_layout
8 | url: "https://pub.flutter-io.cn"
9 | source: hosted
10 | version: "1.0.4"
11 | analyzer:
12 | dependency: transitive
13 | description:
14 | name: analyzer
15 | url: "https://pub.flutter-io.cn"
16 | source: hosted
17 | version: "0.32.4"
18 | args:
19 | dependency: transitive
20 | description:
21 | name: args
22 | url: "https://pub.flutter-io.cn"
23 | source: hosted
24 | version: "1.5.0"
25 | async:
26 | dependency: transitive
27 | description:
28 | name: async
29 | url: "https://pub.flutter-io.cn"
30 | source: hosted
31 | version: "2.0.8"
32 | boolean_selector:
33 | dependency: transitive
34 | description:
35 | name: boolean_selector
36 | url: "https://pub.flutter-io.cn"
37 | source: hosted
38 | version: "1.0.4"
39 | build:
40 | dependency: transitive
41 | description:
42 | name: build
43 | url: "https://pub.flutter-io.cn"
44 | source: hosted
45 | version: "0.12.8"
46 | build_config:
47 | dependency: transitive
48 | description:
49 | name: build_config
50 | url: "https://pub.flutter-io.cn"
51 | source: hosted
52 | version: "0.3.1+2"
53 | build_resolvers:
54 | dependency: transitive
55 | description:
56 | name: build_resolvers
57 | url: "https://pub.flutter-io.cn"
58 | source: hosted
59 | version: "0.2.2+4"
60 | build_runner:
61 | dependency: "direct dev"
62 | description:
63 | name: build_runner
64 | url: "https://pub.flutter-io.cn"
65 | source: hosted
66 | version: "0.10.3"
67 | build_runner_core:
68 | dependency: transitive
69 | description:
70 | name: build_runner_core
71 | url: "https://pub.flutter-io.cn"
72 | source: hosted
73 | version: "1.0.0"
74 | built_collection:
75 | dependency: transitive
76 | description:
77 | name: built_collection
78 | url: "https://pub.flutter-io.cn"
79 | source: hosted
80 | version: "4.0.0"
81 | built_value:
82 | dependency: transitive
83 | description:
84 | name: built_value
85 | url: "https://pub.flutter-io.cn"
86 | source: hosted
87 | version: "6.1.3"
88 | charcode:
89 | dependency: transitive
90 | description:
91 | name: charcode
92 | url: "https://pub.flutter-io.cn"
93 | source: hosted
94 | version: "1.1.2"
95 | code_builder:
96 | dependency: transitive
97 | description:
98 | name: code_builder
99 | url: "https://pub.flutter-io.cn"
100 | source: hosted
101 | version: "3.1.3"
102 | collection:
103 | dependency: transitive
104 | description:
105 | name: collection
106 | url: "https://pub.flutter-io.cn"
107 | source: hosted
108 | version: "1.14.11"
109 | connectivity:
110 | dependency: "direct main"
111 | description:
112 | name: connectivity
113 | url: "https://pub.flutter-io.cn"
114 | source: hosted
115 | version: "0.3.1"
116 | convert:
117 | dependency: transitive
118 | description:
119 | name: convert
120 | url: "https://pub.flutter-io.cn"
121 | source: hosted
122 | version: "2.0.2"
123 | cookie_jar:
124 | dependency: transitive
125 | description:
126 | name: cookie_jar
127 | url: "https://pub.flutter-io.cn"
128 | source: hosted
129 | version: "0.0.6"
130 | crypto:
131 | dependency: transitive
132 | description:
133 | name: crypto
134 | url: "https://pub.flutter-io.cn"
135 | source: hosted
136 | version: "2.0.6"
137 | csslib:
138 | dependency: transitive
139 | description:
140 | name: csslib
141 | url: "https://pub.flutter-io.cn"
142 | source: hosted
143 | version: "0.14.5"
144 | dart_style:
145 | dependency: transitive
146 | description:
147 | name: dart_style
148 | url: "https://pub.flutter-io.cn"
149 | source: hosted
150 | version: "1.1.3"
151 | dio:
152 | dependency: "direct main"
153 | description:
154 | name: dio
155 | url: "https://pub.flutter-io.cn"
156 | source: hosted
157 | version: "1.0.6"
158 | event_bus:
159 | dependency: "direct main"
160 | description:
161 | name: event_bus
162 | url: "https://pub.flutter-io.cn"
163 | source: hosted
164 | version: "1.0.1"
165 | fixnum:
166 | dependency: transitive
167 | description:
168 | name: fixnum
169 | url: "https://pub.flutter-io.cn"
170 | source: hosted
171 | version: "0.10.8"
172 | flutter:
173 | dependency: "direct main"
174 | description: flutter
175 | source: sdk
176 | version: "0.0.0"
177 | flutter_test:
178 | dependency: "direct dev"
179 | description: flutter
180 | source: sdk
181 | version: "0.0.0"
182 | flutter_webview_plugin:
183 | dependency: "direct main"
184 | description:
185 | name: flutter_webview_plugin
186 | url: "https://pub.flutter-io.cn"
187 | source: hosted
188 | version: "0.2.1+2"
189 | fluttertoast:
190 | dependency: "direct main"
191 | description:
192 | name: fluttertoast
193 | url: "https://pub.flutter-io.cn"
194 | source: hosted
195 | version: "2.0.7"
196 | front_end:
197 | dependency: transitive
198 | description:
199 | name: front_end
200 | url: "https://pub.flutter-io.cn"
201 | source: hosted
202 | version: "0.1.4"
203 | glob:
204 | dependency: transitive
205 | description:
206 | name: glob
207 | url: "https://pub.flutter-io.cn"
208 | source: hosted
209 | version: "1.1.7"
210 | graphs:
211 | dependency: transitive
212 | description:
213 | name: graphs
214 | url: "https://pub.flutter-io.cn"
215 | source: hosted
216 | version: "0.1.2+1"
217 | html:
218 | dependency: transitive
219 | description:
220 | name: html
221 | url: "https://pub.flutter-io.cn"
222 | source: hosted
223 | version: "0.13.3+3"
224 | http:
225 | dependency: transitive
226 | description:
227 | name: http
228 | url: "https://pub.flutter-io.cn"
229 | source: hosted
230 | version: "0.11.3+17"
231 | http_multi_server:
232 | dependency: transitive
233 | description:
234 | name: http_multi_server
235 | url: "https://pub.flutter-io.cn"
236 | source: hosted
237 | version: "2.0.5"
238 | http_parser:
239 | dependency: transitive
240 | description:
241 | name: http_parser
242 | url: "https://pub.flutter-io.cn"
243 | source: hosted
244 | version: "3.1.3"
245 | image_picker:
246 | dependency: "direct main"
247 | description:
248 | name: image_picker
249 | url: "https://pub.flutter-io.cn"
250 | source: hosted
251 | version: "0.4.10"
252 | io:
253 | dependency: transitive
254 | description:
255 | name: io
256 | url: "https://pub.flutter-io.cn"
257 | source: hosted
258 | version: "0.3.3"
259 | js:
260 | dependency: transitive
261 | description:
262 | name: js
263 | url: "https://pub.flutter-io.cn"
264 | source: hosted
265 | version: "0.6.1+1"
266 | json_annotation:
267 | dependency: "direct main"
268 | description:
269 | name: json_annotation
270 | url: "https://pub.flutter-io.cn"
271 | source: hosted
272 | version: "1.2.0"
273 | json_rpc_2:
274 | dependency: transitive
275 | description:
276 | name: json_rpc_2
277 | url: "https://pub.flutter-io.cn"
278 | source: hosted
279 | version: "2.0.9"
280 | json_serializable:
281 | dependency: "direct dev"
282 | description:
283 | name: json_serializable
284 | url: "https://pub.flutter-io.cn"
285 | source: hosted
286 | version: "1.4.0"
287 | kernel:
288 | dependency: transitive
289 | description:
290 | name: kernel
291 | url: "https://pub.flutter-io.cn"
292 | source: hosted
293 | version: "0.3.4"
294 | logging:
295 | dependency: transitive
296 | description:
297 | name: logging
298 | url: "https://pub.flutter-io.cn"
299 | source: hosted
300 | version: "0.11.3+2"
301 | matcher:
302 | dependency: transitive
303 | description:
304 | name: matcher
305 | url: "https://pub.flutter-io.cn"
306 | source: hosted
307 | version: "0.12.3+1"
308 | meta:
309 | dependency: transitive
310 | description:
311 | name: meta
312 | url: "https://pub.flutter-io.cn"
313 | source: hosted
314 | version: "1.1.6"
315 | mime:
316 | dependency: transitive
317 | description:
318 | name: mime
319 | url: "https://pub.flutter-io.cn"
320 | source: hosted
321 | version: "0.9.6+2"
322 | multi_server_socket:
323 | dependency: transitive
324 | description:
325 | name: multi_server_socket
326 | url: "https://pub.flutter-io.cn"
327 | source: hosted
328 | version: "1.0.2"
329 | node_preamble:
330 | dependency: transitive
331 | description:
332 | name: node_preamble
333 | url: "https://pub.flutter-io.cn"
334 | source: hosted
335 | version: "1.4.4"
336 | package_config:
337 | dependency: transitive
338 | description:
339 | name: package_config
340 | url: "https://pub.flutter-io.cn"
341 | source: hosted
342 | version: "1.0.5"
343 | package_resolver:
344 | dependency: transitive
345 | description:
346 | name: package_resolver
347 | url: "https://pub.flutter-io.cn"
348 | source: hosted
349 | version: "1.0.4"
350 | path:
351 | dependency: transitive
352 | description:
353 | name: path
354 | url: "https://pub.flutter-io.cn"
355 | source: hosted
356 | version: "1.6.2"
357 | path_provider:
358 | dependency: "direct main"
359 | description:
360 | name: path_provider
361 | url: "https://pub.flutter-io.cn"
362 | source: hosted
363 | version: "0.4.1"
364 | pedantic:
365 | dependency: transitive
366 | description:
367 | name: pedantic
368 | url: "https://pub.flutter-io.cn"
369 | source: hosted
370 | version: "1.1.0"
371 | photo_view:
372 | dependency: "direct main"
373 | description:
374 | name: photo_view
375 | url: "https://pub.flutter-io.cn"
376 | source: hosted
377 | version: "0.0.8"
378 | plugin:
379 | dependency: transitive
380 | description:
381 | name: plugin
382 | url: "https://pub.flutter-io.cn"
383 | source: hosted
384 | version: "0.2.0+3"
385 | pool:
386 | dependency: transitive
387 | description:
388 | name: pool
389 | url: "https://pub.flutter-io.cn"
390 | source: hosted
391 | version: "1.3.6"
392 | pub_semver:
393 | dependency: transitive
394 | description:
395 | name: pub_semver
396 | url: "https://pub.flutter-io.cn"
397 | source: hosted
398 | version: "1.4.2"
399 | pubspec_parse:
400 | dependency: transitive
401 | description:
402 | name: pubspec_parse
403 | url: "https://pub.flutter-io.cn"
404 | source: hosted
405 | version: "0.1.2+2"
406 | quiver:
407 | dependency: transitive
408 | description:
409 | name: quiver
410 | url: "https://pub.flutter-io.cn"
411 | source: hosted
412 | version: "2.0.0+1"
413 | shelf:
414 | dependency: transitive
415 | description:
416 | name: shelf
417 | url: "https://pub.flutter-io.cn"
418 | source: hosted
419 | version: "0.7.3+3"
420 | shelf_packages_handler:
421 | dependency: transitive
422 | description:
423 | name: shelf_packages_handler
424 | url: "https://pub.flutter-io.cn"
425 | source: hosted
426 | version: "1.0.4"
427 | shelf_static:
428 | dependency: transitive
429 | description:
430 | name: shelf_static
431 | url: "https://pub.flutter-io.cn"
432 | source: hosted
433 | version: "0.2.8"
434 | shelf_web_socket:
435 | dependency: transitive
436 | description:
437 | name: shelf_web_socket
438 | url: "https://pub.flutter-io.cn"
439 | source: hosted
440 | version: "0.2.2+4"
441 | simple_permissions:
442 | dependency: "direct main"
443 | description:
444 | name: simple_permissions
445 | url: "https://pub.flutter-io.cn"
446 | source: hosted
447 | version: "0.1.8"
448 | sky_engine:
449 | dependency: transitive
450 | description: flutter
451 | source: sdk
452 | version: "0.0.99"
453 | source_gen:
454 | dependency: transitive
455 | description:
456 | name: source_gen
457 | url: "https://pub.flutter-io.cn"
458 | source: hosted
459 | version: "0.9.1"
460 | source_map_stack_trace:
461 | dependency: transitive
462 | description:
463 | name: source_map_stack_trace
464 | url: "https://pub.flutter-io.cn"
465 | source: hosted
466 | version: "1.1.5"
467 | source_maps:
468 | dependency: transitive
469 | description:
470 | name: source_maps
471 | url: "https://pub.flutter-io.cn"
472 | source: hosted
473 | version: "0.10.7"
474 | source_span:
475 | dependency: transitive
476 | description:
477 | name: source_span
478 | url: "https://pub.flutter-io.cn"
479 | source: hosted
480 | version: "1.4.1"
481 | stack_trace:
482 | dependency: transitive
483 | description:
484 | name: stack_trace
485 | url: "https://pub.flutter-io.cn"
486 | source: hosted
487 | version: "1.9.3"
488 | stream_channel:
489 | dependency: transitive
490 | description:
491 | name: stream_channel
492 | url: "https://pub.flutter-io.cn"
493 | source: hosted
494 | version: "1.6.8"
495 | stream_transform:
496 | dependency: transitive
497 | description:
498 | name: stream_transform
499 | url: "https://pub.flutter-io.cn"
500 | source: hosted
501 | version: "0.0.14+1"
502 | string_scanner:
503 | dependency: transitive
504 | description:
505 | name: string_scanner
506 | url: "https://pub.flutter-io.cn"
507 | source: hosted
508 | version: "1.0.4"
509 | term_glyph:
510 | dependency: transitive
511 | description:
512 | name: term_glyph
513 | url: "https://pub.flutter-io.cn"
514 | source: hosted
515 | version: "1.0.1"
516 | test:
517 | dependency: transitive
518 | description:
519 | name: test
520 | url: "https://pub.flutter-io.cn"
521 | source: hosted
522 | version: "1.3.0"
523 | timing:
524 | dependency: transitive
525 | description:
526 | name: timing
527 | url: "https://pub.flutter-io.cn"
528 | source: hosted
529 | version: "0.1.1"
530 | typed_data:
531 | dependency: transitive
532 | description:
533 | name: typed_data
534 | url: "https://pub.flutter-io.cn"
535 | source: hosted
536 | version: "1.1.6"
537 | utf:
538 | dependency: transitive
539 | description:
540 | name: utf
541 | url: "https://pub.flutter-io.cn"
542 | source: hosted
543 | version: "0.9.0+5"
544 | vector_math:
545 | dependency: transitive
546 | description:
547 | name: vector_math
548 | url: "https://pub.flutter-io.cn"
549 | source: hosted
550 | version: "2.0.8"
551 | vm_service_client:
552 | dependency: transitive
553 | description:
554 | name: vm_service_client
555 | url: "https://pub.flutter-io.cn"
556 | source: hosted
557 | version: "0.2.6"
558 | watcher:
559 | dependency: transitive
560 | description:
561 | name: watcher
562 | url: "https://pub.flutter-io.cn"
563 | source: hosted
564 | version: "0.9.7+10"
565 | web_socket_channel:
566 | dependency: transitive
567 | description:
568 | name: web_socket_channel
569 | url: "https://pub.flutter-io.cn"
570 | source: hosted
571 | version: "1.0.9"
572 | yaml:
573 | dependency: transitive
574 | description:
575 | name: yaml
576 | url: "https://pub.flutter-io.cn"
577 | source: hosted
578 | version: "2.1.15"
579 | sdks:
580 | dart: ">=2.0.0 <3.0.0"
581 | flutter: ">=0.1.4 <2.0.0"
582 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: gank_io
2 | description: a flutter gank.io app
3 |
4 | # The following defines the version and build number for your application.
5 | # A version number is three numbers separated by dots, like 1.2.43
6 | # followed by an optional build number separated by a +.
7 | # Both the version and the builder number may be overridden in flutter
8 | # build by specifying --build-name and --build-number, respectively.
9 | # Read more about versioning at semver.org.
10 | version: 1.0.0+1
11 |
12 | environment:
13 | sdk: ">=2.0.0-dev.68.0 <3.0.0"
14 |
15 | dependencies:
16 | flutter:
17 | sdk: flutter
18 |
19 | dio: ^1.0.6
20 | connectivity: ^0.3.1
21 | event_bus: ^1.0.1
22 | json_annotation: ^1.2.0
23 | fluttertoast: ^2.0.7
24 | flutter_webview_plugin: ^0.2.1+2
25 | photo_view: ^0.0.8
26 | path_provider: ^0.4.1
27 | simple_permissions: ^0.1.8
28 | image_picker: ^0.4.10
29 |
30 |
31 | # The following adds the Cupertino Icons font to your application.
32 | # Use with the CupertinoIcons class for iOS style icons.
33 |
34 |
35 | dev_dependencies:
36 | flutter_test:
37 | sdk: flutter
38 | build_runner: ^0.10.2
39 | json_serializable: ^1.4.0
40 |
41 |
42 |
43 |
44 |
45 | # For information on the generic Dart part of this file, see the
46 | # following page: https://www.dartlang.org/tools/pub/pubspec
47 |
48 | # The following section is specific to Flutter.
49 | flutter:
50 |
51 | # The following line ensures that the Material Icons font is
52 | # included with your application, so that you can use the icons in
53 | # the material Icons class.
54 | uses-material-design: true
55 | assets:
56 | - images/header.jpg
57 | - images/ic_launcher.png
58 |
59 | # To add assets to your application, add an assets section, like this:
60 | # assets:
61 | # - images/a_dot_burr.jpeg
62 | # - images/a_dot_ham.jpeg
63 |
64 | # An image asset can refer to one or more resolution-specific "variants", see
65 | # https://flutter.io/assets-and-images/#resolution-aware.
66 |
67 | # For details regarding adding assets from package dependencies, see
68 | # https://flutter.io/assets-and-images/#from-packages
69 |
70 | # To add custom fonts to your application, add a fonts section here,
71 | # in this "flutter" section. Each entry in this list should have a
72 | # "family" key with the font family name, and a "fonts" key with a
73 | # list giving the asset and other descriptors for the font. For
74 | # example:
75 | # fonts:
76 | # - family: Schyler
77 | # fonts:
78 | # - asset: fonts/Schyler-Regular.ttf
79 | # - asset: fonts/Schyler-Italic.ttf
80 | # style: italic
81 | # - family: Trajan Pro
82 | # fonts:
83 | # - asset: fonts/TrajanPro.ttf
84 | # - asset: fonts/TrajanPro_Bold.ttf
85 | # weight: 700
86 | #
87 | # For details regarding fonts from package dependencies,
88 | # see https://flutter.io/custom-fonts/#from-packages
89 |
--------------------------------------------------------------------------------
/screenshot/Screenshot_1539675517.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/screenshot/Screenshot_1539675517.png
--------------------------------------------------------------------------------
/screenshot/Screenshot_1539675604.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/screenshot/Screenshot_1539675604.png
--------------------------------------------------------------------------------
/screenshot/Screenshot_1539675631.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/screenshot/Screenshot_1539675631.png
--------------------------------------------------------------------------------
/screenshot/Screenshot_1539675636.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/screenshot/Screenshot_1539675636.png
--------------------------------------------------------------------------------
/screenshot/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/txy199292/gank_io/b75719526dcd45be56210d12a54c8dba980e301a/screenshot/download.png
--------------------------------------------------------------------------------
/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:gank_io/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 |
--------------------------------------------------------------------------------