Skip to content

Commit c3266d8

Browse files
AbbasMathiewaumbjohsoe
authored
feat: added flavors for android and IOS (#58)
* feat: added flavors for android and IOS * fix: specified flavor in pull request validation --------- Co-authored-by: Mathiew Abbas <[email protected]> Co-authored-by: Johnny Sørensen <[email protected]>
1 parent 640a8cb commit c3266d8

File tree

11 files changed

+790
-98
lines changed

11 files changed

+790
-98
lines changed

.github/workflows/pull_request_validation.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ jobs:
88
- uses: actions/checkout@v1
99
- uses: actions/setup-java@v1
1010
with:
11-
java-version: '12.x'
11+
java-version: "12.x"
1212
- uses: subosito/flutter-action@v1
1313
with:
14-
channel: 'stable'
14+
channel: "stable"
1515
- run: flutter pub get
1616
- run: flutter pub run build_runner build --delete-conflicting-outputs
17-
- run: flutter build apk --release -t lib/main_production.dart
17+
- run: flutter build apk --release --flavor production -t lib/main_production.dart
1818
- run: flutter analyze
1919
- run: flutter test

.vscode/launch.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Development",
9+
"request": "launch",
10+
"type": "dart",
11+
"program": "lib/main_development.dart",
12+
"args": [
13+
"--flavor",
14+
"development"
15+
]
16+
},
17+
{
18+
"name": "Staging",
19+
"request": "launch",
20+
"type": "dart",
21+
"program": "lib/main_staging.dart",
22+
"args": [
23+
"--flavor",
24+
"staging"
25+
]
26+
},
27+
{
28+
"name": "Production",
29+
"request": "launch",
30+
"type": "dart",
31+
"program": "lib/main_production.dart",
32+
"args": [
33+
"--flavor",
34+
"production"
35+
]
36+
},
37+
]
38+
}

android/app/build.gradle

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,34 @@ android {
5757
signingConfig signingConfigs.debug
5858
}
5959
}
60+
61+
//TODO: Change resValue application name
62+
flavorDimensions "flavor-type"
63+
64+
productFlavors {
65+
development {
66+
dimension "flavor-type"
67+
applicationIdSuffix ".development"
68+
versionNameSuffix "-development"
69+
resValue "string", "app_name", "Application Name Development"
70+
signingConfig signingConfigs.debug
71+
}
72+
staging {
73+
dimension "flavor-type"
74+
applicationIdSuffix ".staging"
75+
versionNameSuffix "-staging"
76+
resValue "string", "app_name", "Application Name Staging"
77+
signingConfig signingConfigs.debug
78+
}
79+
production {
80+
dimension "flavor-type"
81+
resValue "string", "app_name", "Application Name"
82+
// TODO: After adding your own signing config for the release build.
83+
// Change this to signingConfigs.release
84+
signingConfig signingConfigs.debug
85+
}
86+
87+
}
6088
}
6189

6290
flutter {

android/app/src/main/AndroidManifest.xml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.example.flutter_template">
3-
<application
4-
android:label="flutter_template"
5-
android:name="${applicationName}"
6-
android:icon="@mipmap/ic_launcher">
3+
4+
<application
5+
android:icon="@mipmap/ic_launcher"
6+
android:label="@string/app_name">
77
<activity
88
android:name=".MainActivity"
9+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
910
android:exported="true"
11+
android:hardwareAccelerated="true"
1012
android:launchMode="singleTop"
1113
android:theme="@style/LaunchTheme"
12-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
13-
android:hardwareAccelerated="true"
1414
android:windowSoftInputMode="adjustResize">
1515
<!-- Specifies an Android theme to apply to this Activity as soon as
1616
the Android process has started. This theme is visible to the user
1717
while the Flutter UI initializes. After that, this theme continues
1818
to determine the Window background behind the Flutter UI. -->
1919
<meta-data
20-
android:name="io.flutter.embedding.android.NormalTheme"
21-
android:resource="@style/NormalTheme"
22-
/>
20+
android:name="io.flutter.embedding.android.NormalTheme"
21+
android:resource="@style/NormalTheme" />
2322
<intent-filter>
24-
<action android:name="android.intent.action.MAIN"/>
25-
<category android:name="android.intent.category.LAUNCHER"/>
23+
<action android:name="android.intent.action.MAIN" />
24+
<category android:name="android.intent.category.LAUNCHER" />
2625
</intent-filter>
2726
</activity>
2827
<!-- Don't delete the meta-data below.

0 commit comments

Comments
 (0)