├── .gitattributes
├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── libraries
│ ├── Dart_Packages.xml
│ ├── Dart_SDK.xml
│ ├── Flutter_Plugins.xml
│ └── Flutter_for_Android.xml
├── misc.xml
├── modules.xml
├── runConfigurations
│ └── main_dart.xml
└── workspace.xml
├── .metadata
├── README.md
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── fluttermvvmexample
│ │ │ └── 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
├── flutter_mvvm_example.iml
├── flutter_mvvm_example_android.iml
├── fonts
└── DISTGRG_.ttf
├── 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
├── interfaces
│ └── i_star_wars_api.dart
├── main.dart
├── mocks
│ └── mocks.dart
├── models
│ ├── character.dart
│ ├── film.dart
│ └── planet.dart
├── services
│ └── swapi_service.dart
├── utils
│ └── star_wars_styles.dart
├── view_models
│ └── main_page_view_model.dart
└── views
│ ├── pages
│ └── main_page.dart
│ └── widgets
│ ├── characters_list_item.dart
│ ├── characters_panel.dart
│ ├── films_list_item.dart
│ ├── films_panel.dart
│ ├── no_internet_connection.dart
│ ├── planets_list_item.dart
│ └── planets_panel.dart
├── pubspec.yaml
└── test
├── main_page_view_model_test.dart
├── star_wars_api_test.dart
├── swapi_service_test.dart
└── widget_tests.dart
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 | pubspec.lock
9 | .flutter-plugins
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/libraries/Dart_Packages.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
--------------------------------------------------------------------------------
/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_Plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_for_Android.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/main_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
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 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 | 1534594648532
179 |
180 |
181 | 1534594648532
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
--------------------------------------------------------------------------------
/.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: c7ea3ca377e909469c68f2ab878a5bc53d3cf66b
8 | channel: beta
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # flutter_mvvm_example
2 |
3 |  
4 |
5 | This project demonstrates how to implement the MVVM pattern in Flutter using [scoped_model](https://pub.dartlang.org/packages/scoped_model).
6 |
7 | You can read the associated article for this project [here](https://www.codeproject.com/Articles/1257076/MVVM-in-Flutter-using-ScopedModel).
8 |
9 | ## Acknowledgements
10 | - [scoped_model](https://pub.dartlang.org/packages/scoped_model)
11 | - [font_awesome_flutter](https://pub.dartlang.org/packages/font_awesome_flutter)
12 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 | GeneratedPluginRegistrant.java
11 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | apply plugin: 'com.android.application'
15 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
16 |
17 | android {
18 | compileSdkVersion 27
19 |
20 | lintOptions {
21 | disable 'InvalidPackage'
22 | }
23 |
24 | defaultConfig {
25 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
26 | applicationId "com.example.fluttermvvmexample"
27 | minSdkVersion 16
28 | targetSdkVersion 27
29 | versionCode 1
30 | versionName "1.0"
31 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
32 | }
33 |
34 | buildTypes {
35 | release {
36 | // TODO: Add your own signing config for the release build.
37 | // Signing with the debug keys for now, so `flutter run --release` works.
38 | signingConfig signingConfigs.debug
39 | }
40 | }
41 | }
42 |
43 | flutter {
44 | source '../..'
45 | }
46 |
47 | dependencies {
48 | testImplementation 'junit:junit:4.12'
49 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
50 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
51 | }
52 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
15 |
19 |
26 |
30 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/example/fluttermvvmexample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.fluttermvvmexample;
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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.0.1'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | }
17 | }
18 |
19 | rootProject.buildDir = '../build'
20 | subprojects {
21 | project.buildDir = "${rootProject.buildDir}/${project.name}"
22 | }
23 | subprojects {
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/flutter_mvvm_example.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/flutter_mvvm_example_android.iml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/fonts/DISTGRG_.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/fonts/DISTGRG_.ttf
--------------------------------------------------------------------------------
/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 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
19 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
20 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
21 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
22 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
23 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
24 | /* End PBXBuildFile section */
25 |
26 | /* Begin PBXCopyFilesBuildPhase section */
27 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
28 | isa = PBXCopyFilesBuildPhase;
29 | buildActionMask = 2147483647;
30 | dstPath = "";
31 | dstSubfolderSpec = 10;
32 | files = (
33 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
34 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
35 | );
36 | name = "Embed Frameworks";
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXCopyFilesBuildPhase section */
40 |
41 | /* Begin PBXFileReference section */
42 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
43 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
44 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
45 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
46 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
47 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
48 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
49 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
50 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
51 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
52 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
53 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
54 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
55 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
56 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
57 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
58 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
59 | /* End PBXFileReference section */
60 |
61 | /* Begin PBXFrameworksBuildPhase section */
62 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
63 | isa = PBXFrameworksBuildPhase;
64 | buildActionMask = 2147483647;
65 | files = (
66 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
67 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
68 | );
69 | runOnlyForDeploymentPostprocessing = 0;
70 | };
71 | /* End PBXFrameworksBuildPhase section */
72 |
73 | /* Begin PBXGroup section */
74 | 9740EEB11CF90186004384FC /* Flutter */ = {
75 | isa = PBXGroup;
76 | children = (
77 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
78 | 3B80C3931E831B6300D905FE /* App.framework */,
79 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
80 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
81 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
82 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
83 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
84 | );
85 | name = Flutter;
86 | sourceTree = "";
87 | };
88 | 97C146E51CF9000F007C117D = {
89 | isa = PBXGroup;
90 | children = (
91 | 9740EEB11CF90186004384FC /* Flutter */,
92 | 97C146F01CF9000F007C117D /* Runner */,
93 | 97C146EF1CF9000F007C117D /* Products */,
94 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
95 | );
96 | sourceTree = "";
97 | };
98 | 97C146EF1CF9000F007C117D /* Products */ = {
99 | isa = PBXGroup;
100 | children = (
101 | 97C146EE1CF9000F007C117D /* Runner.app */,
102 | );
103 | name = Products;
104 | sourceTree = "";
105 | };
106 | 97C146F01CF9000F007C117D /* Runner */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
110 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
111 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
112 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
113 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
114 | 97C147021CF9000F007C117D /* Info.plist */,
115 | 97C146F11CF9000F007C117D /* Supporting Files */,
116 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
117 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
118 | );
119 | path = Runner;
120 | sourceTree = "";
121 | };
122 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
123 | isa = PBXGroup;
124 | children = (
125 | 97C146F21CF9000F007C117D /* main.m */,
126 | );
127 | name = "Supporting Files";
128 | sourceTree = "";
129 | };
130 | /* End PBXGroup section */
131 |
132 | /* Begin PBXNativeTarget section */
133 | 97C146ED1CF9000F007C117D /* Runner */ = {
134 | isa = PBXNativeTarget;
135 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
136 | buildPhases = (
137 | 9740EEB61CF901F6004384FC /* Run Script */,
138 | 97C146EA1CF9000F007C117D /* Sources */,
139 | 97C146EB1CF9000F007C117D /* Frameworks */,
140 | 97C146EC1CF9000F007C117D /* Resources */,
141 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
142 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
143 | );
144 | buildRules = (
145 | );
146 | dependencies = (
147 | );
148 | name = Runner;
149 | productName = Runner;
150 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
151 | productType = "com.apple.product-type.application";
152 | };
153 | /* End PBXNativeTarget section */
154 |
155 | /* Begin PBXProject section */
156 | 97C146E61CF9000F007C117D /* Project object */ = {
157 | isa = PBXProject;
158 | attributes = {
159 | LastUpgradeCheck = 0910;
160 | ORGANIZATIONNAME = "The Chromium Authors";
161 | TargetAttributes = {
162 | 97C146ED1CF9000F007C117D = {
163 | CreatedOnToolsVersion = 7.3.1;
164 | };
165 | };
166 | };
167 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
168 | compatibilityVersion = "Xcode 3.2";
169 | developmentRegion = English;
170 | hasScannedForEncodings = 0;
171 | knownRegions = (
172 | en,
173 | Base,
174 | );
175 | mainGroup = 97C146E51CF9000F007C117D;
176 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
177 | projectDirPath = "";
178 | projectRoot = "";
179 | targets = (
180 | 97C146ED1CF9000F007C117D /* Runner */,
181 | );
182 | };
183 | /* End PBXProject section */
184 |
185 | /* Begin PBXResourcesBuildPhase section */
186 | 97C146EC1CF9000F007C117D /* Resources */ = {
187 | isa = PBXResourcesBuildPhase;
188 | buildActionMask = 2147483647;
189 | files = (
190 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
191 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
192 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
193 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
194 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
195 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
196 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
197 | );
198 | runOnlyForDeploymentPostprocessing = 0;
199 | };
200 | /* End PBXResourcesBuildPhase section */
201 |
202 | /* Begin PBXShellScriptBuildPhase section */
203 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
204 | isa = PBXShellScriptBuildPhase;
205 | buildActionMask = 2147483647;
206 | files = (
207 | );
208 | inputPaths = (
209 | );
210 | name = "Thin Binary";
211 | outputPaths = (
212 | );
213 | runOnlyForDeploymentPostprocessing = 0;
214 | shellPath = /bin/sh;
215 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
216 | };
217 | 9740EEB61CF901F6004384FC /* Run Script */ = {
218 | isa = PBXShellScriptBuildPhase;
219 | buildActionMask = 2147483647;
220 | files = (
221 | );
222 | inputPaths = (
223 | );
224 | name = "Run Script";
225 | outputPaths = (
226 | );
227 | runOnlyForDeploymentPostprocessing = 0;
228 | shellPath = /bin/sh;
229 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
230 | };
231 | /* End PBXShellScriptBuildPhase section */
232 |
233 | /* Begin PBXSourcesBuildPhase section */
234 | 97C146EA1CF9000F007C117D /* Sources */ = {
235 | isa = PBXSourcesBuildPhase;
236 | buildActionMask = 2147483647;
237 | files = (
238 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
239 | 97C146F31CF9000F007C117D /* main.m in Sources */,
240 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
241 | );
242 | runOnlyForDeploymentPostprocessing = 0;
243 | };
244 | /* End PBXSourcesBuildPhase section */
245 |
246 | /* Begin PBXVariantGroup section */
247 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
248 | isa = PBXVariantGroup;
249 | children = (
250 | 97C146FB1CF9000F007C117D /* Base */,
251 | );
252 | name = Main.storyboard;
253 | sourceTree = "";
254 | };
255 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
256 | isa = PBXVariantGroup;
257 | children = (
258 | 97C147001CF9000F007C117D /* Base */,
259 | );
260 | name = LaunchScreen.storyboard;
261 | sourceTree = "";
262 | };
263 | /* End PBXVariantGroup section */
264 |
265 | /* Begin XCBuildConfiguration section */
266 | 97C147031CF9000F007C117D /* Debug */ = {
267 | isa = XCBuildConfiguration;
268 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
269 | buildSettings = {
270 | ALWAYS_SEARCH_USER_PATHS = NO;
271 | CLANG_ANALYZER_NONNULL = YES;
272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
273 | CLANG_CXX_LIBRARY = "libc++";
274 | CLANG_ENABLE_MODULES = YES;
275 | CLANG_ENABLE_OBJC_ARC = YES;
276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
277 | CLANG_WARN_BOOL_CONVERSION = YES;
278 | CLANG_WARN_COMMA = YES;
279 | CLANG_WARN_CONSTANT_CONVERSION = YES;
280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
281 | CLANG_WARN_EMPTY_BODY = YES;
282 | CLANG_WARN_ENUM_CONVERSION = YES;
283 | CLANG_WARN_INFINITE_RECURSION = YES;
284 | CLANG_WARN_INT_CONVERSION = YES;
285 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
286 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
287 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
288 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
289 | CLANG_WARN_STRICT_PROTOTYPES = YES;
290 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
291 | CLANG_WARN_UNREACHABLE_CODE = YES;
292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
293 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
294 | COPY_PHASE_STRIP = NO;
295 | DEBUG_INFORMATION_FORMAT = dwarf;
296 | ENABLE_STRICT_OBJC_MSGSEND = YES;
297 | ENABLE_TESTABILITY = YES;
298 | GCC_C_LANGUAGE_STANDARD = gnu99;
299 | GCC_DYNAMIC_NO_PIC = NO;
300 | GCC_NO_COMMON_BLOCKS = YES;
301 | GCC_OPTIMIZATION_LEVEL = 0;
302 | GCC_PREPROCESSOR_DEFINITIONS = (
303 | "DEBUG=1",
304 | "$(inherited)",
305 | );
306 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
307 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
308 | GCC_WARN_UNDECLARED_SELECTOR = YES;
309 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
310 | GCC_WARN_UNUSED_FUNCTION = YES;
311 | GCC_WARN_UNUSED_VARIABLE = YES;
312 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
313 | MTL_ENABLE_DEBUG_INFO = YES;
314 | ONLY_ACTIVE_ARCH = YES;
315 | SDKROOT = iphoneos;
316 | TARGETED_DEVICE_FAMILY = "1,2";
317 | };
318 | name = Debug;
319 | };
320 | 97C147041CF9000F007C117D /* Release */ = {
321 | isa = XCBuildConfiguration;
322 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
323 | buildSettings = {
324 | ALWAYS_SEARCH_USER_PATHS = NO;
325 | CLANG_ANALYZER_NONNULL = YES;
326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
327 | CLANG_CXX_LIBRARY = "libc++";
328 | CLANG_ENABLE_MODULES = YES;
329 | CLANG_ENABLE_OBJC_ARC = YES;
330 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
331 | CLANG_WARN_BOOL_CONVERSION = YES;
332 | CLANG_WARN_COMMA = YES;
333 | CLANG_WARN_CONSTANT_CONVERSION = YES;
334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
335 | CLANG_WARN_EMPTY_BODY = YES;
336 | CLANG_WARN_ENUM_CONVERSION = YES;
337 | CLANG_WARN_INFINITE_RECURSION = YES;
338 | CLANG_WARN_INT_CONVERSION = YES;
339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
340 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
341 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
342 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
343 | CLANG_WARN_STRICT_PROTOTYPES = YES;
344 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
345 | CLANG_WARN_UNREACHABLE_CODE = YES;
346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
348 | COPY_PHASE_STRIP = NO;
349 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
350 | ENABLE_NS_ASSERTIONS = NO;
351 | ENABLE_STRICT_OBJC_MSGSEND = YES;
352 | GCC_C_LANGUAGE_STANDARD = gnu99;
353 | GCC_NO_COMMON_BLOCKS = YES;
354 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
355 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
356 | GCC_WARN_UNDECLARED_SELECTOR = YES;
357 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
358 | GCC_WARN_UNUSED_FUNCTION = YES;
359 | GCC_WARN_UNUSED_VARIABLE = YES;
360 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
361 | MTL_ENABLE_DEBUG_INFO = NO;
362 | SDKROOT = iphoneos;
363 | TARGETED_DEVICE_FAMILY = "1,2";
364 | VALIDATE_PRODUCT = YES;
365 | };
366 | name = Release;
367 | };
368 | 97C147061CF9000F007C117D /* Debug */ = {
369 | isa = XCBuildConfiguration;
370 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
371 | buildSettings = {
372 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
373 | CURRENT_PROJECT_VERSION = 1;
374 | ENABLE_BITCODE = NO;
375 | FRAMEWORK_SEARCH_PATHS = (
376 | "$(inherited)",
377 | "$(PROJECT_DIR)/Flutter",
378 | );
379 | INFOPLIST_FILE = Runner/Info.plist;
380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
381 | LIBRARY_SEARCH_PATHS = (
382 | "$(inherited)",
383 | "$(PROJECT_DIR)/Flutter",
384 | );
385 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterMvvmExample;
386 | PRODUCT_NAME = "$(TARGET_NAME)";
387 | VERSIONING_SYSTEM = "apple-generic";
388 | };
389 | name = Debug;
390 | };
391 | 97C147071CF9000F007C117D /* Release */ = {
392 | isa = XCBuildConfiguration;
393 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
394 | buildSettings = {
395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
396 | CURRENT_PROJECT_VERSION = 1;
397 | ENABLE_BITCODE = NO;
398 | FRAMEWORK_SEARCH_PATHS = (
399 | "$(inherited)",
400 | "$(PROJECT_DIR)/Flutter",
401 | );
402 | INFOPLIST_FILE = Runner/Info.plist;
403 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
404 | LIBRARY_SEARCH_PATHS = (
405 | "$(inherited)",
406 | "$(PROJECT_DIR)/Flutter",
407 | );
408 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterMvvmExample;
409 | PRODUCT_NAME = "$(TARGET_NAME)";
410 | VERSIONING_SYSTEM = "apple-generic";
411 | };
412 | name = Release;
413 | };
414 | /* End XCBuildConfiguration section */
415 |
416 | /* Begin XCConfigurationList section */
417 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
418 | isa = XCConfigurationList;
419 | buildConfigurations = (
420 | 97C147031CF9000F007C117D /* Debug */,
421 | 97C147041CF9000F007C117D /* Release */,
422 | );
423 | defaultConfigurationIsVisible = 0;
424 | defaultConfigurationName = Release;
425 | };
426 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
427 | isa = XCConfigurationList;
428 | buildConfigurations = (
429 | 97C147061CF9000F007C117D /* Debug */,
430 | 97C147071CF9000F007C117D /* Release */,
431 | );
432 | defaultConfigurationIsVisible = 0;
433 | defaultConfigurationName = Release;
434 | };
435 | /* End XCConfigurationList section */
436 | };
437 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
438 | }
439 |
--------------------------------------------------------------------------------
/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MeshackMusundi/flutter_mvvm_example/3da37058b7f00c3af12639298a140e2f57082bbe/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 | flutter_mvvm_example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | 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/interfaces/i_star_wars_api.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:flutter_mvvm_example/models/character.dart';
3 | import 'package:flutter_mvvm_example/models/film.dart';
4 | import 'package:flutter_mvvm_example/models/planet.dart';
5 |
6 | abstract class IStarWarsApi {
7 | Future> getFilms();
8 | Future> getCharacters();
9 | Future> getPlanets();
10 | }
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_mvvm_example/services/swapi_service.dart';
3 | import 'package:flutter_mvvm_example/view_models/main_page_view_model.dart';
4 | import 'package:flutter_mvvm_example/views/pages/main_page.dart';
5 |
6 | final MainPageViewModel mainPageVM = MainPageViewModel(apiSvc: SwapiService());
7 |
8 | void main() => runApp(MvvmApp(mainPageVM: mainPageVM));
9 |
10 | class MvvmApp extends StatelessWidget {
11 | final MainPageViewModel mainPageVM;
12 |
13 | MvvmApp({@required this.mainPageVM});
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return new MaterialApp(
18 | title: 'Flutter MVVM Demo',
19 | theme: new ThemeData(
20 | primaryColor: Color(0xff070707),
21 | primaryColorLight: Color(0xff0a0a0a),
22 | primaryColorDark: Color(0xff000000),
23 | ),
24 | home: MainPage(viewModel: mainPageVM),
25 | debugShowCheckedModeBanner: false,
26 | );
27 | }
28 | }
--------------------------------------------------------------------------------
/lib/mocks/mocks.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_mvvm_example/interfaces/i_star_wars_api.dart';
2 | import 'package:mockito/mockito.dart';
3 | import 'package:http/http.dart' as http;
4 |
5 | class MockClient extends Mock implements http.Client {}
6 | class MockSwapiService extends Mock implements IStarWarsApi {}
--------------------------------------------------------------------------------
/lib/models/character.dart:
--------------------------------------------------------------------------------
1 | class Character {
2 | String name, birthYear, gender, eyeColor;
3 | int height;
4 |
5 | Character({
6 | this.name,
7 | this.birthYear,
8 | this.gender,
9 | this.height,
10 | this.eyeColor,
11 | });
12 |
13 | Character.fromMap(Map map) {
14 | name = map['name'];
15 | birthYear = map['birth_year'];
16 | gender = map['gender'];
17 | height = int.parse(map['height']);
18 | eyeColor = map['eye_color'];
19 | }
20 | }
--------------------------------------------------------------------------------
/lib/models/film.dart:
--------------------------------------------------------------------------------
1 | class Film {
2 | String title, openingCrawl, director, producer;
3 | DateTime releaseDate;
4 |
5 | Film({
6 | this.title,
7 | this.openingCrawl,
8 | this.director,
9 | this.producer,
10 | this.releaseDate,
11 | });
12 |
13 | Film.fromMap(Map map) {
14 | title = map['title'];
15 | openingCrawl = map['opening_crawl'];
16 | director = map['director'];
17 | producer = map['producer'];
18 | releaseDate = DateTime.parse(map['release_date']);
19 | }
20 | }
--------------------------------------------------------------------------------
/lib/models/planet.dart:
--------------------------------------------------------------------------------
1 | class Planet {
2 | String name, climate, terrain, gravity, population;
3 | int diameter;
4 |
5 | Planet({
6 | this.name,
7 | this.climate,
8 | this.terrain,
9 | this.diameter,
10 | this.gravity,
11 | this.population,
12 | });
13 |
14 | Planet.fromMap(Map map) {
15 | name = map['name'];
16 | climate = map['climate'];
17 | terrain = map['terrain'];
18 | diameter = int.parse(map['diameter']);
19 | gravity = map['gravity'];
20 | population = map['population'];
21 | }
22 | }
--------------------------------------------------------------------------------
/lib/services/swapi_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:convert';
3 | import 'package:http/http.dart' as http;
4 | import 'package:flutter_mvvm_example/interfaces/i_star_wars_api.dart';
5 | import 'package:flutter_mvvm_example/models/character.dart';
6 | import 'package:flutter_mvvm_example/models/film.dart';
7 | import 'package:flutter_mvvm_example/models/planet.dart';
8 |
9 | class SwapiService implements IStarWarsApi {
10 | final _baseUrl = 'https://swapi.co/api';
11 | http.Client _client = http.Client();
12 |
13 | set client(http.Client value) => _client = value;
14 |
15 | static final SwapiService _internal = SwapiService.internal();
16 | factory SwapiService() => _internal;
17 | SwapiService.internal();
18 |
19 | Future> getFilms() async {
20 | var response = await _client.get('$_baseUrl/films');
21 |
22 | if (response.statusCode == 200) {
23 | var data = json.decode(response.body);
24 |
25 | List filmsData = data['results'];
26 | List films = filmsData.map((f) => Film.fromMap(f)).toList();
27 |
28 | return films;
29 | } else {
30 | throw Exception('Failed to get data');
31 | }
32 | }
33 |
34 | Future> getCharacters() async {
35 | var response = await _client.get('$_baseUrl/people');
36 |
37 | if (response.statusCode == 200) {
38 | var data = json.decode(response.body);
39 |
40 | List charactersData = data['results'];
41 | List characters =
42 | charactersData.map((c) => Character.fromMap(c)).toList();
43 |
44 | return characters;
45 | } else {
46 | throw Exception('Failed to get data');
47 | }
48 | }
49 |
50 | Future> getPlanets() async {
51 | var response = await _client.get('$_baseUrl/planets');
52 |
53 | if (response.statusCode == 200) {
54 | var data = json.decode(response.body);
55 |
56 | List planetsData = data['results'];
57 | List planets = planetsData.map((p) => Planet.fromMap(p)).toList();
58 |
59 | return planets;
60 | } else {
61 | throw Exception('Failed to get data');
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/lib/utils/star_wars_styles.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class StarWarsStyles {
4 | static final double titleFontSize = 16.0;
5 | static final double subTitleFontSize = 14.0;
6 | static final Color titleColor = Colors.black.withAlpha(220);
7 | static final Color subTitleColor = Colors.black87;
8 | }
--------------------------------------------------------------------------------
/lib/view_models/main_page_view_model.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:meta/meta.dart';
3 | import 'package:flutter_mvvm_example/interfaces/i_star_wars_api.dart';
4 | import 'package:scoped_model/scoped_model.dart';
5 | import 'package:flutter_mvvm_example/models/film.dart';
6 | import 'package:flutter_mvvm_example/models/character.dart';
7 | import 'package:flutter_mvvm_example/models/planet.dart';
8 |
9 | class MainPageViewModel extends Model {
10 | Future> _films;
11 | Future> get films => _films;
12 | set films(Future> value) {
13 | _films = value;
14 | notifyListeners();
15 | }
16 |
17 | Future> _characters;
18 | Future> get characters => _characters;
19 | set characters(Future> value) {
20 | _characters = value;
21 | notifyListeners();
22 | }
23 |
24 | Future> _planets;
25 | Future> get planets => _planets;
26 | set planets(Future> value) {
27 | _planets = value;
28 | notifyListeners();
29 | }
30 |
31 | final IStarWarsApi apiSvc;
32 |
33 | MainPageViewModel({@required this.apiSvc});
34 |
35 | Future setFilms() async {
36 | films = apiSvc?.getFilms();
37 | return films != null;
38 | }
39 |
40 | Future setCharacters() async {
41 | characters = apiSvc?.getCharacters();
42 | return characters != null;
43 | }
44 |
45 | Future setPlanets() async {
46 | planets = apiSvc?.getPlanets();
47 | return planets != null;
48 | }
49 | }
--------------------------------------------------------------------------------
/lib/views/pages/main_page.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_mvvm_example/view_models/main_page_view_model.dart';
4 | import 'package:flutter_mvvm_example/views/widgets/characters_panel.dart';
5 | import 'package:flutter_mvvm_example/views/widgets/films_panel.dart';
6 | import 'package:flutter_mvvm_example/views/widgets/planets_panel.dart';
7 | import 'package:scoped_model/scoped_model.dart';
8 | import 'package:font_awesome_flutter/font_awesome_flutter.dart';
9 |
10 | class MainPage extends StatefulWidget {
11 | final MainPageViewModel viewModel;
12 |
13 | MainPage({Key key, @required this.viewModel}) : super(key: key);
14 |
15 | @override
16 | _MainPageState createState() => _MainPageState();
17 | }
18 |
19 | class _MainPageState extends State with SingleTickerProviderStateMixin {
20 | TabController tabController;
21 |
22 | Future loadData() async {
23 | await widget.viewModel.setFilms();
24 | await widget.viewModel.setCharacters();
25 | await widget.viewModel.setPlanets();
26 | }
27 |
28 | @override
29 | void initState() {
30 | super.initState();
31 | tabController = TabController(vsync: this, length: 3);
32 | loadData();
33 | }
34 |
35 | @override
36 | Widget build(BuildContext context) {
37 | return Scaffold(
38 | appBar: AppBar(
39 | centerTitle: true,
40 | title: Text(
41 | 'Star Wars',
42 | style: TextStyle(
43 | fontFamily: 'Distant Galaxy',
44 | ),
45 | ),
46 | bottom: TabBar(
47 | controller: tabController,
48 | indicatorColor: Colors.white,
49 | indicatorWeight: 3.0,
50 | tabs: [
51 | Tab(icon: Icon(FontAwesomeIcons.film)),
52 | Tab(icon: Icon(FontAwesomeIcons.users)),
53 | Tab(icon: Icon(FontAwesomeIcons.globeAmericas))
54 | ],
55 | ),
56 | ),
57 | body: ScopedModel(
58 | model: widget.viewModel,
59 | child: TabBarView(
60 | controller: tabController,
61 | children: [
62 | FilmsPanel(),
63 | CharactersPanel(),
64 | PlanetsPanel(),
65 | ],
66 | ),
67 | ),
68 | );
69 | }
70 |
71 | @override
72 | void dispose() {
73 | tabController?.dispose();
74 | super.dispose();
75 | }
76 | }
--------------------------------------------------------------------------------
/lib/views/widgets/characters_list_item.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart';
3 | import 'package:flutter_mvvm_example/models/character.dart';
4 | import 'package:flutter_mvvm_example/utils/star_wars_styles.dart';
5 |
6 | class CharactersListItem extends StatelessWidget {
7 | final Character character;
8 |
9 | CharactersListItem({@required this.character});
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | var title = Text(
14 | character?.name,
15 | style: TextStyle(
16 | color: StarWarsStyles.titleColor,
17 | fontWeight: FontWeight.bold,
18 | fontSize: StarWarsStyles.titleFontSize,
19 | ),
20 | );
21 |
22 | var subTitle = Row(
23 | children: [
24 | Text(
25 | character?.birthYear,
26 | style: TextStyle(
27 | color: StarWarsStyles.subTitleColor,
28 | ),
29 | ),
30 | Container(
31 | margin: const EdgeInsets.only(left: 6.0),
32 | child: Icon(
33 | _genderSymbol(),
34 | color: StarWarsStyles.subTitleColor.withAlpha(200),
35 | size: StarWarsStyles.subTitleFontSize,
36 | ),
37 | ),
38 | ],
39 | );
40 |
41 | return Column(
42 | children: [
43 | ListTile(
44 | leading: Icon(
45 | _affiliationSymbol(),
46 | color: Theme.of(context).primaryColorLight,
47 | size: 40.0,
48 | ),
49 | contentPadding: const EdgeInsets.symmetric(horizontal: 20.0),
50 | title: title,
51 | subtitle: subTitle,
52 | ),
53 | Divider(),
54 | ],
55 | );
56 | }
57 |
58 | IconData _affiliationSymbol() {
59 | switch (character.name) {
60 | case 'Luke Skywalker':
61 | return FontAwesomeIcons.jediOrder;
62 | case 'C-3PO':
63 | return FontAwesomeIcons.rebel;
64 | case 'R2-D2':
65 | return FontAwesomeIcons.rebel;
66 | case 'Darth Vader':
67 | return FontAwesomeIcons.empire;
68 | case 'Leia Organa':
69 | return FontAwesomeIcons.galacticRepublic;
70 | case 'Owen Lars':
71 | return Icons.face;
72 | case 'Beru Whitesun lars':
73 | return Icons.face;
74 | case 'R5-D4':
75 | return FontAwesomeIcons.rebel;
76 | case 'Biggs Darklighter':
77 | return FontAwesomeIcons.rebel;
78 | case 'Obi-Wan Kenobi':
79 | return FontAwesomeIcons.jediOrder;
80 | default:
81 | return null;
82 | }
83 | }
84 |
85 | IconData _genderSymbol() {
86 | switch (character.gender) {
87 | case 'male':
88 | return FontAwesomeIcons.mars;
89 | case 'female':
90 | return FontAwesomeIcons.venus;
91 | case 'n/a':
92 | return FontAwesomeIcons.robot;
93 | default:
94 | return null;
95 | }
96 | }
97 | }
--------------------------------------------------------------------------------
/lib/views/widgets/characters_panel.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_mvvm_example/models/character.dart';
3 | import 'package:flutter_mvvm_example/view_models/main_page_view_model.dart';
4 | import 'package:flutter_mvvm_example/views/widgets/characters_list_item.dart';
5 | import 'package:flutter_mvvm_example/views/widgets/no_internet_connection.dart';
6 | import 'package:scoped_model/scoped_model.dart';
7 |
8 | class CharactersPanel extends StatelessWidget {
9 | @override
10 | Widget build(BuildContext context) {
11 | return ScopedModelDescendant(
12 | builder: (context, child, model) {
13 | return FutureBuilder>(
14 | future: model.characters,
15 | builder: (_, AsyncSnapshot> snapshot) {
16 | switch (snapshot.connectionState) {
17 | case ConnectionState.none:
18 | case ConnectionState.active:
19 | case ConnectionState.waiting:
20 | return Center(child: CircularProgressIndicator());
21 | case ConnectionState.done:
22 | if (snapshot.hasData) {
23 | var characters = snapshot.data;
24 | return ListView.builder(
25 | itemCount: characters == null ? 0 : characters.length,
26 | itemBuilder: (_, int index) {
27 | var character = characters[index];
28 | return CharactersListItem(character: character);
29 | },
30 | );
31 | } else if (snapshot.hasError) {
32 | return NoInternetConnection(
33 | action: () async {
34 | await model.setFilms();
35 | await model.setCharacters();
36 | await model.setPlanets();
37 | },
38 | );
39 | }
40 | }
41 | },
42 | );
43 | },
44 | );
45 | }
46 | }
--------------------------------------------------------------------------------
/lib/views/widgets/films_list_item.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_mvvm_example/models/film.dart';
3 | import 'package:flutter_mvvm_example/utils/star_wars_styles.dart';
4 |
5 | class FilmsListItem extends StatelessWidget {
6 | final Film film;
7 |
8 | FilmsListItem({@required this.film});
9 |
10 | @override
11 | Widget build(BuildContext context) {
12 | var title = Text(
13 | film?.title,
14 | style: TextStyle(
15 | color: StarWarsStyles.titleColor,
16 | fontWeight: FontWeight.bold,
17 | fontSize: StarWarsStyles.titleFontSize,
18 | ),
19 | );
20 |
21 | var subTitle = Row(
22 | children: [
23 | Icon(
24 | Icons.movie,
25 | color: StarWarsStyles.subTitleColor,
26 | size: StarWarsStyles.subTitleFontSize,
27 | ),
28 | Container(
29 | margin: const EdgeInsets.only(left: 4.0),
30 | child: Text(
31 | film?.director,
32 | style: TextStyle(
33 | color: StarWarsStyles.subTitleColor,
34 | ),
35 | ),
36 | ),
37 | ],
38 | );
39 |
40 | return Column(
41 | children: [
42 | ListTile(
43 | contentPadding: const EdgeInsets.symmetric(horizontal: 20.0),
44 | title: title,
45 | subtitle: subTitle,
46 | ),
47 | Divider(),
48 | ],
49 | );
50 | }
51 | }
--------------------------------------------------------------------------------
/lib/views/widgets/films_panel.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_mvvm_example/models/film.dart';
3 | import 'package:flutter_mvvm_example/view_models/main_page_view_model.dart';
4 | import 'package:flutter_mvvm_example/views/widgets/films_list_item.dart';
5 | import 'package:flutter_mvvm_example/views/widgets/no_internet_connection.dart';
6 | import 'package:scoped_model/scoped_model.dart';
7 |
8 | class FilmsPanel extends StatelessWidget {
9 | @override
10 | Widget build(BuildContext context) {
11 | return ScopedModelDescendant(
12 | builder: (context, child, model) {
13 | return FutureBuilder>(
14 | future: model.films,
15 | builder: (_, AsyncSnapshot> snapshot) {
16 | switch (snapshot.connectionState) {
17 | case ConnectionState.none:
18 | case ConnectionState.active:
19 | case ConnectionState.waiting:
20 | return Center(child: const CircularProgressIndicator());
21 | case ConnectionState.done:
22 | if (snapshot.hasData) {
23 | var films = snapshot.data;
24 | return ListView.builder(
25 | itemCount: films == null ? 0 : films.length,
26 | itemBuilder: (_, int index) {
27 | var film = films[index];
28 | return FilmsListItem(film: film);
29 | },
30 | );
31 | } else if (snapshot.hasError) {
32 | return NoInternetConnection(
33 | action: () async {
34 | await model.setFilms();
35 | await model.setCharacters();
36 | await model.setPlanets();
37 | },
38 | );
39 | }
40 | }
41 | },
42 | );
43 | },
44 | );
45 | }
46 | }
--------------------------------------------------------------------------------
/lib/views/widgets/no_internet_connection.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class NoInternetConnection extends StatelessWidget {
4 | final VoidCallback action;
5 |
6 | NoInternetConnection({@required this.action});
7 |
8 | @override
9 | Widget build(BuildContext context) {
10 | return Column(
11 | mainAxisAlignment: MainAxisAlignment.center,
12 | children: [
13 | Text(
14 | 'Connect to the internet & refresh',
15 | style: TextStyle(
16 | color: Colors.grey,
17 | fontSize: 16.0,
18 | ),
19 | textAlign: TextAlign.center,
20 | ),
21 | Padding(
22 | padding: const EdgeInsets.only(top: 18.0),
23 | child: FloatingActionButton(
24 | backgroundColor: Theme.of(context).primaryColorLight,
25 | child: Icon(Icons.refresh, size: 30.0,),
26 | onPressed: action,
27 | ),
28 | ),
29 | ],
30 | );
31 | }
32 | }
--------------------------------------------------------------------------------
/lib/views/widgets/planets_list_item.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:font_awesome_flutter/font_awesome_flutter.dart';
3 | import 'package:flutter_mvvm_example/models/planet.dart';
4 | import 'package:flutter_mvvm_example/utils/star_wars_styles.dart';
5 |
6 | class PlanetsListItem extends StatelessWidget {
7 | final Planet planet;
8 |
9 | PlanetsListItem({@required this.planet});
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | var title = Text(
14 | planet?.name,
15 | style: TextStyle(
16 | color: StarWarsStyles.titleColor,
17 | fontWeight: FontWeight.bold,
18 | fontSize: StarWarsStyles.titleFontSize,
19 | ),
20 | );
21 |
22 | var subTitle = Row(
23 | children: [
24 | Icon(
25 | FontAwesomeIcons.users,
26 | color: StarWarsStyles.subTitleColor,
27 | size: StarWarsStyles.subTitleFontSize,
28 | ),
29 | Container(
30 | margin: const EdgeInsets.only(left: 7.0),
31 | child: Text(
32 | planet?.population,
33 | style: TextStyle(
34 | color: StarWarsStyles.subTitleColor,
35 | ),
36 | ),
37 | ),
38 | ],
39 | );
40 |
41 | return Column(
42 | children: [
43 | ListTile(
44 | contentPadding: const EdgeInsets.symmetric(horizontal: 20.0),
45 | title: title,
46 | subtitle: subTitle,
47 | ),
48 | Divider(),
49 | ],
50 | );
51 | }
52 | }
--------------------------------------------------------------------------------
/lib/views/widgets/planets_panel.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_mvvm_example/models/planet.dart';
3 | import 'package:flutter_mvvm_example/view_models/main_page_view_model.dart';
4 | import 'package:flutter_mvvm_example/views/widgets/no_internet_connection.dart';
5 | import 'package:flutter_mvvm_example/views/widgets/planets_list_item.dart';
6 | import 'package:scoped_model/scoped_model.dart';
7 |
8 | class PlanetsPanel extends StatelessWidget {
9 | @override
10 | Widget build(BuildContext context) {
11 | return ScopedModelDescendant(
12 | builder: (context, child, model) {
13 | return FutureBuilder>(
14 | future: model.planets,
15 | builder: (_, AsyncSnapshot> snapshot) {
16 | switch (snapshot.connectionState) {
17 | case ConnectionState.none:
18 | case ConnectionState.active:
19 | case ConnectionState.waiting:
20 | return Center(child: const CircularProgressIndicator());
21 | case ConnectionState.done:
22 | if (snapshot.hasData) {
23 | var planets = snapshot.data;
24 | return ListView.builder(
25 | itemCount: planets == null ? 0 : planets.length,
26 | itemBuilder: (_, int index) {
27 | var planet = planets[index];
28 | return PlanetsListItem(planet: planet);
29 | },
30 | );
31 | } else if (snapshot.hasError) {
32 | return NoInternetConnection(
33 | action: () async {
34 | await model.setFilms();
35 | await model.setCharacters();
36 | await model.setPlanets();
37 | },
38 | );
39 | }
40 | }
41 | },
42 | );
43 | },
44 | );
45 | }
46 | }
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_mvvm_example
2 | description: Flutter MVVM example project.
3 |
4 | dependencies:
5 | flutter:
6 | sdk: flutter
7 |
8 | cupertino_icons: ^0.1.2
9 | scoped_model: ^0.3.0
10 | font_awesome_flutter: ^8.0.1
11 | http: ^0.12.0
12 |
13 | dev_dependencies:
14 | flutter_test:
15 | sdk: flutter
16 | mockito: ^4.0.0
17 |
18 | flutter:
19 |
20 | uses-material-design: true
21 |
22 | fonts:
23 | - family: Distant Galaxy
24 | fonts:
25 | - asset: fonts/DISTGRG_.ttf
26 |
--------------------------------------------------------------------------------
/test/main_page_view_model_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_mvvm_example/mocks/mocks.dart';
2 | import 'package:flutter_mvvm_example/models/film.dart';
3 | import 'package:flutter_test/flutter_test.dart';
4 | import 'package:flutter_mvvm_example/services/swapi_service.dart';
5 | import 'package:flutter_mvvm_example/view_models/main_page_view_model.dart';
6 | import 'package:mockito/mockito.dart';
7 | import 'package:http/http.dart' as http;
8 |
9 | main() {
10 | final String baseUrl = 'https://swapi.co/api';
11 | final MockClient client = MockClient();
12 | final SwapiService svc = SwapiService()..client = client;
13 | MainPageViewModel viewModel = MainPageViewModel(apiSvc: svc);
14 |
15 | test(
16 | 'Films fetch test',
17 | () async {
18 | when(client.get('$baseUrl/films')).thenAnswer(
19 | (_) async => http.Response('''{
20 | "results": [
21 | {
22 | "title": "A New Hope",
23 | "opening_crawl": "Blah blah blah",
24 | "director": "George Lucas",
25 | "producer": "Gary Kurtz, Rick McCallum",
26 | "release_date": "1977-05-25"
27 | }
28 | ]
29 | }''', 200),
30 | );
31 |
32 | await viewModel.setFilms();
33 | expect(await viewModel.films, isInstanceOf>());
34 | },
35 | );
36 |
37 | test(
38 | 'Characters fetch test',
39 | () async {
40 | when(client.get('$baseUrl/people')).thenAnswer(
41 | (_) async => http.Response('''{
42 | "results": [
43 | {
44 | "name": "Luke Skywalker",
45 | "birth_year": "19BBY",
46 | "gender": "male",
47 | "height": "172",
48 | "eye_color": "blue"
49 | }
50 | ]
51 | }''', 200),
52 | );
53 |
54 | expect(await viewModel.setCharacters(), true);
55 | },
56 | );
57 |
58 | test(
59 | 'Planets fetch test',
60 | () async {
61 | when(client.get('$baseUrl/planets')).thenAnswer(
62 | (_) async => http.Response('''{
63 | "results": [
64 | {
65 | "name": "Alderaan",
66 | "climate": "temperate",
67 | "terrain": "grasslands, mountains",
68 | "diameter": "12500",
69 | "gravity": "1 standard",
70 | "population": "20000000000"
71 | }
72 | ]
73 | }''', 200),
74 | );
75 |
76 | expect(await viewModel.setPlanets(), true);
77 | },
78 | );
79 | }
80 |
--------------------------------------------------------------------------------
/test/star_wars_api_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_mvvm_example/models/character.dart';
2 | import 'package:flutter_mvvm_example/models/film.dart';
3 | import 'package:flutter_mvvm_example/models/planet.dart';
4 | import 'package:flutter_test/flutter_test.dart';
5 | import 'package:flutter_mvvm_example/interfaces/i_star_wars_api.dart';
6 | import 'package:flutter_mvvm_example/services/swapi_service.dart';
7 |
8 | void main() {
9 | final IStarWarsApi svc = SwapiService();
10 |
11 | test(
12 | 'Films GET request test',
13 | () async {
14 | expect(await svc.getFilms(), isInstanceOf>());
15 | },
16 | );
17 |
18 | test(
19 | 'Characters GET request test',
20 | () async {
21 | expect(await svc.getCharacters(), isInstanceOf>());
22 | },
23 | );
24 |
25 | test(
26 | 'Planets GET request test',
27 | () async {
28 | expect(await svc.getPlanets(), isInstanceOf>());
29 | },
30 | );
31 | }
--------------------------------------------------------------------------------
/test/swapi_service_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_mvvm_example/mocks/mocks.dart';
2 | import 'package:flutter_mvvm_example/models/character.dart';
3 | import 'package:flutter_mvvm_example/models/film.dart';
4 | import 'package:flutter_mvvm_example/models/planet.dart';
5 | import 'package:flutter_mvvm_example/services/swapi_service.dart';
6 | import 'package:flutter_test/flutter_test.dart';
7 | import 'package:mockito/mockito.dart';
8 | import 'package:http/http.dart' as http;
9 |
10 | void main() {
11 | final String baseUrl = 'https://swapi.co/api';
12 | final MockClient client = MockClient();
13 | final SwapiService svc = SwapiService()..client = client;
14 |
15 | test('Returns a list of films if request is successful', () async {
16 | when(client.get('$baseUrl/films')).thenAnswer(
17 | (_) async => http.Response('''{
18 | "results": [
19 | {
20 | "title": "A New Hope",
21 | "opening_crawl": "Blah blah blah",
22 | "director": "George Lucas",
23 | "producer": "Gary Kurtz, Rick McCallum",
24 | "release_date": "1977-05-25"
25 | },
26 | {
27 | "title": "Attack of the Clones",
28 | "opening_crawl": "Blah blah blah",
29 | "director": "George Lucas",
30 | "producer": "Rick McCallum",
31 | "release_date": "2002-05-16"
32 | }
33 | ]
34 | }''', 200),
35 | );
36 |
37 | expect(await svc.getFilms(), isInstanceOf>());
38 | });
39 |
40 | test('Returns a list of characters if request is successful', () async {
41 | when(client.get('$baseUrl/people')).thenAnswer(
42 | (_) async => http.Response('''{
43 | "results": [
44 | {
45 | "name": "Luke Skywalker",
46 | "birth_year": "19BBY",
47 | "gender": "male",
48 | "height": "172",
49 | "eye_color": "blue"
50 | },
51 | {
52 | "name": "R2-D2",
53 | "birth_year": "33BBY",
54 | "gender": "n/a",
55 | "height": "96",
56 | "eye_color": "red"
57 | }
58 | ]
59 | }''', 200),
60 | );
61 |
62 | expect(await svc.getCharacters(), isInstanceOf>());
63 | });
64 |
65 | test('Returns a list of planets if request is successful', () async {
66 | when(client.get('$baseUrl/planets')).thenAnswer(
67 | (_) async => http.Response('''{
68 | "results": [
69 | {
70 | "name": "Alderaan",
71 | "climate": "temperate",
72 | "terrain": "grasslands, mountains",
73 | "diameter": "12500",
74 | "gravity": "1 standard",
75 | "population": "20000000000"
76 | },
77 | {
78 | "name": "Yavin IV",
79 | "climate": "temperate, tropical",
80 | "terrain": "jungle, rainforest",
81 | "diameter": "10200",
82 | "gravity": "1 standard",
83 | "population": "1000"
84 | }
85 | ]
86 | }''', 200),
87 | );
88 |
89 | expect(await svc.getPlanets(), isInstanceOf>());
90 | });
91 | }
--------------------------------------------------------------------------------
/test/widget_tests.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_mvvm_example/mocks/mocks.dart';
3 | import 'package:flutter_mvvm_example/models/character.dart';
4 | import 'package:flutter_mvvm_example/models/film.dart';
5 | import 'package:flutter_mvvm_example/models/planet.dart';
6 | import 'package:flutter_mvvm_example/view_models/main_page_view_model.dart';
7 | import 'package:flutter_mvvm_example/views/pages/main_page.dart';
8 | import 'package:flutter_mvvm_example/views/widgets/characters_list_item.dart';
9 | import 'package:flutter_mvvm_example/views/widgets/films_list_item.dart';
10 | import 'package:flutter_mvvm_example/views/widgets/no_internet_connection.dart';
11 | import 'package:flutter_mvvm_example/views/widgets/planets_list_item.dart';
12 | import 'package:flutter_test/flutter_test.dart';
13 | import 'package:font_awesome_flutter/font_awesome_flutter.dart';
14 | import 'package:mockito/mockito.dart';
15 |
16 | void main() {
17 | final MockSwapiService svc = MockSwapiService();
18 | final MainPageViewModel vm = MainPageViewModel(apiSvc: svc);
19 | final MaterialApp app = MaterialApp(home: MainPage(viewModel: vm));
20 |
21 | testWidgets('Render list of films', (WidgetTester tester) async {
22 | when(svc.getFilms()).thenAnswer((_) {
23 | List films = List();
24 | films.add(Film()
25 | ..title = 'A New Hope'
26 | ..director = 'George Lucas');
27 | films.add(Film()
28 | ..title = 'Attack of the Clones'
29 | ..director = 'George Lucas');
30 |
31 | return Future.value(films);
32 | });
33 |
34 | await tester.pumpWidget(app);
35 |
36 | expect(find.byType(CircularProgressIndicator), findsOneWidget);
37 |
38 | await tester.pump(Duration(seconds: 5));
39 |
40 | expect(find.byType(FilmsListItem), findsNWidgets(2));
41 | });
42 |
43 | testWidgets('Render list of characters', (WidgetTester tester) async {
44 | when(svc.getCharacters()).thenAnswer((_) {
45 | List characters = List();
46 | characters.add(Character()
47 | ..name = 'Luke Skywalker'
48 | ..gender = 'male'
49 | ..birthYear = '19BBY');
50 | characters.add(Character()
51 | ..name = 'Leia Organa'
52 | ..gender = 'female'
53 | ..birthYear = '19BBY');
54 |
55 | return Future.value(characters);
56 | });
57 |
58 | await tester.pumpWidget(app);
59 | await tester.tap(find.widgetWithIcon(Tab, FontAwesomeIcons.users));
60 |
61 | expect(find.byType(CircularProgressIndicator), findsOneWidget);
62 |
63 | await tester.pumpAndSettle(Duration(seconds: 5));
64 |
65 | expect(find.byType(CharactersListItem), findsNWidgets(2));
66 | });
67 |
68 | testWidgets('Render list of planets', (WidgetTester tester) async {
69 | when(svc.getPlanets()).thenAnswer((_) {
70 | List planets = List();
71 | planets.add(Planet()
72 | ..name = 'Home'
73 | ..population = '1234');
74 | planets.add(Planet()
75 | ..name = 'Not home'
76 | ..population = '1234');
77 |
78 | return Future.value(planets);
79 | });
80 |
81 | await tester.pumpWidget(app);
82 | await tester.tap(find.widgetWithIcon(Tab, FontAwesomeIcons.globeAmericas));
83 |
84 | expect(find.byType(CircularProgressIndicator), findsOneWidget);
85 |
86 | await tester.pumpAndSettle(Duration(seconds: 5));
87 |
88 | expect(find.byType(PlanetsListItem), findsNWidgets(2));
89 | });
90 |
91 | testWidgets('Renders films tab error widget', (WidgetTester tester) async {
92 | when(svc.getFilms()).thenAnswer((_) {
93 | return Future.error(Exception);
94 | });
95 |
96 | await tester.pumpWidget(app);
97 |
98 | expect(find.byType(CircularProgressIndicator), findsOneWidget);
99 |
100 | await tester.pump(Duration(seconds: 5));
101 |
102 | expect(find.byType(NoInternetConnection), findsOneWidget);
103 | });
104 | }
--------------------------------------------------------------------------------