Skip to content

Commit aa10bfd

Browse files
committed
chore: Added Dart define, removed prod run config & updated class name
2 parents 3a3c811 + 540a327 commit aa10bfd

38 files changed

+189
-154
lines changed

.metadata

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,27 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 9b2d32b605630f28625709ebd9d78ab3016b2bf6
8-
channel: stable
7+
revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
8+
channel: "stable"
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
17+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
18+
- platform: ios
19+
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
20+
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

.run/production_debug.run.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.run/production_release.run.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.run/staging_debug.run.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.run/staging_release.run.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"recommendations": [
3+
"dart-code.dart-code",
4+
"dart-code.flutter",
5+
"usernamehw.errorlens",
6+
"felixangelov.mason",
7+
"felixangelov.bloc",
8+
"nivisi.dart-build-runner-tools",
9+
"tenraneko.pubspec-dependency-opener",
10+
"jeroen-meijer.pubspec-assist",
11+
"davidanson.vscode-markdownlint"
12+
]
13+
}

.vscode/launch.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,6 @@
2727
"--dart-define",
2828
"API_BASE_URL=https://randomuser.me"
2929
]
30-
},
31-
{
32-
"name": "Production",
33-
"request": "launch",
34-
"type": "dart",
35-
"program": "lib/main_production.dart",
36-
"args": [
37-
"--flavor",
38-
"production",
39-
"--dart-define",
40-
"API_BASE_URL=https://randomuser.me"
41-
]
4230
}
4331
]
4432
}

