├── .flutter-plugins ├── .flutter-plugins-dependencies ├── .gitignore ├── README.md ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── flutter │ │ │ │ └── mvvm │ │ │ │ └── flutter_mvvm_boilerplate │ │ │ │ └── MainActivity.java │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── flutter_mvvm_boilerplate_android.iml ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── fonts │ └── PlayfairDisplay-Regular.ttf └── images │ └── logos │ └── Google_flutter_logo.png ├── ios ├── .gitignore ├── Flutter │ ├── .last_build_id │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── 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 │ └── Runner-Bridging-Header.h ├── lib ├── main.dart ├── models │ ├── custom_url_model.dart │ ├── login_model.dart │ ├── response_data_model.dart │ └── user_model.dart ├── services │ ├── api_service.dart │ └── network_check.dart ├── utils │ ├── api_helper.dart │ ├── constants │ │ ├── api_constants.dart │ │ ├── app_constants.dart │ │ ├── color_constants.dart │ │ ├── font_family_constants.dart │ │ ├── singleton_constant.dart │ │ └── size_constants.dart │ ├── navigation_helper.dart │ ├── pretty_json_print.dart │ └── shared_preferences_helper.dart ├── view_models │ ├── custom_url_view_model.dart │ └── login_view_model.dart ├── views │ ├── custom_url_view.dart │ └── login_view.dart └── widgets │ ├── alert_bar.dart │ ├── common_button.dart │ ├── common_text_field.dart │ └── loader_widget.dart ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.flutter-plugins: -------------------------------------------------------------------------------- 1 | # This is a generated file; do not edit or check into version control. 2 | connectivity=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-2.0.2/ 3 | connectivity_for_web=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_for_web-0.3.1+4/ 4 | connectivity_macos=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_macos-0.1.0+7/ 5 | path_provider_linux=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/ 6 | path_provider_windows=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/ 7 | shared_preferences=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/ 8 | shared_preferences_linux=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+4/ 9 | shared_preferences_macos=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+11/ 10 | shared_preferences_web=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/ 11 | shared_preferences_windows=/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-0.0.2+3/ 12 | -------------------------------------------------------------------------------- /.flutter-plugins-dependencies: -------------------------------------------------------------------------------- 1 | {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-2.0.2/","dependencies":[]},{"name":"shared_preferences","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/","dependencies":[]}],"android":[{"name":"connectivity","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-2.0.2/","dependencies":[]},{"name":"shared_preferences","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12+4/","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_macos-0.1.0+7/","dependencies":[]},{"name":"shared_preferences_macos","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+11/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+4/","dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-0.0.2+3/","dependencies":["path_provider_windows"]}],"web":[{"name":"connectivity_for_web","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity_for_web-0.3.1+4/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/abhi/flutter_sdk/stable_copy/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity","dependencies":["connectivity_macos","connectivity_for_web"]},{"name":"connectivity_for_web","dependencies":[]},{"name":"connectivity_macos","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2021-04-20 09:43:01.778787","version":"1.22.6"} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | # Flutter MVVM Boilerplate 6 | 7 | Flutter Boilerplate containing pre initialised services and following standardised protocol for code quality. 8 | 9 | Maintained by - [Abhijeet Tripathi](https://github.com/abhimortal6) 10 | 11 | ## Features 12 | 13 | | Feature | Availability | 14 | | - | - | 15 | | Ready to use | :white_check_mark: | 16 | | MVVM based | :white_check_mark:| 17 | | Network services | :white_check_mark: | 18 | | Using Providers | :white_check_mark: | 19 | | Modular | :white_check_mark: | 20 | | Assets and custom Fonts | :white_check_mark: | 21 | | Embedded custom URL screen | :white_check_mark: | 22 | 23 | 24 | 25 | 26 | 27 | ## Setup Guide 28 | 29 | 1. [Initial Setup](#1-initial-setup) 30 | 2. [Constants](#2-constants) 31 | 3. [Base Response Model](#3--base-response-model) 32 | 4. [Network layer](#4-network-layer) 33 | 5. [Navigation](#5-navigation) 34 | 35 |
36 | 37 | 38 | ## 1. Initial Setup 39 | 40 | 1. Clone this repo 41 | ```sh 42 | git clone https://github.com/joshsoftware/flutter-boilerplate.git 43 | ``` 44 | 45 | 2. Rename "**flutter-boilerplate**" folder to your "**project_name**" 46 | 3. Open folder in Android Studio 47 | 4. Open project's pubspec.yaml and change 48 | // This is Flutter level project name do not consider this as bundle id or application id 49 | - "name: flutter_mvvm_boilerplate" to "name: project_name" 50 | - "description: Ready to use flutter boiler plate" to "description: Your project description" 51 | 52 | 5. In Android Studio's Terminal run 53 | ```sh 54 | flutter pub get 55 | ``` 56 | Note: You'll start getting errors in all your files it's because we've changed the flutter package name and imports are still directing to old package name. 57 | 58 | 6. Right click on "**lib**" folder and click "**Replace in path**" and replace "**flutter_mvvm_boilerplate**" to "**project_name**" (same as you used in pubspec.yaml) click **"Replace All"**. 59 | Note: Most of your errors will go away if not just close and reopen Android Studio once. 60 | 61 | 7. Change Application name and ID: Open terminal tab in Android Studio and run following commands. 62 | 63 | 64 | • This will install package rename tool 65 | ```sh 66 | flutter pub global activate rename 67 | ``` 68 | 69 | • This will rename your Application name 70 | ```sh 71 | flutter pub global run rename --appname "Project Name" 72 | ``` 73 | 74 | • This will rename your Application ID/Bundle ID 75 | ```sh 76 | flutter pub global run rename --bundleId com.companyname.projectname 77 | ``` 78 |
79 | 80 | 8. Add and register project specific assets and you're ready to go. 81 |
82 |
83 | 84 | 85 | ## 2. Constants 86 | 87 | **Description** 88 | 89 | Maintainability is achieved by distributing type of Constant Data into specific category. 90 | Important constants files are 91 | - api_constants.dart 92 | - Contains base URL and all the end points that application is going to use. 93 | 94 | - app_constants.dart 95 | - Contains maintenance flag for changing Production and Staging Environments 96 | - Also contains app related constants 97 | 98 | - singleton_constants.dart 99 | - This is a Singleton class for general purpose data sharing over the app User object, token etc. 100 | - Other constants files are self explanatory 101 |
102 |
103 | 104 | ## 3. Base Response Model 105 | 106 | **Description** 107 | 108 | Base Response Model is designed for productive API integration. This model can be modified according to Project's API structure. 109 | 110 | File name 111 | 112 | - response_data_model.dart 113 | 114 | **Keys to change** 115 | 116 | 1. Data 117 | 2. Error and Message 118 | 3. okAndContainsData 119 | 120 | Based on your API Structure change the 'data' key to specified key where all your response's data will be delivered. 121 | Example: For given API structure 122 | 123 | ```dart 124 | { 125 | 'data': [ 126 | { 127 | 'name': 'Abhijeet Tripathi', 128 | 'mail': 'somemail@test.com' 129 | } 130 | { 131 | 'name': 'Shekhar Sahu', 132 | 'mail': 'somemail@test.com' 133 | } 134 | ], 135 | 136 | 'message' : 'Data fetched', 137 | 'error' : 'None till now' 138 | } 139 | ``` 140 | 141 | the keys will be.. 142 | 143 | ```dart 144 | data: parsedJson['data'] != null ? parsedJson['data'] : null, 145 | okAndContainsData: (response.statusCode == 200 ) && (parsedJson['data'] != null), 146 | message: parsedJson['message'] != null ? parsedJson['message'] : "", 147 | ``` 148 | 149 | Though this model is null safe but it's not safe from parsing errors. 150 | Always cross checks key names and hierarchy of them. 151 |
152 |
153 | 154 | ## 4. Network Layer 155 | 156 | **Description** 157 | 158 | Networking layer is preinitialised with following features. 159 | 160 | - Network connection check 161 | - Common loader 162 | - Common Error and Success Message 163 | - Prettyfied Logs for easy debugging. 164 | 165 | Responsible files 166 | 167 | - api_helper.dart 168 | - api_service.dart 169 | - api_constants.dart 170 | - network_check.dart 171 | - pretty_json_print.dart 172 | 173 | **Things to change** 174 | 175 | In **api_helper.dart** change the following as per your project needs. 176 | 177 | - DEFAULT_TIMEOUT this is a top level variable denotes time out seconds. Default is 45. 178 | - _getHeaders this is Header generator for API call change as per required. 179 | - _handleError this is error handler for all REST calls you can handle unauthorised logout and 180 | error alert directly from here. 181 | 182 | **Usage example** 183 | 184 | 1. Declare end point you want consume in api_constants.dart in given format. 185 | ```dart 186 | static const String LOGIN = "/api/login"; 187 | ``` 188 | 189 | 2. Create **URI** with **base URL** and **end point** in your function 190 | 191 | ```dart 192 | // baseURL here is Getter of String type that returns your base URL from 193 | // api_constants.dart and is directly accesibile. 194 | 195 | Uri _loginUri = Uri.parse(baseURL + ApiConstants.LOGIN); 196 | ``` 197 | 198 | - Use ApiHelper class it contains plug and play REST callers 199 | - ApiHelper have 2 types of caller 200 | - Plug and Play This requires BuildContext and contains common loader and alert dialog built in 201 | - BG : This doesn't requires context can be called in Background but it doesn't contains UI elements everything will be handled by developer. 202 | 203 | 204 | ```dart 205 | Map map = { "email": "eve.holt@reqres.in","password": "cityslicka" } 206 | 207 | 208 | // If showConnectivityError is set to false will Throw NoNetworkException in case of no connectivity. 209 | // showConnectivityError: false allows developer to handle no connectivity exception manually. 210 | // Plug and Play with common loader and dialog 211 | ResponseData responseData = 212 | await ApiHelper().postRequest(context, _loginUri, map, 213 | useAuth: false, showLoader: true, responseName: "Login", 214 | showLog: true, showError: true, showConnectivityError: true); 215 | 216 | // Background callers without loader and dialog 217 | // Throws NoNetworkException in case of no nonnectivity. 218 | 219 | try { 220 | ResponseData responseData = 221 | await ApiHelper().postRequestBG(_loginUri,map,useAuth: false,showLog: true); 222 | } on NoNetworkException { 223 | print("Please Check Internet Connection"); 224 | //Handle error on UI if using BG callers 225 | } 226 | 227 | ``` 228 | 229 | 3. Check response and consume. 230 | ```dart 231 | if (responseData.okAndContainsData ) { 232 | print(responseData.data['message']) 233 | // Do success stuff here. 234 | }else if(responseData.statusCode == 500){ 235 | // Handle 500. 236 | }else{ 237 | // Handle everthing else. 238 | } 239 | 240 | ``` 241 |
242 |
243 | 244 | ## 5. Navigation 245 | 246 | **Description** 247 | 248 | Navigation is straight forward 249 | 250 | Responsible file 251 | 252 | - navigation_helper.dart 253 | 254 | #### Things to take care of 255 | 256 | - Always provide Navigation TAG - All views have their own specific tag 257 | ```dart 258 | static const String TAG = "/LoginView"; 259 | ``` 260 | These tags help to easily access and switch to views 261 | - Register path in routes - in main.dart register paths to their respective view. 262 | ```dart 263 | routes: { 264 | LoginView.TAG: (context) => NavigationHelper.getLoginViewWithProvider(), 265 | }, 266 | ``` 267 | 268 | - Keep Function naming standard 269 | ```dart 270 | ///Naming Standard: 271 | ///Fun that gives View with provider - getViewNameWithProvider() 272 | ///Fun that pushes View - gotoViewName() 273 | ///Fun that return Data - gotoViewNameWithResult() 274 | ///Fun(Data data) that pushes View with data - gotoViewNameWithData(data) 275 | ///Fun that clears stack and pushes View - clearAndGotoViewName() 276 | ``` 277 | 278 | 279 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 29 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "flutter.mvvm.flutter_mvvm_boilerplate" 37 | minSdkVersion 21 38 | targetSdkVersion 29 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | } 42 | 43 | buildTypes { 44 | release { 45 | // TODO: Add your own signing config for the release build. 46 | // Signing with the debug keys for now, so `flutter run --release` works. 47 | signingConfig signingConfigs.debug 48 | } 49 | } 50 | } 51 | 52 | flutter { 53 | source '../..' 54 | } 55 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /android/app/src/main/java/flutter/mvvm/flutter_mvvm_boilerplate/MainActivity.java: -------------------------------------------------------------------------------- 1 | package flutter.mvvm.flutter_mvvm_boilerplate; 2 | 3 | import io.flutter.embedding.android.FlutterActivity; 4 | 5 | public class MainActivity extends FlutterActivity { 6 | } 7 | -------------------------------------------------------------------------------- /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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.5.0' 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/flutter_mvvm_boilerplate_android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.enableR8=true 5 | -------------------------------------------------------------------------------- /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-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /assets/fonts/PlayfairDisplay-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/assets/fonts/PlayfairDisplay-Regular.ttf -------------------------------------------------------------------------------- /assets/images/logos/Google_flutter_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/assets/images/logos/Google_flutter_logo.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /ios/Flutter/.last_build_id: -------------------------------------------------------------------------------- 1 | 7ec5b0ab005ed9c9ef7855ce5ad90b96 -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - connectivity (0.0.1): 3 | - Flutter 4 | - Reachability 5 | - Flutter (1.0.0) 6 | - Reachability (3.2) 7 | - shared_preferences (0.0.1): 8 | - Flutter 9 | 10 | DEPENDENCIES: 11 | - connectivity (from `.symlinks/plugins/connectivity/ios`) 12 | - Flutter (from `Flutter`) 13 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) 14 | 15 | SPEC REPOS: 16 | trunk: 17 | - Reachability 18 | 19 | EXTERNAL SOURCES: 20 | connectivity: 21 | :path: ".symlinks/plugins/connectivity/ios" 22 | Flutter: 23 | :path: Flutter 24 | shared_preferences: 25 | :path: ".symlinks/plugins/shared_preferences/ios" 26 | 27 | SPEC CHECKSUMS: 28 | connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 29 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 30 | Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 31 | shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d 32 | 33 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 34 | 35 | COCOAPODS: 1.10.1 36 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1020; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | FRAMEWORK_SEARCH_PATHS = ( 293 | "$(inherited)", 294 | "$(PROJECT_DIR)/Flutter", 295 | ); 296 | INFOPLIST_FILE = Runner/Info.plist; 297 | LD_RUNPATH_SEARCH_PATHS = ( 298 | "$(inherited)", 299 | "@executable_path/Frameworks", 300 | ); 301 | LIBRARY_SEARCH_PATHS = ( 302 | "$(inherited)", 303 | "$(PROJECT_DIR)/Flutter", 304 | ); 305 | PRODUCT_BUNDLE_IDENTIFIER = flutter.mvvm.flutterMvvmBoilerplate; 306 | PRODUCT_NAME = "$(TARGET_NAME)"; 307 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 308 | SWIFT_VERSION = 5.0; 309 | VERSIONING_SYSTEM = "apple-generic"; 310 | }; 311 | name = Profile; 312 | }; 313 | 97C147031CF9000F007C117D /* Debug */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ALWAYS_SEARCH_USER_PATHS = NO; 317 | CLANG_ANALYZER_NONNULL = YES; 318 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 319 | CLANG_CXX_LIBRARY = "libc++"; 320 | CLANG_ENABLE_MODULES = YES; 321 | CLANG_ENABLE_OBJC_ARC = YES; 322 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 323 | CLANG_WARN_BOOL_CONVERSION = YES; 324 | CLANG_WARN_COMMA = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INFINITE_RECURSION = YES; 331 | CLANG_WARN_INT_CONVERSION = YES; 332 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 334 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 336 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 337 | CLANG_WARN_STRICT_PROTOTYPES = YES; 338 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 339 | CLANG_WARN_UNREACHABLE_CODE = YES; 340 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 341 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 342 | COPY_PHASE_STRIP = NO; 343 | DEBUG_INFORMATION_FORMAT = dwarf; 344 | ENABLE_STRICT_OBJC_MSGSEND = YES; 345 | ENABLE_TESTABILITY = YES; 346 | GCC_C_LANGUAGE_STANDARD = gnu99; 347 | GCC_DYNAMIC_NO_PIC = NO; 348 | GCC_NO_COMMON_BLOCKS = YES; 349 | GCC_OPTIMIZATION_LEVEL = 0; 350 | GCC_PREPROCESSOR_DEFINITIONS = ( 351 | "DEBUG=1", 352 | "$(inherited)", 353 | ); 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 = 10.0; 361 | MTL_ENABLE_DEBUG_INFO = YES; 362 | ONLY_ACTIVE_ARCH = YES; 363 | SDKROOT = iphoneos; 364 | TARGETED_DEVICE_FAMILY = "1,2"; 365 | }; 366 | name = Debug; 367 | }; 368 | 97C147041CF9000F007C117D /* Release */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | ALWAYS_SEARCH_USER_PATHS = NO; 372 | CLANG_ANALYZER_NONNULL = YES; 373 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 374 | CLANG_CXX_LIBRARY = "libc++"; 375 | CLANG_ENABLE_MODULES = YES; 376 | CLANG_ENABLE_OBJC_ARC = YES; 377 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 378 | CLANG_WARN_BOOL_CONVERSION = YES; 379 | CLANG_WARN_COMMA = YES; 380 | CLANG_WARN_CONSTANT_CONVERSION = YES; 381 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 382 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 383 | CLANG_WARN_EMPTY_BODY = YES; 384 | CLANG_WARN_ENUM_CONVERSION = YES; 385 | CLANG_WARN_INFINITE_RECURSION = YES; 386 | CLANG_WARN_INT_CONVERSION = YES; 387 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 388 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 389 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 390 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 391 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 392 | CLANG_WARN_STRICT_PROTOTYPES = YES; 393 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 394 | CLANG_WARN_UNREACHABLE_CODE = YES; 395 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 396 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 397 | COPY_PHASE_STRIP = NO; 398 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 399 | ENABLE_NS_ASSERTIONS = NO; 400 | ENABLE_STRICT_OBJC_MSGSEND = YES; 401 | GCC_C_LANGUAGE_STANDARD = gnu99; 402 | GCC_NO_COMMON_BLOCKS = YES; 403 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 404 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 405 | GCC_WARN_UNDECLARED_SELECTOR = YES; 406 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 407 | GCC_WARN_UNUSED_FUNCTION = YES; 408 | GCC_WARN_UNUSED_VARIABLE = YES; 409 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 410 | MTL_ENABLE_DEBUG_INFO = NO; 411 | SDKROOT = iphoneos; 412 | SUPPORTED_PLATFORMS = iphoneos; 413 | SWIFT_COMPILATION_MODE = wholemodule; 414 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 415 | TARGETED_DEVICE_FAMILY = "1,2"; 416 | VALIDATE_PRODUCT = YES; 417 | }; 418 | name = Release; 419 | }; 420 | 97C147061CF9000F007C117D /* Debug */ = { 421 | isa = XCBuildConfiguration; 422 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 423 | buildSettings = { 424 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 425 | CLANG_ENABLE_MODULES = YES; 426 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 427 | ENABLE_BITCODE = NO; 428 | FRAMEWORK_SEARCH_PATHS = ( 429 | "$(inherited)", 430 | "$(PROJECT_DIR)/Flutter", 431 | ); 432 | INFOPLIST_FILE = Runner/Info.plist; 433 | LD_RUNPATH_SEARCH_PATHS = ( 434 | "$(inherited)", 435 | "@executable_path/Frameworks", 436 | ); 437 | LIBRARY_SEARCH_PATHS = ( 438 | "$(inherited)", 439 | "$(PROJECT_DIR)/Flutter", 440 | ); 441 | PRODUCT_BUNDLE_IDENTIFIER = flutter.mvvm.flutterMvvmBoilerplate; 442 | PRODUCT_NAME = "$(TARGET_NAME)"; 443 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 444 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 445 | SWIFT_VERSION = 5.0; 446 | VERSIONING_SYSTEM = "apple-generic"; 447 | }; 448 | name = Debug; 449 | }; 450 | 97C147071CF9000F007C117D /* Release */ = { 451 | isa = XCBuildConfiguration; 452 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 453 | buildSettings = { 454 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 455 | CLANG_ENABLE_MODULES = YES; 456 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 457 | ENABLE_BITCODE = NO; 458 | FRAMEWORK_SEARCH_PATHS = ( 459 | "$(inherited)", 460 | "$(PROJECT_DIR)/Flutter", 461 | ); 462 | INFOPLIST_FILE = Runner/Info.plist; 463 | LD_RUNPATH_SEARCH_PATHS = ( 464 | "$(inherited)", 465 | "@executable_path/Frameworks", 466 | ); 467 | LIBRARY_SEARCH_PATHS = ( 468 | "$(inherited)", 469 | "$(PROJECT_DIR)/Flutter", 470 | ); 471 | PRODUCT_BUNDLE_IDENTIFIER = flutter.mvvm.flutterMvvmBoilerplate; 472 | PRODUCT_NAME = "$(TARGET_NAME)"; 473 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 474 | SWIFT_VERSION = 5.0; 475 | VERSIONING_SYSTEM = "apple-generic"; 476 | }; 477 | name = Release; 478 | }; 479 | /* End XCBuildConfiguration section */ 480 | 481 | /* Begin XCConfigurationList section */ 482 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | 97C147031CF9000F007C117D /* Debug */, 486 | 97C147041CF9000F007C117D /* Release */, 487 | 249021D3217E4FDB00AE95B9 /* Profile */, 488 | ); 489 | defaultConfigurationIsVisible = 0; 490 | defaultConfigurationName = Release; 491 | }; 492 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 493 | isa = XCConfigurationList; 494 | buildConfigurations = ( 495 | 97C147061CF9000F007C117D /* Debug */, 496 | 97C147071CF9000F007C117D /* Release */, 497 | 249021D4217E4FDB00AE95B9 /* Profile */, 498 | ); 499 | defaultConfigurationIsVisible = 0; 500 | defaultConfigurationName = Release; 501 | }; 502 | /* End XCConfigurationList section */ 503 | }; 504 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 505 | } 506 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joshsoftware/flutter-boilerplate/102840ddc3ec24b1beb3d591bdb4bcfcbbab722b/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 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_mvvm_boilerplate 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:flutter/widgets.dart'; 4 | import 'package:flutter_mvvm_boilerplate/utils/constants/app_constants.dart'; 5 | import 'package:flutter_mvvm_boilerplate/utils/constants/color_constants.dart'; 6 | import 'package:flutter_mvvm_boilerplate/utils/navigation_helper.dart'; 7 | import 'package:flutter_mvvm_boilerplate/views/custom_url_view.dart'; 8 | import 'package:flutter_mvvm_boilerplate/views/login_view.dart'; 9 | 10 | void main() async { 11 | //Check if custom URL flag is set and make safe check for production 12 | //If true custom url screen is shown 13 | // 14 | Widget _defaultHome = AppConstants.isCustomURLBuild && !AppConstants.isProdBuild 15 | ? NavigationHelper.getCustomURLViewWithProvider() 16 | : NavigationHelper.getLoginViewWithProvider(); 17 | 18 | WidgetsFlutterBinding.ensureInitialized(); 19 | //Locks orientation 20 | //Can be changed at runtime via same method. 21 | await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); 22 | 23 | ///Sets Status Bar Color 24 | // SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: )); 25 | 26 | runApp( 27 | new MaterialApp( 28 | title: AppConstants.APP_NAME, 29 | theme: ThemeData( 30 | accentColor: ColorConstants.PRIMARY, 31 | accentColorBrightness: Brightness.light, 32 | ), 33 | debugShowCheckedModeBanner: false, 34 | routes: { 35 | '/': (context) => _defaultHome, 36 | 37 | ///Home Route is Denoted as / 38 | ///Set tag in view itself, so it can be used directly maintaining consistency. 39 | CustomURLView.TAG: (context) => NavigationHelper.getCustomURLViewWithProvider(), 40 | LoginView.TAG: (context) => NavigationHelper.getLoginViewWithProvider(), 41 | }, 42 | ), 43 | ); 44 | } 45 | -------------------------------------------------------------------------------- /lib/models/custom_url_model.dart: -------------------------------------------------------------------------------- 1 | class CustomURLModel {} 2 | -------------------------------------------------------------------------------- /lib/models/login_model.dart: -------------------------------------------------------------------------------- 1 | class LoginModel { 2 | final String email; 3 | final String password; 4 | 5 | LoginModel({ 6 | this.email, 7 | this.password, 8 | }); 9 | 10 | factory LoginModel.fromJson(Map json) { 11 | return LoginModel( 12 | email: json['email'], 13 | password: json['password'], 14 | ); 15 | } 16 | 17 | Map toMap() => { 18 | 'email': email, 19 | 'password': password, 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /lib/models/response_data_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:http/http.dart' as http; 4 | 5 | ///This is generic response data model please modify it according to your API Structure. 6 | ///Model is designed to be generic please keep it that way 7 | ///Things to change: 8 | /// 1. Change data section - key where your data is. 9 | /// 2. Error and Messages - key where your error, errors and message are. 10 | /// 3. okAndContainsData Condition - Change logic according to your API Structure 11 | class ResponseData { 12 | int statusCode; 13 | bool ok; 14 | bool okAndContainsData; 15 | var data; 16 | var message; 17 | ResponseErrors errors; 18 | String rawResponseBody; 19 | 20 | ResponseData( 21 | {this.statusCode, this.data, this.message, this.errors, this.ok: false, this.okAndContainsData: false, this.rawResponseBody}); 22 | 23 | factory ResponseData.fromResponse(http.Response response) { 24 | var parsedJson = jsonDecode(response.body); 25 | return ResponseData( 26 | statusCode: response.statusCode, 27 | ok: (response.statusCode == 200 || response.statusCode == 201), 28 | data: parsedJson['data'] != null ? parsedJson['data'] : null, 29 | rawResponseBody: response.body != null ? response.body : null, 30 | okAndContainsData: (response.statusCode == 200 || response.statusCode == 201) && (parsedJson['data'] != null), 31 | message: parsedJson['message'] != null ? parsedJson['message'] : "", 32 | errors: parsedJson['errors'] != null 33 | ? parsedJson['errors'].runtimeType == String 34 | ? new ResponseErrors(message: parsedJson['errors']) 35 | : ResponseErrors.fromJson(parsedJson['errors']) 36 | : parsedJson['error'] != null 37 | ? ResponseErrors(message: parsedJson['error']) 38 | : null, 39 | ); 40 | } 41 | } 42 | 43 | class ResponseErrors { 44 | String message; 45 | 46 | ResponseErrors({ 47 | this.message, 48 | }); 49 | 50 | factory ResponseErrors.fromJson(Map parsedJson) { 51 | return ResponseErrors( 52 | message: parsedJson['message'] != null ? parsedJson['message'] : "", 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/models/user_model.dart: -------------------------------------------------------------------------------- 1 | class UserModel { 2 | final String email; 3 | final int id; 4 | final String firstName; 5 | final String lastName; 6 | final String avatar; 7 | 8 | UserModel({this.email, this.firstName, this.lastName, this.avatar, this.id}); 9 | 10 | factory UserModel.fromJson(Map json) { 11 | return UserModel( 12 | email: json['email'] != null ? json['email'] : "", 13 | id: json['id'] != null ? json['id'] : 0, 14 | firstName: json['first_name'] != null ? json['first_name'] : "", 15 | lastName: json['last_name'] != null ? json['last_name'] : "", 16 | avatar: json['avatar'] != null ? json['avatar'] : "", 17 | ); 18 | } 19 | 20 | Map toJson() => { 21 | 'id': id, 22 | 'firstName': firstName, 23 | 'lastName': lastName, 24 | 'email': email, 25 | 'avatar': avatar, 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /lib/services/api_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_mvvm_boilerplate/models/login_model.dart'; 3 | import 'package:flutter_mvvm_boilerplate/models/response_data_model.dart'; 4 | import 'package:flutter_mvvm_boilerplate/utils/api_helper.dart'; 5 | import 'package:flutter_mvvm_boilerplate/utils/constants/api_constants.dart'; 6 | 7 | class ApiService { 8 | Future loginUser({@required BuildContext context, @required LoginModel loginModel, bool logInWithCommonLoader}) { 9 | Uri _uri = Uri.parse(baseURL + ApiConstants.LOGIN); 10 | 11 | return ApiHelper().postRequest(context, _uri, loginModel.toMap(), 12 | useAuth: false, showLoader: logInWithCommonLoader, responseName: "Login", showLog: true, showError: true); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/services/network_check.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:connectivity/connectivity.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_mvvm_boilerplate/widgets/alert_bar.dart'; 6 | 7 | ///Identifies Network Availability. 8 | ///Automated alert - flag controlled 9 | ///Things to change: 10 | /// 1. Message Alert widget - can be left default, change as per UI design. 11 | /// 12 | class NetworkCheck { 13 | static Future check() async { 14 | var connectivityResult = await (Connectivity().checkConnectivity()); 15 | if (connectivityResult == ConnectivityResult.mobile) { 16 | return true; 17 | } else if (connectivityResult == ConnectivityResult.wifi) { 18 | return true; 19 | } 20 | 21 | return false; 22 | } 23 | 24 | static Future isOnline(BuildContext context, bool showError) async { 25 | var connectivityResult = await (Connectivity().checkConnectivity()); 26 | if (connectivityResult == ConnectivityResult.mobile) { 27 | return true; 28 | } else if (connectivityResult == ConnectivityResult.wifi) { 29 | return true; 30 | } 31 | debugPrint("No Internet"); 32 | if (showError) 33 | AlertBar.show(context, 34 | title: 'No Connectivity', description: 'Please Check Internet Connection', gravity: AlertBar.TOP, backgroundColor: Colors.red); 35 | 36 | return false; 37 | } 38 | 39 | dynamic checkInternet(Function func) { 40 | check().then((internet) { 41 | if (internet != null && internet) { 42 | func(true); 43 | } else { 44 | func(false); 45 | } 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/utils/api_helper.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_mvvm_boilerplate/models/response_data_model.dart'; 5 | import 'package:flutter_mvvm_boilerplate/services/network_check.dart'; 6 | import 'package:flutter_mvvm_boilerplate/utils/constants/singleton_constant.dart'; 7 | import 'package:flutter_mvvm_boilerplate/utils/pretty_json_print.dart'; 8 | import 'package:flutter_mvvm_boilerplate/utils/shared_preferences_helper.dart'; 9 | import 'package:flutter_mvvm_boilerplate/widgets/alert_bar.dart'; 10 | import 'package:flutter_mvvm_boilerplate/widgets/loader_widget.dart'; 11 | import 'package:http/http.dart' as http; 12 | 13 | ///This is generic API Helper and is very efficient. 14 | ///Auto Checks Network Availability 15 | ///Automated Loader - flag controlled 16 | ///Cleaner formatted response 17 | ///Automated message/error dialog - flag controller 18 | ///Things to change: 19 | /// 1. Error and Message Alert widget - can be left default, change as per UI design. 20 | /// 2. Header - Change as per project spec. 21 | /// 22 | 23 | class NoNetworkException implements Exception { 24 | String errMsg() => 'Please Check Internet Connection'; 25 | } 26 | 27 | class ApiHelper { 28 | //Timeout in seconds 29 | static const int _DEFAULT_TIMEOUT = 45; 30 | 31 | //Base headers Supports version 32 | //Gets Token from singleton class which is set either on login or app startup in main.dart 33 | static Future> _getHeaders(bool useAuth, int apiVersion) async { 34 | Map _map = { 35 | //Add or Remove headers from here 36 | 'Content-Type': 'application/json', 37 | 'Authorization': useAuth ? 'Bearer ' + await SingletonConstants().getToken : "", 38 | }; 39 | return _map; 40 | } 41 | 42 | static Future _handleError( 43 | BuildContext context, 44 | http.Response response, 45 | String responseName, 46 | bool showLog, 47 | bool showMessage, 48 | bool showError, 49 | ) async { 50 | ResponseData responseData = ResponseData(); 51 | //Handle Unauthorised 52 | if (response.statusCode == 401) { 53 | if (showLog) { 54 | debugPrint("Request failed with status: ${response.statusCode}."); 55 | debugPrint("Error:${response.reasonPhrase}"); 56 | debugPrint("$responseName Response:${response.body}"); 57 | } 58 | await SharedPreferencesHelper.clearAuthToken(); 59 | // Navigator.pushNamedAndRemoveUntil(context, GetOtpPage.tag, (route) => false); 60 | } else { 61 | if (showLog) { 62 | debugPrint("Request failed with status: ${response.statusCode}."); 63 | debugPrint("Error:${response.reasonPhrase}"); 64 | debugPrint("$responseName Response:${response.body}"); 65 | } 66 | try { 67 | responseData = ResponseData.fromResponse(response); 68 | } catch (e) { 69 | responseData = ResponseData( 70 | errors: ResponseErrors(message: "Request failed with status: ${response.statusCode}. \n ${response.reasonPhrase}")); 71 | 72 | if (showLog) debugPrint("$e"); 73 | } 74 | 75 | if (showMessage) { 76 | // if (responseData.message != null) await Constant().genericErrorDialog(context, responseData.message, 0); 77 | } 78 | if (showError) { 79 | if (responseData.errors != null) { 80 | AlertBar.show(context, 81 | title: 'Error', description: responseData.errors.message, gravity: AlertBar.TOP, backgroundColor: Colors.red); 82 | } 83 | } 84 | } 85 | return responseData; 86 | } 87 | 88 | Future postRequest(BuildContext context, var requestUri, Map map, 89 | {bool showError: false, 90 | bool showMessage: false, 91 | bool showLoader: true, 92 | bool useAuth: true, 93 | String responseName: "", 94 | bool showLog: true, 95 | bool showConnectivityError: true, 96 | int apiVersion: 1}) async { 97 | ResponseData responseData = ResponseData(); 98 | if (showLog) { 99 | debugPrint("Requested URL: " + requestUri.toString()); 100 | debugPrint("Map: $map"); 101 | } 102 | 103 | var jsonBody = JsonEncoder().convert(map); 104 | if (await NetworkCheck.isOnline(context, showConnectivityError)) { 105 | if (showLoader) LoaderWidget.showLoader(context); 106 | await http 107 | .post(requestUri, body: jsonBody, headers: await _getHeaders(useAuth, apiVersion)) 108 | .timeout(Duration(seconds: _DEFAULT_TIMEOUT)) 109 | .then((http.Response response) async { 110 | if (showLoader) LoaderWidget.hideLoader(context); 111 | 112 | if (response.statusCode == 200 || response.statusCode == 201) { 113 | if (showLog) { 114 | debugPrint("$responseName Response: ${prettyJson(jsonDecode(response.body))}"); 115 | } 116 | responseData = ResponseData.fromResponse(response); 117 | } else { 118 | responseData = await _handleError(context, response, responseName, showLog, showMessage, showError); 119 | } 120 | }).catchError((error) { 121 | if (showLoader) LoaderWidget.hideLoader(context); 122 | debugPrint(error.toString()); 123 | }); 124 | } else { 125 | throw NoNetworkException; 126 | } 127 | return responseData; 128 | } 129 | 130 | Future putRequest( 131 | BuildContext context, 132 | var requestUri, 133 | Map map, { 134 | bool showError: false, 135 | bool showMessage: false, 136 | bool showLoader: false, 137 | bool useAuth: true, 138 | String responseName: "", 139 | bool showLog: true, 140 | bool showConnectivityError: true, 141 | int apiVersion: 1, 142 | }) async { 143 | ResponseData responseData = ResponseData(); 144 | if (showLog) { 145 | debugPrint("Requested URL: " + requestUri.toString()); 146 | debugPrint("Map: $map"); 147 | } 148 | var jsonBody = JsonEncoder().convert(map); 149 | if (await NetworkCheck.isOnline(context, showConnectivityError)) { 150 | if (showLoader) LoaderWidget.showLoader(context); 151 | 152 | await http 153 | .put(requestUri, body: jsonBody, headers: await _getHeaders(useAuth, apiVersion)) 154 | .timeout(Duration(seconds: _DEFAULT_TIMEOUT)) 155 | .then((http.Response response) async { 156 | if (showLoader) LoaderWidget.hideLoader(context); 157 | 158 | if (response.statusCode == 200 || response.statusCode == 201) { 159 | if (showLog) { 160 | debugPrint("$responseName Response: ${prettyJson(jsonDecode(response.body))}"); 161 | } 162 | responseData = ResponseData.fromResponse(response); 163 | } else { 164 | responseData = await _handleError(context, response, responseName, showLog, showMessage, showError); 165 | } 166 | }).catchError((error) { 167 | if (showLoader) LoaderWidget.hideLoader(context); 168 | debugPrint(error.toString()); 169 | }); 170 | } else { 171 | throw NoNetworkException; 172 | } 173 | return responseData; 174 | } 175 | 176 | Future patchRequest(BuildContext context, var requestUri, Map map, 177 | {bool showError: false, 178 | bool showMessage: false, 179 | bool showLoader: false, 180 | bool useAuth: true, 181 | String responseName: "", 182 | bool showLog: true, 183 | bool showConnectivityError: true, 184 | int apiVersion: 1}) async { 185 | ResponseData responseData = ResponseData(); 186 | if (showLog) { 187 | debugPrint("Requested URL: " + requestUri.toString()); 188 | debugPrint("Map: $map"); 189 | } 190 | var jsonBody = JsonEncoder().convert(map); 191 | if (await NetworkCheck.isOnline(context, showConnectivityError)) { 192 | if (showLoader) LoaderWidget.showLoader(context); 193 | 194 | await http 195 | .patch(requestUri, body: jsonBody, headers: await _getHeaders(useAuth, apiVersion)) 196 | .timeout(Duration(seconds: _DEFAULT_TIMEOUT)) 197 | .then((http.Response response) async { 198 | if (showLoader) LoaderWidget.hideLoader(context); 199 | 200 | if (response.statusCode == 200 || response.statusCode == 201) { 201 | if (showLog) { 202 | debugPrint("$responseName Response: ${prettyJson(jsonDecode(response.body))}"); 203 | } 204 | responseData = ResponseData.fromResponse(response); 205 | } else { 206 | responseData = await _handleError(context, response, responseName, showLog, showMessage, showError); 207 | } 208 | }).catchError((error) { 209 | if (showLoader) LoaderWidget.hideLoader(context); 210 | debugPrint(error.toString()); 211 | }); 212 | } else { 213 | throw NoNetworkException; 214 | } 215 | return responseData; 216 | } 217 | 218 | Future getRequest(BuildContext context, var requestUri, 219 | {bool showError: false, 220 | bool showMessage: false, 221 | bool showLoader: false, 222 | bool useAuth: true, 223 | String responseName: "", 224 | bool showLog: true, 225 | bool showConnectivityError: true, 226 | int apiVersion: 1}) async { 227 | ResponseData responseData = ResponseData(); 228 | if (showLog) { 229 | debugPrint("Requested URL: " + requestUri.toString()); 230 | } 231 | 232 | if (await NetworkCheck.isOnline(context, showConnectivityError)) { 233 | if (showLoader) LoaderWidget.showLoader(context); 234 | 235 | await http 236 | .get(requestUri, headers: await _getHeaders(useAuth, apiVersion)) 237 | .timeout(Duration(seconds: _DEFAULT_TIMEOUT)) 238 | .then((http.Response response) async { 239 | if (showLoader) LoaderWidget.hideLoader(context); 240 | 241 | if (response.statusCode == 200 || response.statusCode == 201) { 242 | if (showLog) { 243 | debugPrint("$responseName Response: ${prettyJson(jsonDecode(response.body))}"); 244 | } 245 | responseData = ResponseData.fromResponse(response); 246 | } else { 247 | responseData = await _handleError(context, response, responseName, showLog, showMessage, showError); 248 | } 249 | }).catchError((error) { 250 | if (showLoader) LoaderWidget.hideLoader(context); 251 | debugPrint(error.toString()); 252 | }); 253 | } else { 254 | throw NoNetworkException; 255 | } 256 | return responseData; 257 | } 258 | 259 | Future deleteRequest(BuildContext context, var requestUri, 260 | {bool showError: false, 261 | bool showMessage: false, 262 | bool showLoader: false, 263 | bool useAuth: true, 264 | String responseName: "", 265 | bool showLog: true, 266 | bool showConnectivityError: true, 267 | int apiVersion: 1}) async { 268 | ResponseData responseData = ResponseData(); 269 | if (showLog) { 270 | debugPrint("Requested URL: " + requestUri.toString()); 271 | } 272 | if (await NetworkCheck.isOnline(context, showConnectivityError)) { 273 | if (showLoader) LoaderWidget.showLoader(context); 274 | 275 | await http 276 | .delete(requestUri, headers: await _getHeaders(useAuth, apiVersion)) 277 | .timeout(Duration(seconds: _DEFAULT_TIMEOUT)) 278 | .then((http.Response response) async { 279 | if (showLoader) LoaderWidget.hideLoader(context); 280 | 281 | if (response.statusCode == 200 || response.statusCode == 201) { 282 | if (showLog) { 283 | debugPrint("$responseName Response: ${prettyJson(jsonDecode(response.body))}"); 284 | } 285 | 286 | responseData = ResponseData.fromResponse(response); 287 | } else { 288 | responseData = await _handleError(context, response, responseName, showLog, showMessage, showError); 289 | } 290 | }).catchError((error) { 291 | if (showLoader) LoaderWidget.hideLoader(context); 292 | debugPrint(error.toString()); 293 | }); 294 | } else { 295 | if (!showConnectivityError) throw NoNetworkException; 296 | } 297 | return responseData; 298 | } 299 | 300 | Future getRequestBG(var requestUri, 301 | {bool useAuth: true, String responseName: "", bool showLog: true, int apiVersion: 1}) async { 302 | return await getRequest(null, requestUri, 303 | showError: false, 304 | showLog: showLog, 305 | responseName: responseName, 306 | showLoader: false, 307 | useAuth: useAuth, 308 | apiVersion: apiVersion, 309 | showConnectivityError: false, 310 | showMessage: false); 311 | } 312 | 313 | Future postRequestBG(var requestUri, Map map, 314 | {bool useAuth: true, String responseName: "", bool showLog: true, int apiVersion: 1}) async { 315 | return await postRequest(null, requestUri, map, 316 | showError: false, 317 | showLog: showLog, 318 | responseName: responseName, 319 | showLoader: false, 320 | useAuth: useAuth, 321 | apiVersion: apiVersion, 322 | showConnectivityError: false, 323 | showMessage: false); 324 | } 325 | 326 | Future putRequestBG(var requestUri, Map map, 327 | {bool useAuth: true, String responseName: "", bool showLog: true, int apiVersion: 1}) async { 328 | return await putRequest(null, requestUri, map, 329 | showError: false, 330 | showLog: showLog, 331 | responseName: responseName, 332 | showLoader: false, 333 | useAuth: useAuth, 334 | apiVersion: apiVersion, 335 | showConnectivityError: false, 336 | showMessage: false); 337 | } 338 | 339 | Future patchRequestBG(var requestUri, Map map, 340 | {bool useAuth: true, String responseName: "", bool showLog: true, int apiVersion: 1}) async { 341 | return await patchRequest(null, requestUri, map, 342 | showError: false, 343 | showLog: showLog, 344 | responseName: responseName, 345 | showLoader: false, 346 | useAuth: useAuth, 347 | apiVersion: apiVersion, 348 | showConnectivityError: false, 349 | showMessage: false); 350 | } 351 | 352 | Future deleteRequestBG(var requestUri, 353 | {bool useAuth: true, String responseName: "", bool showLog: true, int apiVersion: 1}) async { 354 | return await deleteRequest(null, requestUri, 355 | showError: false, 356 | showLog: showLog, 357 | responseName: responseName, 358 | showLoader: false, 359 | useAuth: useAuth, 360 | apiVersion: apiVersion, 361 | showConnectivityError: false, 362 | showMessage: false); 363 | } 364 | } 365 | -------------------------------------------------------------------------------- /lib/utils/constants/api_constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_mvvm_boilerplate/utils/constants/app_constants.dart'; 2 | import 'package:flutter_mvvm_boilerplate/utils/constants/singleton_constant.dart'; 3 | 4 | ///Api Paths are set here 5 | class ApiConstants { 6 | //Check if build is production or staging and use url accordingly PRODUCTION : STAGING 7 | static const String SERVER_BASE_URL = AppConstants.isProdBuild ? "https://reqres.in" : "https://reqres.in"; 8 | 9 | ///NOTE: DO NOT TWEAK 10 | ///Assigning Application's base url which app is going to use. Can use URL from custom page or from SERVER_BASE_URL. 11 | ///Application have Safe checks so custom URL page will never show if isProdBuild flag in AppConstants is set as true 12 | static String appBaseURL = 13 | AppConstants.isCustomURLBuild && !AppConstants.isProdBuild ? SingletonConstants().getBaseUrl() : SERVER_BASE_URL; 14 | 15 | //Login end point 16 | //For new end points always start with "/". 17 | static const String LOGIN = "/api/login"; 18 | } 19 | 20 | ///NOTE: DO NOT TWEAK 21 | ///Getter to fetch baseURL easily. 22 | ///This will be available anywhere on APP level. 23 | String get baseURL => ApiConstants.appBaseURL; 24 | -------------------------------------------------------------------------------- /lib/utils/constants/app_constants.dart: -------------------------------------------------------------------------------- 1 | ///Application related constants are set here 2 | 3 | class AppConstants { 4 | static const String APP_NAME = 'Flutter Boiler Plate'; 5 | 6 | //Allows Developers to test on custom base URL by showing an custom URL screen at start up. 7 | //Application have Safe checks in main.dart so custom URL page will never show if isProdBuild flag in AppConstants is set as true. 8 | static const bool isCustomURLBuild = true; 9 | 10 | //Flutter level flag 11 | //Will set base URL to Production if set true. 12 | static const bool isProdBuild = false; 13 | 14 | static const Map Countries = { 15 | "India": "in", 16 | "United States of America": "us", 17 | }; 18 | } 19 | 20 | //API status enums 21 | enum ApiStatus { idle, started, completed, loading, searching, empty, failed, timeout } 22 | -------------------------------------------------------------------------------- /lib/utils/constants/color_constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | ///Application Colors constants are set here 4 | 5 | class ColorConstants { 6 | static const Color PRIMARY = Colors.blue; 7 | static const Color PRIMARY_DARK = Colors.blueAccent; 8 | static const Color GREEN = Colors.green; 9 | } 10 | -------------------------------------------------------------------------------- /lib/utils/constants/font_family_constants.dart: -------------------------------------------------------------------------------- 1 | ///Font Family constants are set here 2 | 3 | class FontFamilyConstants { 4 | static const String PLAY_FAIR_DISPLAY = "PlayfairDisplay"; 5 | } 6 | -------------------------------------------------------------------------------- /lib/utils/constants/singleton_constant.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_mvvm_boilerplate/utils/constants/api_constants.dart'; 2 | import 'package:flutter_mvvm_boilerplate/utils/shared_preferences_helper.dart'; 3 | 4 | /// This is Singleton Class. Data like user object, token etc can be stored here for easy access around the application. 5 | /// Always create a getter and setter for variables. 6 | /// Direct initialisation and access is not recommended. 7 | class SingletonConstants { 8 | static SingletonConstants _instance; 9 | 10 | factory SingletonConstants() => _instance ??= new SingletonConstants._(); 11 | 12 | SingletonConstants._(); 13 | 14 | String _baseUrl; 15 | String _authToken; 16 | 17 | String getBaseUrl() => _baseUrl != null ? _baseUrl : ApiConstants.SERVER_BASE_URL; 18 | 19 | void setBaseUrl(String baseURL) => _baseUrl = baseURL; 20 | 21 | Future get getToken async => _authToken != null ? _authToken : await SharedPreferencesHelper.getAuthTokenWithNullCheck(); 22 | } 23 | -------------------------------------------------------------------------------- /lib/utils/constants/size_constants.dart: -------------------------------------------------------------------------------- 1 | /// Common Size constants are set here 2 | 3 | class SizeConstants { 4 | //f denotes font sizes 5 | static const double fTITLE_TEXT = 16.0; 6 | 7 | //p denotes padding sizes 8 | static const double pCARD_LEFT = 8.0; 9 | static const double pCARD_RIGHT = 8.0; 10 | static const double pCARD_ALL = 8.0; 11 | } 12 | -------------------------------------------------------------------------------- /lib/utils/navigation_helper.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_mvvm_boilerplate/view_models/custom_url_view_model.dart'; 2 | import 'package:flutter_mvvm_boilerplate/view_models/login_view_model.dart'; 3 | import 'package:flutter_mvvm_boilerplate/views/custom_url_view.dart'; 4 | import 'package:flutter_mvvm_boilerplate/views/login_view.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | ///Navigation Helper 8 | ///Naming Standard: 9 | /// Fun that gives View with provider - getViewNameWithProvider() 10 | /// Fun that pushes View - gotoViewName() 11 | /// Fun(Data data) that pushes View with data - gotoViewNameWithData(data) 12 | /// Fun that clears stack and pushes View - clearAndGotoViewName 13 | /// 14 | /// 15 | class NavigationHelper { 16 | static getCustomURLViewWithProvider() { 17 | return MultiProvider( 18 | providers: [ 19 | ChangeNotifierProvider( 20 | create: (_) => CustomURLViewModel(), 21 | ) 22 | ], 23 | child: CustomURLView(), 24 | ); 25 | } 26 | 27 | static getLoginViewWithProvider() { 28 | return MultiProvider( 29 | providers: [ 30 | ChangeNotifierProvider( 31 | create: (_) => LoginViewModel(), 32 | ) 33 | ], 34 | child: LoginView(), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/utils/pretty_json_print.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | ///Helps printing formatted server response 4 | String prettyJson(dynamic json, {int indent = 2}) { 5 | var spaces = ' ' * indent; 6 | var encoder = JsonEncoder.withIndent(spaces); 7 | return encoder.convert(json); 8 | } 9 | 10 | void prettyJsonPrint(dynamic json, {int indent = 2}) { 11 | print(prettyJson(json, indent: indent)); 12 | } 13 | -------------------------------------------------------------------------------- /lib/utils/shared_preferences_helper.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | 3 | /// Common shared preference helper class 4 | class SharedPreferencesHelper { 5 | static final String _authToken = "authToken"; 6 | static final String _customURL = "customURL"; 7 | 8 | static Future getAuthToken() async { 9 | final SharedPreferences prefs = await SharedPreferences.getInstance(); 10 | return prefs.getString(_authToken); 11 | } 12 | 13 | //Returns empty String if token is not set 14 | static Future getAuthTokenWithNullCheck() async { 15 | final SharedPreferences prefs = await SharedPreferences.getInstance(); 16 | return prefs.getString(_authToken) ?? ""; 17 | } 18 | 19 | static Future setAuthToken(String value) async { 20 | final SharedPreferences prefs = await SharedPreferences.getInstance(); 21 | return prefs.setString(_authToken, value); 22 | } 23 | 24 | static Future clearAuthToken() async { 25 | final SharedPreferences prefs = await SharedPreferences.getInstance(); 26 | return prefs.remove(_authToken); 27 | } 28 | 29 | static Future getCustomURL() async { 30 | final SharedPreferences prefs = await SharedPreferences.getInstance(); 31 | return prefs.getString(_customURL); 32 | } 33 | 34 | static Future setCustomURL(String value) async { 35 | final SharedPreferences prefs = await SharedPreferences.getInstance(); 36 | return prefs.setString(_customURL, value); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/view_models/custom_url_view_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_mvvm_boilerplate/utils/constants/api_constants.dart'; 3 | import 'package:flutter_mvvm_boilerplate/utils/constants/singleton_constant.dart'; 4 | import 'package:flutter_mvvm_boilerplate/utils/shared_preferences_helper.dart'; 5 | import 'package:flutter_mvvm_boilerplate/views/login_view.dart'; 6 | import 'package:flutter_mvvm_boilerplate/widgets/alert_bar.dart'; 7 | 8 | class CustomURLViewModel with ChangeNotifier { 9 | TextEditingController urlTextFieldController = TextEditingController(); 10 | 11 | //Check if custom URL was set previously if true then re-set it in texfield 12 | void checkIfURLSetPreviously({@required BuildContext context}) async { 13 | String url = await SharedPreferencesHelper.getCustomURL(); 14 | if (url != null) { 15 | urlTextFieldController.text = url; 16 | } 17 | } 18 | 19 | //Set URL in singleton class and shared preference 20 | void setURL({@required BuildContext context}) async { 21 | if (urlTextFieldController.text.isEmpty) { 22 | AlertBar.show(context, title: "Enter URL", description: "Please enter a URL"); 23 | return; 24 | } 25 | SingletonConstants().setBaseUrl(urlTextFieldController.text.trim()); 26 | SharedPreferencesHelper.setCustomURL(urlTextFieldController.text.trim()); 27 | Navigator.pushNamedAndRemoveUntil(context, LoginView.TAG, (route) => false); 28 | } 29 | 30 | void setStaging({BuildContext context}) async { 31 | SingletonConstants().setBaseUrl(ApiConstants.SERVER_BASE_URL); 32 | Navigator.pushNamedAndRemoveUntil(context, LoginView.TAG, (route) => false); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/view_models/login_view_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_mvvm_boilerplate/models/login_model.dart'; 5 | import 'package:flutter_mvvm_boilerplate/models/response_data_model.dart'; 6 | import 'package:flutter_mvvm_boilerplate/services/api_service.dart'; 7 | import 'package:flutter_mvvm_boilerplate/utils/constants/app_constants.dart'; 8 | import 'package:flutter_mvvm_boilerplate/utils/constants/color_constants.dart'; 9 | import 'package:flutter_mvvm_boilerplate/utils/shared_preferences_helper.dart'; 10 | import 'package:flutter_mvvm_boilerplate/widgets/alert_bar.dart'; 11 | 12 | class LoginViewModel with ChangeNotifier { 13 | ApiStatus loadingStatus = ApiStatus.idle; 14 | 15 | TextEditingController emailTextFieldController = TextEditingController(text: "eve.holt@reqres.in"); 16 | TextEditingController passwordTextFieldController = TextEditingController(text: "cityslicka"); 17 | 18 | void loginUser({@required BuildContext context, bool logInWithCommonLoader: false}) async { 19 | if (emailTextFieldController.text.isEmpty) { 20 | AlertBar.show(context, title: "Enter email", description: "Please enter a Email"); 21 | return; 22 | } 23 | if (passwordTextFieldController.text.isEmpty) { 24 | AlertBar.show(context, title: "Enter password", description: "Please enter a Password"); 25 | return; 26 | } 27 | if (!logInWithCommonLoader) { 28 | loadingStatus = ApiStatus.started; 29 | notifyListeners(); 30 | } 31 | 32 | LoginModel _loginModel = LoginModel(email: emailTextFieldController.text.trim(), password: passwordTextFieldController.text); 33 | 34 | ResponseData responseData = 35 | await ApiService().loginUser(context: context, loginModel: _loginModel, logInWithCommonLoader: logInWithCommonLoader); 36 | 37 | if (responseData.ok) { 38 | //TODO: Push to next screen 39 | loadingStatus = ApiStatus.completed; 40 | String token = jsonDecode(responseData.rawResponseBody)['token']; 41 | SharedPreferencesHelper.setAuthToken(token); 42 | AlertBar.show(context, title: "Done", description: "Login Successful Token: $token", backgroundColor: ColorConstants.GREEN); 43 | } else { 44 | loadingStatus = ApiStatus.failed; 45 | } 46 | 47 | notifyListeners(); 48 | 49 | await Future.delayed(Duration(seconds: 3)); 50 | 51 | loadingStatus = ApiStatus.idle; 52 | notifyListeners(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/views/custom_url_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_mvvm_boilerplate/view_models/custom_url_view_model.dart'; 3 | import 'package:flutter_mvvm_boilerplate/widgets/common_button.dart'; 4 | import 'package:flutter_mvvm_boilerplate/widgets/common_text_field.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | class CustomURLView extends StatefulWidget { 8 | CustomURLView({Key key}) : super(key: key); 9 | 10 | static const String TAG = "/CustomURLView"; 11 | 12 | @override 13 | _CustomURLViewState createState() => _CustomURLViewState(); 14 | } 15 | 16 | class _CustomURLViewState extends State { 17 | @override 18 | void initState() { 19 | // TODO: implement initState 20 | super.initState(); 21 | Provider.of(context, listen: false).checkIfURLSetPreviously(); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | CustomURLViewModel _customURLViewModel = Provider.of(context); 27 | return Scaffold( 28 | appBar: AppBar( 29 | title: Text("Set Custom URL Page"), 30 | ), 31 | body: Column( 32 | children: [ 33 | Padding( 34 | padding: const EdgeInsets.only(top: 50), 35 | child: Text( 36 | "URL Format \n http://192.168.1.2:8080 \n https://hostingserver.com \n ", 37 | textAlign: TextAlign.center, 38 | style: TextStyle(fontSize: 17), 39 | ), 40 | ), 41 | CommonTextField( 42 | label: "Custom URL", 43 | hint: "Enter URL here", 44 | controller: _customURLViewModel.urlTextFieldController, 45 | ), 46 | CommonButton( 47 | title: "Set", 48 | function: () { 49 | _customURLViewModel.setURL(context: context); 50 | }, 51 | ), 52 | CommonButton( 53 | title: "Staging", 54 | function: () { 55 | _customURLViewModel.setStaging(context: context); 56 | }, 57 | ), 58 | ], 59 | ), 60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/views/login_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_mvvm_boilerplate/utils/constants/app_constants.dart'; 3 | import 'package:flutter_mvvm_boilerplate/utils/constants/color_constants.dart'; 4 | import 'package:flutter_mvvm_boilerplate/utils/constants/font_family_constants.dart'; 5 | import 'package:flutter_mvvm_boilerplate/view_models/login_view_model.dart'; 6 | import 'package:flutter_mvvm_boilerplate/widgets/common_button.dart'; 7 | import 'package:flutter_mvvm_boilerplate/widgets/common_text_field.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | class LoginView extends StatefulWidget { 11 | LoginView({Key key}) : super(key: key); 12 | 13 | static const String TAG = "/LoginView"; 14 | 15 | @override 16 | _LoginViewState createState() => _LoginViewState(); 17 | } 18 | 19 | class _LoginViewState extends State { 20 | @override 21 | void initState() { 22 | // TODO: implement initState 23 | super.initState(); 24 | } 25 | 26 | _buildSubmitButton(LoginViewModel loginViewModel) { 27 | switch (loginViewModel.loadingStatus) { 28 | case ApiStatus.started: 29 | return Padding( 30 | padding: EdgeInsets.all(8.0), 31 | child: CircularProgressIndicator(), 32 | ); 33 | case ApiStatus.completed: 34 | return Padding( 35 | padding: const EdgeInsets.only(top: 8.0), 36 | child: Icon( 37 | Icons.check, 38 | size: 40, 39 | color: ColorConstants.GREEN, 40 | ), 41 | ); 42 | 43 | default: 44 | return CommonButton( 45 | title: "Login with Widget Specific Loader", 46 | function: () { 47 | loginViewModel.loginUser(context: context); 48 | }, 49 | ); 50 | } 51 | } 52 | 53 | @override 54 | Widget build(BuildContext context) { 55 | LoginViewModel _loginViewModel = Provider.of(context); 56 | return Scaffold( 57 | ///This flag will allow to ignore Keyboard Overflow. 58 | resizeToAvoidBottomPadding: false, 59 | appBar: AppBar( 60 | title: Text( 61 | AppConstants.APP_NAME, 62 | style: TextStyle(fontFamily: FontFamilyConstants.PLAY_FAIR_DISPLAY), 63 | ), 64 | ), 65 | body: Column( 66 | children: [ 67 | Padding( 68 | padding: const EdgeInsets.only(top: 50, bottom: 10), 69 | child: Image.asset( 70 | "assets/images/logos/Google_flutter_logo.png", 71 | width: 150, 72 | )), 73 | CommonTextField( 74 | label: "Email", 75 | hint: "Enter Email here", 76 | controller: _loginViewModel.emailTextFieldController, 77 | ), 78 | CommonTextField( 79 | label: "Password", 80 | hint: "Enter Password here", 81 | controller: _loginViewModel.passwordTextFieldController, 82 | ), 83 | _buildSubmitButton(_loginViewModel), 84 | CommonButton( 85 | title: "Login with Common Loader", 86 | function: () { 87 | _loginViewModel.loginUser(context: context, logInWithCommonLoader: true); 88 | }, 89 | ) 90 | ], 91 | ), 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/widgets/alert_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AlertBar { 4 | static final int LENGTH_SHORT = 1; //1 seconds 5 | static final int LENGTH_LONG = 2; // 2 seconds 6 | static final int LENGTH_VERY_LONG = 3; // 3 seconds 7 | 8 | static final int TOP = 1; 9 | static final int BOTTOM = 2; 10 | 11 | static void show(BuildContext context, 12 | {String title, String description, int duration, int gravity, Color backgroundColor, IconData icon}) { 13 | OverlayView.createView(context, 14 | title: title, description: description, duration: duration, gravity: gravity, backgroundColor: backgroundColor, icon: icon); 15 | } 16 | } 17 | 18 | class OverlayView { 19 | static final OverlayView _singleton = new OverlayView._internal(); 20 | 21 | factory OverlayView() { 22 | return _singleton; 23 | } 24 | 25 | OverlayView._internal(); 26 | 27 | static OverlayState _overlayState; 28 | static OverlayEntry _overlayEntry; 29 | static bool _isVisible = false; 30 | 31 | static void createView(BuildContext context, 32 | {String title, String description, int duration, int gravity, Color backgroundColor, IconData icon}) { 33 | _overlayState = Navigator.of(context).overlay; 34 | 35 | if (!_isVisible) { 36 | _isVisible = true; 37 | 38 | _overlayEntry = OverlayEntry(builder: (context) { 39 | return EdgeOverlay( 40 | title: title, 41 | description: description, 42 | overlayDuration: duration == null ? AlertBar.LENGTH_SHORT : duration, 43 | gravity: gravity == null ? AlertBar.TOP : gravity, 44 | backgroundColor: backgroundColor == null ? Colors.grey : backgroundColor, 45 | icon: icon == null ? Icons.notifications : icon, 46 | ); 47 | }); 48 | 49 | _overlayState.insert(_overlayEntry); 50 | } 51 | } 52 | 53 | static dismiss() async { 54 | if (!_isVisible) { 55 | return; 56 | } 57 | _isVisible = false; 58 | _overlayEntry?.remove(); 59 | } 60 | } 61 | 62 | class EdgeOverlay extends StatefulWidget { 63 | final String title; 64 | final String description; 65 | final int overlayDuration; 66 | final int gravity; 67 | final Color backgroundColor; 68 | final IconData icon; 69 | 70 | EdgeOverlay({this.title, this.description, this.overlayDuration, this.gravity, this.backgroundColor, this.icon}); 71 | 72 | @override 73 | _EdgeOverlayState createState() => _EdgeOverlayState(); 74 | } 75 | 76 | class _EdgeOverlayState extends State with SingleTickerProviderStateMixin { 77 | AnimationController _controller; 78 | Tween _positionTween; 79 | Animation _positionAnimation; 80 | 81 | @override 82 | void initState() { 83 | super.initState(); 84 | 85 | _controller = AnimationController(vsync: this, duration: Duration(milliseconds: 750)); 86 | 87 | if (widget.gravity == 1) { 88 | _positionTween = Tween(begin: Offset(0.0, -1.0), end: Offset.zero); 89 | } else { 90 | _positionTween = Tween(begin: Offset(0.0, 1.0), end: Offset(0.0, 0)); 91 | } 92 | 93 | _positionAnimation = _positionTween.animate(CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn)); 94 | 95 | _controller.forward(); 96 | 97 | listenToAnimation(); 98 | } 99 | 100 | listenToAnimation() async { 101 | _controller.addStatusListener((listener) async { 102 | if (listener == AnimationStatus.completed) { 103 | await Future.delayed(Duration(seconds: widget.overlayDuration)); 104 | _controller.reverse(); 105 | await Future.delayed(Duration(milliseconds: 700)); 106 | OverlayView.dismiss(); 107 | } 108 | }); 109 | } 110 | 111 | @override 112 | void dispose() { 113 | _controller.dispose(); 114 | super.dispose(); 115 | } 116 | 117 | @override 118 | Widget build(BuildContext context) { 119 | final double statusBarHeight = MediaQuery.of(context).padding.top; 120 | final double bottomHeight = MediaQuery.of(context).padding.bottom; 121 | 122 | return Positioned( 123 | top: widget.gravity == 1 ? 0 : null, 124 | bottom: widget.gravity == 2 ? 0 : null, 125 | child: SlideTransition( 126 | position: _positionAnimation, 127 | child: Container( 128 | width: MediaQuery.of(context).size.width, 129 | padding: 130 | EdgeInsets.fromLTRB(20, widget.gravity == 1 ? statusBarHeight + 20 : bottomHeight + 20, 20, widget.gravity == 1 ? 20 : 35), 131 | color: widget.backgroundColor, 132 | child: OverlayWidget( 133 | title: widget.title, 134 | description: widget.description, 135 | iconData: widget.icon, 136 | ), 137 | ), 138 | ), 139 | ); 140 | } 141 | } 142 | 143 | class OverlayWidget extends StatelessWidget { 144 | final String title; 145 | final String description; 146 | final IconData iconData; 147 | 148 | OverlayWidget({this.title = '', this.description = '', this.iconData}); 149 | 150 | @override 151 | Widget build(BuildContext context) { 152 | return Material( 153 | type: MaterialType.transparency, 154 | child: Row( 155 | children: [ 156 | AnimatedIcon(iconData: iconData), 157 | Padding(padding: EdgeInsets.only(right: 15)), 158 | Expanded( 159 | child: Column( 160 | crossAxisAlignment: CrossAxisAlignment.start, 161 | children: [ 162 | title == null 163 | ? Container() 164 | : Padding( 165 | padding: EdgeInsets.only(bottom: 10), 166 | child: Text( 167 | title, 168 | style: TextStyle(color: Colors.white, fontSize: 22), 169 | ), 170 | ), 171 | description == null 172 | ? Container() 173 | : Text( 174 | description, 175 | style: TextStyle(color: Colors.white, fontSize: 14), 176 | ) 177 | ], 178 | )), 179 | ], 180 | ), 181 | ); 182 | } 183 | } 184 | 185 | class AnimatedIcon extends StatefulWidget { 186 | final IconData iconData; 187 | 188 | AnimatedIcon({this.iconData}); 189 | 190 | @override 191 | _AnimatedIconState createState() => _AnimatedIconState(); 192 | } 193 | 194 | class _AnimatedIconState extends State with SingleTickerProviderStateMixin { 195 | AnimationController _controller; 196 | 197 | @override 198 | void initState() { 199 | super.initState(); 200 | _controller = AnimationController(vsync: this, lowerBound: 0.8, upperBound: 1.1, duration: Duration(milliseconds: 600)); 201 | 202 | _controller.forward(); 203 | listenToAnimation(); 204 | } 205 | 206 | listenToAnimation() async { 207 | _controller.addStatusListener((listener) async { 208 | if (listener == AnimationStatus.completed) { 209 | _controller.reverse(); 210 | } 211 | if (listener == AnimationStatus.dismissed) { 212 | _controller.forward(); 213 | } 214 | }); 215 | } 216 | 217 | @override 218 | void dispose() { 219 | _controller.dispose(); 220 | super.dispose(); 221 | } 222 | 223 | @override 224 | Widget build(BuildContext context) { 225 | return Container( 226 | child: AnimatedBuilder( 227 | animation: _controller, 228 | child: Icon( 229 | widget.iconData, 230 | size: 35, 231 | color: Colors.white, 232 | ), 233 | builder: (context, widget) => Transform.scale(scale: _controller.value, child: widget), 234 | ), 235 | ); 236 | } 237 | } 238 | -------------------------------------------------------------------------------- /lib/widgets/common_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CommonButton extends StatefulWidget { 4 | CommonButton({ 5 | Key key, 6 | this.function, 7 | this.title, 8 | }) : super(key: key); 9 | 10 | final Function function; 11 | final String title; 12 | 13 | @override 14 | _CommonButtonState createState() => _CommonButtonState(); 15 | } 16 | 17 | class _CommonButtonState extends State { 18 | @override 19 | Widget build(BuildContext context) { 20 | return GestureDetector( 21 | onTap: widget.function, 22 | child: Padding( 23 | padding: const EdgeInsets.all(8.0), 24 | child: RaisedButton( 25 | onPressed: widget.function, 26 | child: Text(widget.title), 27 | ))); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/widgets/common_text_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CommonTextField extends StatefulWidget { 4 | CommonTextField({Key key, this.controller, this.label, this.hint, this.isPassword: false}) : super(key: key); 5 | 6 | final TextEditingController controller; 7 | final String label; 8 | final String hint; 9 | final bool isPassword; 10 | 11 | @override 12 | _CommonTextFieldState createState() => _CommonTextFieldState(); 13 | } 14 | 15 | class _CommonTextFieldState extends State { 16 | @override 17 | Widget build(BuildContext context) { 18 | return Padding( 19 | padding: const EdgeInsets.fromLTRB(8.0, 4.0, 8.0, 0.0), 20 | child: TextFormField( 21 | controller: widget.controller, 22 | obscureText: widget.isPassword, 23 | decoration: InputDecoration(hintText: widget.hint, labelText: widget.label), 24 | )); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/widgets/loader_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class LoaderWidget { 4 | static OverlayEntry _overlayEntry; 5 | static bool _onScreen = false; 6 | 7 | static bool isLoaderOn() => _onScreen; 8 | 9 | static void showLoader(BuildContext context) { 10 | FocusScope.of(context).requestFocus(new FocusNode()); 11 | 12 | hideLoader(context); 13 | 14 | _overlayEntry = createOverlayEntry(context); 15 | Overlay.of(context).insert(_overlayEntry); 16 | _onScreen = true; 17 | } 18 | 19 | static void hideLoader(BuildContext context) { 20 | if (_onScreen) { 21 | _overlayEntry.remove(); 22 | _onScreen = false; 23 | } 24 | } 25 | 26 | //Loader can be changed from here 27 | static OverlayEntry createOverlayEntry(BuildContext context) { 28 | return OverlayEntry( 29 | builder: (context) => Positioned( 30 | bottom: 0, 31 | top: 0, 32 | left: 0, 33 | right: 0, 34 | child: Material( 35 | elevation: 0.0, 36 | color: Colors.transparent, 37 | child: Container( 38 | child: Center( 39 | child: CircularProgressIndicator(), 40 | ), 41 | )), 42 | )); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.5.0-nullsafety.1" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0-nullsafety.1" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0-nullsafety.3" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.2.0-nullsafety.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0-nullsafety.1" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0-nullsafety.3" 46 | connectivity: 47 | dependency: "direct main" 48 | description: 49 | name: connectivity 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.0.2" 53 | connectivity_for_web: 54 | dependency: transitive 55 | description: 56 | name: connectivity_for_web 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "0.3.1+4" 60 | connectivity_macos: 61 | dependency: transitive 62 | description: 63 | name: connectivity_macos 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "0.1.0+7" 67 | connectivity_platform_interface: 68 | dependency: transitive 69 | description: 70 | name: connectivity_platform_interface 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.0.6" 74 | cupertino_icons: 75 | dependency: "direct main" 76 | description: 77 | name: cupertino_icons 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "1.0.0" 81 | fake_async: 82 | dependency: transitive 83 | description: 84 | name: fake_async 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.2.0-nullsafety.1" 88 | ffi: 89 | dependency: transitive 90 | description: 91 | name: ffi 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "0.1.3" 95 | file: 96 | dependency: transitive 97 | description: 98 | name: file 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "5.2.1" 102 | flutter: 103 | dependency: "direct main" 104 | description: flutter 105 | source: sdk 106 | version: "0.0.0" 107 | flutter_test: 108 | dependency: "direct dev" 109 | description: flutter 110 | source: sdk 111 | version: "0.0.0" 112 | flutter_web_plugins: 113 | dependency: transitive 114 | description: flutter 115 | source: sdk 116 | version: "0.0.0" 117 | http: 118 | dependency: "direct main" 119 | description: 120 | name: http 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "0.12.1" 124 | http_parser: 125 | dependency: transitive 126 | description: 127 | name: http_parser 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "3.1.4" 131 | intl: 132 | dependency: transitive 133 | description: 134 | name: intl 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "0.16.1" 138 | matcher: 139 | dependency: transitive 140 | description: 141 | name: matcher 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "0.12.10-nullsafety.1" 145 | meta: 146 | dependency: transitive 147 | description: 148 | name: meta 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.3.0-nullsafety.3" 152 | nested: 153 | dependency: transitive 154 | description: 155 | name: nested 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "0.0.4" 159 | path: 160 | dependency: transitive 161 | description: 162 | name: path 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.8.0-nullsafety.1" 166 | path_provider_linux: 167 | dependency: transitive 168 | description: 169 | name: path_provider_linux 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "0.0.1+2" 173 | path_provider_platform_interface: 174 | dependency: transitive 175 | description: 176 | name: path_provider_platform_interface 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.0.4" 180 | path_provider_windows: 181 | dependency: transitive 182 | description: 183 | name: path_provider_windows 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "0.0.4+3" 187 | pedantic: 188 | dependency: transitive 189 | description: 190 | name: pedantic 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "1.9.2" 194 | platform: 195 | dependency: transitive 196 | description: 197 | name: platform 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "2.2.1" 201 | plugin_platform_interface: 202 | dependency: transitive 203 | description: 204 | name: plugin_platform_interface 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "1.0.3" 208 | process: 209 | dependency: transitive 210 | description: 211 | name: process 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "3.0.13" 215 | provider: 216 | dependency: "direct main" 217 | description: 218 | name: provider 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "4.3.3" 222 | shared_preferences: 223 | dependency: "direct main" 224 | description: 225 | name: shared_preferences 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "0.5.12+4" 229 | shared_preferences_linux: 230 | dependency: transitive 231 | description: 232 | name: shared_preferences_linux 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "0.0.2+4" 236 | shared_preferences_macos: 237 | dependency: transitive 238 | description: 239 | name: shared_preferences_macos 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "0.0.1+11" 243 | shared_preferences_platform_interface: 244 | dependency: transitive 245 | description: 246 | name: shared_preferences_platform_interface 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "1.0.4" 250 | shared_preferences_web: 251 | dependency: transitive 252 | description: 253 | name: shared_preferences_web 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "0.1.2+7" 257 | shared_preferences_windows: 258 | dependency: transitive 259 | description: 260 | name: shared_preferences_windows 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "0.0.2+3" 264 | sky_engine: 265 | dependency: transitive 266 | description: flutter 267 | source: sdk 268 | version: "0.0.99" 269 | source_span: 270 | dependency: transitive 271 | description: 272 | name: source_span 273 | url: "https://pub.dartlang.org" 274 | source: hosted 275 | version: "1.8.0-nullsafety.2" 276 | stack_trace: 277 | dependency: transitive 278 | description: 279 | name: stack_trace 280 | url: "https://pub.dartlang.org" 281 | source: hosted 282 | version: "1.10.0-nullsafety.1" 283 | stream_channel: 284 | dependency: transitive 285 | description: 286 | name: stream_channel 287 | url: "https://pub.dartlang.org" 288 | source: hosted 289 | version: "2.1.0-nullsafety.1" 290 | string_scanner: 291 | dependency: transitive 292 | description: 293 | name: string_scanner 294 | url: "https://pub.dartlang.org" 295 | source: hosted 296 | version: "1.1.0-nullsafety.1" 297 | term_glyph: 298 | dependency: transitive 299 | description: 300 | name: term_glyph 301 | url: "https://pub.dartlang.org" 302 | source: hosted 303 | version: "1.2.0-nullsafety.1" 304 | test_api: 305 | dependency: transitive 306 | description: 307 | name: test_api 308 | url: "https://pub.dartlang.org" 309 | source: hosted 310 | version: "0.2.19-nullsafety.2" 311 | typed_data: 312 | dependency: transitive 313 | description: 314 | name: typed_data 315 | url: "https://pub.dartlang.org" 316 | source: hosted 317 | version: "1.3.0-nullsafety.3" 318 | vector_math: 319 | dependency: transitive 320 | description: 321 | name: vector_math 322 | url: "https://pub.dartlang.org" 323 | source: hosted 324 | version: "2.1.0-nullsafety.3" 325 | win32: 326 | dependency: transitive 327 | description: 328 | name: win32 329 | url: "https://pub.dartlang.org" 330 | source: hosted 331 | version: "1.7.4+1" 332 | xdg_directories: 333 | dependency: transitive 334 | description: 335 | name: xdg_directories 336 | url: "https://pub.dartlang.org" 337 | source: hosted 338 | version: "0.1.2" 339 | sdks: 340 | dart: ">=2.10.0-110 <2.11.0" 341 | flutter: ">=1.16.0 <2.0.0" 342 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_mvvm_boilerplate 2 | description: Ready to use flutter boiler plate 3 | 4 | 5 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 6 | 7 | version: 1.0.0+1 8 | 9 | environment: 10 | sdk: ">=2.7.0 <3.0.0" 11 | 12 | dependencies: 13 | flutter: 14 | sdk: flutter 15 | 16 | 17 | cupertino_icons: ^1.0.0 18 | http: 0.12.1 19 | connectivity: 2.0.2 20 | shared_preferences: 0.5.12+4 21 | provider: 4.3.3 22 | 23 | 24 | dev_dependencies: 25 | flutter_test: 26 | sdk: flutter 27 | 28 | # For information on the generic Dart part of this file, see the 29 | # following page: https://dart.dev/tools/pub/pubspec 30 | 31 | # The following section is specific to Flutter. 32 | flutter: 33 | 34 | # The following line ensures that the Material Icons font is 35 | # included with your application, so that you can use the icons in 36 | # the material Icons class. 37 | uses-material-design: true 38 | 39 | # To add assets to your application, add an assets section, like this: 40 | assets: 41 | - assets/images/ 42 | - assets/images/icons/ 43 | - assets/images/backgrounds/ 44 | - assets/images/logos/ 45 | 46 | # An image asset can refer to one or more resolution-specific "variants", see 47 | # https://flutter.dev/assets-and-images/#resolution-aware. 48 | # fonts: 49 | # - family: Schyler 50 | # fonts: 51 | # - asset: fonts/Schyler-Regular.ttf 52 | # - asset: fonts/Schyler-Italic.ttf 53 | # style: italic 54 | # - family: Trajan Pro 55 | # fonts: 56 | # - asset: fonts/TrajanPro.ttf 57 | # - asset: fonts/TrajanPro_Bold.ttf 58 | # weight: 700 59 | # 60 | # For details regarding fonts from package dependencies, 61 | # see https://flutter.dev/custom-fonts/#from-packages 62 | 63 | fonts: 64 | - family: PlayfairDisplay 65 | fonts: 66 | - asset: assets/fonts/PlayfairDisplay-Regular.ttf 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | void main() { 12 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 13 | // Build our app and trigger a frame. 14 | // await tester.pumpWidget(MyApp()); 15 | 16 | // Verify that our counter starts at 0. 17 | expect(find.text('0'), findsOneWidget); 18 | expect(find.text('1'), findsNothing); 19 | 20 | // Tap the '+' icon and trigger a frame. 21 | await tester.tap(find.byIcon(Icons.add)); 22 | await tester.pump(); 23 | 24 | // Verify that our counter has incremented. 25 | expect(find.text('0'), findsNothing); 26 | expect(find.text('1'), findsOneWidget); 27 | }); 28 | } 29 | --------------------------------------------------------------------------------