generated from hasancse91/flutter_getx_template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7b554e8
Showing
183 changed files
with
6,662 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
|
||
# IntelliJ related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# VS Code | ||
.vscode/ | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
**/ios/Flutter/.last_build_id | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
.packages | ||
.pub-cache/ | ||
.pub/ | ||
/build/ | ||
|
||
# Web related | ||
lib/generated_plugin_registrant.dart | ||
|
||
# Symbolication related | ||
app.*.symbols | ||
|
||
# Obfuscation related | ||
app.*.map.json | ||
|
||
# Android related | ||
**/android/**/gradle-wrapper.jar | ||
**/android/.gradle | ||
**/android/captures/ | ||
**/android/gradlew | ||
**/android/gradlew.bat | ||
**/android/local.properties | ||
**/android/**/GeneratedPluginRegistrant.java | ||
|
||
# iOS/XCode related | ||
**/ios/**/*.mode1v3 | ||
**/ios/**/*.mode2v3 | ||
**/ios/**/*.moved-aside | ||
**/ios/**/*.pbxuser | ||
**/ios/**/*.perspectivev3 | ||
**/ios/**/*sync/ | ||
**/ios/**/.sconsign.dblite | ||
**/ios/**/.tags* | ||
**/ios/**/.vagrant/ | ||
**/ios/**/DerivedData/ | ||
**/ios/**/Icon? | ||
**/ios/**/Pods/ | ||
**/ios/**/.symlinks/ | ||
**/ios/**/profile | ||
**/ios/**/xcuserdata | ||
**/ios/.generated/ | ||
**/ios/Flutter/App.framework | ||
**/ios/Flutter/Flutter.framework | ||
**/ios/Flutter/Generated.xcconfig | ||
**/ios/Flutter/app.flx | ||
**/ios/Flutter/app.zip | ||
**/ios/Flutter/flutter_assets/ | ||
**/ios/ServiceDefinitions.json | ||
**/ios/Runner/GeneratedPluginRegistrant.* | ||
|
||
### Android ### | ||
# Built application files | ||
*.apk | ||
*.aar | ||
*.ap_ | ||
*.aab | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
release/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Flutter version manager related | ||
.fvm/ | ||
.fvm/* | ||
|
||
*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: f4abaa0735eba4dfd8f33f73363911d63931fe03 | ||
channel: stable | ||
|
||
project_type: app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Hasan Abdullah | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Flutter GetX Template (GetX, Dio, MVVM) | ||
|
||
This Flutter Template using [GetX](https://pub.dev/packages/get) package for State management, routing and Dependency Injection (bindings). We are using [MVVM](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel) (Model View ViewModel) architectural pattern here. For network call we are using [Dio](https://pub.dev/packages/dio) package. We followed the recommended folder structure of GetX and used [Get CLI](https://pub.dev/packages/get_cli) command line tool for creating the folder structure. | ||
|
||
# Architecture of this project: MVVM | ||
|
||
MVVM (Model View ViewModel) is one of the most popular architectural pattern for Android App development. Basically | ||
this pattern separates User interface from business-logic and data-logic. So that it's divided into three layers: Model layer, | ||
View layer and View model layer. Let's explore it more deeply. | ||
|
||
![mvvm](https://user-images.githubusercontent.com/3769029/137336079-1f3384d0-b9d6-4462-a2c4-4a3d2cc77e8a.png) | ||
|
||
<b>ViewModel:</b> At first let's talk about ViewModel. Actually view model is a controller where we | ||
implement our business logics. It receives the data from the model and process the data according to | ||
business logic and pushed into the live data observers which is observing by view. | ||
|
||
<b>View:</b> View is the collections of widgets like Text, Image, Dropdown etc. Which will be displayed | ||
to the users. Even it controls the user input. When it needs any data it command the view model (In this project it's controller) | ||
for data and observe the response. Till then it may display a loader to the user. | ||
|
||
<b>Model:</b> Model is basically backend logic. It controls the data source. | ||
|
||
# To configure and run this project [check here](readme_configuration_guideline.md) | ||
You will find at above link step by step instructions with screenshots. | ||
|
||
# How to update app information and continue development for your own project? | ||
|
||
1. Rename root folder name | ||
2. Update project name and description from pubspec.yaml. | ||
3. Update app launcher name and icon. [Reference](https://medium.com/@vaibhavi.rana99/change-application-name-and-icon-in-flutter-bebbec297c57) | ||
4. Update your app's package name by [running this command](https://pub.dev/packages/change_app_package_name): | ||
|
||
`flutter pub run change_app_package_name:main your_package_name` | ||
|
||
# How was this project developed? | ||
- Run [get cli](https://pub.dev/packages/get_cli) command to create project in the required directory: `get create project` | ||
- Create `main_view` by running this command: `get create page:main` and so on... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
analyzer: | ||
exclude: [ ios/**, android/**, test/** ] | ||
plugins: | ||
- dart_code_metrics | ||
|
||
errors: | ||
empty_constructor_bodies: error | ||
missing_required_param: error | ||
always_use_package_imports: error | ||
avoid_types_as_parameter_names: error | ||
close_sinks: error | ||
unnecessary_statements: warning | ||
non_constant_identifier_names: warning | ||
|
||
linter: | ||
rules: | ||
camel_case_types: true | ||
# prefer_double_quotes: true | ||
avoid_empty_else: true | ||
constant_identifier_names: false | ||
use_key_in_widget_constructors: false | ||
|
||
dart_code_metrics: | ||
anti-patterns: | ||
- long-method | ||
- long-parameter-list | ||
metrics: | ||
cyclomatic-complexity: 20 | ||
maximum-nesting-level: 5 | ||
number-of-parameters: 8 | ||
source-lines-of-code: 50 | ||
metrics-exclude: | ||
- test/** | ||
- ios/** | ||
- android/** | ||
rules: | ||
newline-before-return: | ||
severity: error | ||
no-boolean-literal-compare: | ||
severity: warning | ||
no-empty-block: | ||
severity: error | ||
# avoid-returning-widgets: | ||
# severity: none | ||
prefer-conditional-expressions: | ||
severity: warning | ||
no-magic-number: | ||
severity: error | ||
allowed: [ 0,1,2,3,4,5,6,7,8,9 ] | ||
# avoid-unused-parameters: | ||
# severity: warning | ||
|
||
|
||
|
||
# severity -> none, style, performance, warning, error. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
gradle-wrapper.jar | ||
/.gradle | ||
/captures/ | ||
/gradlew | ||
/gradlew.bat | ||
/local.properties | ||
GeneratedPluginRegistrant.java | ||
|
||
# Remember to never publicly share your keystore. | ||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app | ||
key.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import java.util.regex.Matcher | ||
import java.util.regex.Pattern | ||
|
||
def localProperties = loadPropertiesFile('local.properties') | ||
def keystoreProperties = loadPropertiesFile('key.properties') | ||
|
||
def flutterRoot = localProperties.getProperty('flutter.sdk') | ||
if (flutterRoot == null) { | ||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | ||
} | ||
|
||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||
if (flutterVersionCode == null) { | ||
flutterVersionCode = '1' | ||
} | ||
|
||
def flutterVersionName = localProperties.getProperty('flutter.versionName') | ||
if (flutterVersionName == null) { | ||
flutterVersionName = '1.0' | ||
} | ||
|
||
def loadPropertiesFile(String fileName) { | ||
println(fileName) | ||
def properties = new Properties() | ||
def propertiesFile = rootProject.file(fileName) | ||
if (propertiesFile.exists()) { | ||
propertiesFile.withReader('UTF-8') { reader -> | ||
properties.load(reader) | ||
} | ||
} | ||
return properties | ||
} | ||
|
||
def getCurrentFlavor() { | ||
Gradle gradle = getGradle() | ||
String tskReqStr = gradle.getStartParameter().getTaskRequests().toString() | ||
|
||
Pattern pattern | ||
println(tskReqStr) | ||
if( tskReqStr.contains( "assemble" ) ) | ||
pattern = Pattern.compile("assemble(\\w+)(Release|Debug)") | ||
else if( tskReqStr.contains("bundle") ) | ||
pattern = Pattern.compile("bundle(\\w+)(Release|Debug)") | ||
else | ||
pattern = Pattern.compile("generate(\\w+)(Release|Debug)") | ||
|
||
Matcher matcher = pattern.matcher( tskReqStr ) | ||
|
||
if( matcher.find() ) | ||
return matcher.group(1).toLowerCase() | ||
else | ||
{ | ||
println "NO MATCH FOUND" | ||
return "" | ||
} | ||
} | ||
|
||
apply plugin: 'com.android.application' | ||
apply plugin: 'kotlin-android' | ||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | ||
|
||
android { | ||
compileSdkVersion 30 | ||
|
||
sourceSets { | ||
main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
|
||
defaultConfig { | ||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||
applicationId "com.hellohasan.flutter_getx_template" | ||
minSdkVersion 19 | ||
targetSdkVersion 30 | ||
versionCode flutterVersionCode.toInteger() | ||
versionName flutterVersionName | ||
} | ||
|
||
lintOptions { | ||
checkReleaseBuilds false | ||
} | ||
|
||
signingConfigs { | ||
release { | ||
keyAlias keystoreProperties['keyAlias'] | ||
keyPassword keystoreProperties['password'] | ||
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null | ||
storePassword keystoreProperties['password'] | ||
} | ||
} | ||
|
||
buildTypes { | ||
release { | ||
signingConfig signingConfigs.release | ||
} | ||
} | ||
|
||
flavorDimensions "default" | ||
productFlavors { | ||
dev { | ||
dimension "default" | ||
applicationIdSuffix ".dev" | ||
} | ||
prod { | ||
dimension "default" | ||
} | ||
} | ||
} | ||
|
||
flutter { | ||
source '../..' | ||
target "lib/main_" + getCurrentFlavor() + ".dart" | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.hellohasan.flutter_getx_template"> | ||
<!-- Flutter needs it to communicate with the running application | ||
to allow setting breakpoints, to provide hot reload, etc. | ||
--> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
</manifest> |
Oops, something went wrong.