android/app/build.gradle

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,97 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5+
id "dev.flutter.flutter-gradle-plugin"
6+
}
7+
18
def localProperties = new Properties()
2-
def localPropertiesFile = rootProject.file('local.properties')
9+
def localPropertiesFile = rootProject.file("local.properties")
310
if (localPropertiesFile.exists()) {
4-
localPropertiesFile.withReader('UTF-8') { reader ->
11+
localPropertiesFile.withReader("UTF-8") { reader ->
512
localProperties.load(reader)
613
}
714
}
815

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')
16+
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
1517
if (flutterVersionCode == null) {
16-
flutterVersionCode = '1'
18+
flutterVersionCode = "1"
1719
}
1820

19-
def flutterVersionName = localProperties.getProperty('flutter.versionName')
21+
def flutterVersionName = localProperties.getProperty("flutter.versionName")
2022
if (flutterVersionName == null) {
21-
flutterVersionName = '1.0'
23+
flutterVersionName = "1.0"
2224
}
2325

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26+
27+
// TODO: Change the appName, it will be used as app label
28+
def appName = "Flutter Template"
29+
30+
// TODO: Change the applicationId for production
31+
// On staging it will add .staging and on development it will add .development as suffix.
32+
def applicationId = "com.example.flutter_template"
33+
2734

2835
android {
29-
compileSdkVersion flutter.compileSdkVersion
36+
namespace = "$applicationId"
37+
compileSdk = flutter.compileSdkVersion
38+
ndkVersion = flutter.ndkVersion
3039

3140
compileOptions {
32-
sourceCompatibility JavaVersion.VERSION_1_8
33-
targetCompatibility JavaVersion.VERSION_1_8
41+
sourceCompatibility = JavaVersion.VERSION_1_8
42+
targetCompatibility = JavaVersion.VERSION_1_8
3443
}
3544

3645
kotlinOptions {
37-
jvmTarget = '1.8'
38-
}
39-
40-
sourceSets {
41-
main.java.srcDirs += 'src/main/kotlin'
46+
jvmTarget = JavaVersion.VERSION_1_8
4247
}
4348

4449
defaultConfig {
45-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
46-
applicationId "com.example.flutter_template"
47-
minSdkVersion flutter.minSdkVersion
48-
targetSdkVersion flutter.targetSdkVersion
49-
versionCode flutterVersionCode.toInteger()
50-
versionName flutterVersionName
50+
applicationId = "$applicationId"
51+
// You can update the following values to match your application needs.
52+
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
53+
minSdk = flutter.minSdkVersion
54+
targetSdk = flutter.targetSdkVersion
55+
versionCode = flutterVersionCode.toInteger()
56+
versionName = flutterVersionName
5157
}
5258

5359
buildTypes {
5460
release {
5561
// TODO: Add your own signing config for the release build.
5662
// Signing with the debug keys for now, so `flutter run --release` works.
57-
signingConfig signingConfigs.debug
63+
signingConfig = signingConfigs.debug
5864
}
5965
}
60-
6166
//TODO: Change resValue application name
62-
flavorDimensions "flavor-type"
67+
flavorDimensions.add("flavor-type")
6368

6469
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
70+
create("development") {
71+
dimension = "flavor-type"
72+
applicationIdSuffix = ".development"
73+
versionNameSuffix = "-development"
74+
manifestPlaceholders["appName"] = "[DEV] $appName"
75+
signingConfig = signingConfigs.getByName("debug")
7176
}
72-
staging {
73-
dimension "flavor-type"
74-
applicationIdSuffix ".staging"
75-
versionNameSuffix "-staging"
76-
resValue "string", "app_name", "Application Name Staging"
77-
signingConfig signingConfigs.debug
77+
create("staging") {
78+
dimension = "flavor-type"
79+
applicationIdSuffix = ".staging"
80+
versionNameSuffix = "-staging"
81+
manifestPlaceholders["appName"] = "[STG] $appName"
82+
signingConfig = signingConfigs.getByName("debug")
7883
}
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
84+
create("production") {
85+
dimension = "flavor-type"
86+
manifestPlaceholders["appName"] = "$appName"
87+
// TODO: After adding your own signing config for the release build,
88+
// Change this to
89+
// signingConfig = signingConfigs.getByName("release")
90+
signingConfig = signingConfigs.getByName("debug")
8591
}
86-
8792
}
8893
}
8994

9095
flutter {
91-
source '../..'
92-
}
93-
94-
dependencies {
95-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
96+
source = "../.."
9697
}

android/app/src/debug/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.flutter_template">
3-
<!-- Flutter needs it to communicate with the running application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- The INTERNET permission is required for development. Specifically,
3+
the Flutter tool needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>
Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.flutter_template">
3-
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
42
<application
5-
android:icon="@mipmap/ic_launcher"
6-
android:label="@string/app_name">
3+
android:label="${appName}"
4+
android:name="${applicationName}"
5+
android:icon="@mipmap/ic_launcher">
76
<activity
87
android:name=".MainActivity"
9-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
108
android:exported="true"
11-
android:hardwareAccelerated="true"
129
android:launchMode="singleTop"
10+
android:taskAffinity=""
1311
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" />
20+
android:name="io.flutter.embedding.android.NormalTheme"
21+
android:resource="@style/NormalTheme"
22+
/>
2223
<intent-filter>
23-
<action android:name="android.intent.action.MAIN" />
24-
<category android:name="android.intent.category.LAUNCHER" />
24+
<action android:name="android.intent.action.MAIN"/>
25+
<category android:name="android.intent.category.LAUNCHER"/>
2526
</intent-filter>
2627
</activity>
2728
<!-- Don't delete the meta-data below.
@@ -30,4 +31,15 @@
3031
android:name="flutterEmbedding"
3132
android:value="2" />
3233
</application>
34+
<!-- Required to query activities that can process text, see:
35+
https://developer.android.com/training/package-visibility and
36+
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
37+
38+
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
39+
<queries>
40+
<intent>
41+
<action android:name="android.intent.action.PROCESS_TEXT"/>
42+
<data android:mimeType="text/plain"/>
43+
</intent>
44+
</queries>
3345
</manifest>

0 commit comments

Comments
 (0)