Skip to content

Commit 54afa7e

Browse files
authored
build: get the example app to run on multiple platforms (#145)
Closes #144
1 parent c7340f6 commit 54afa7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1738
-139
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- Get the example application to run on multiple platforms — Android, IOS,
11+
MacOs and Web — [144](https://github.com/dartoos-dev/eo_color/issues/144).
12+
1013
## [2.2.2] - 2024-08-20
1114

1215
### Changed

example/.metadata

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

66
version:
7-
revision: 06e2fd63574bad2edafbe4653104ed76871ee0b1
8-
channel: beta
7+
revision: "80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819"
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: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
17+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
18+
- platform: android
19+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
20+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
21+
- platform: ios
22+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
23+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
24+
- platform: linux
25+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
26+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
27+
- platform: macos
28+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
29+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
30+
- platform: web
31+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
32+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
33+
- platform: windows
34+
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
35+
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
36+
37+
# User provided section
38+
39+
# List of Local paths (relative to this file) that should be
40+
# ignored by the migrate tool.
41+
#
42+
# Files that are not part of the templates will be ignored by default.
43+
unmanaged_files:
44+
- 'lib/main.dart'
45+
- 'ios/Runner.xcodeproj/project.pbxproj'

example/android/.classpath

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="/Users/rafamizes/Library/Android/sdk/sources/android-28/"/>
4+
<classpathentry kind="lib" path="."/>
5+
</classpath>

example/android/app/.classpath

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="/Users/rafamizes/Library/Android/sdk/sources/android-28/"/>
4+
<classpathentry kind="lib" path="."/>
5+
</classpath>

example/android/app/build.gradle

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,44 @@
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'
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"
226
}
237

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
288
android {
29-
compileSdkVersion 30
9+
namespace = "dev.dartoos.example"
10+
compileSdk = flutter.compileSdkVersion
11+
ndkVersion = flutter.ndkVersion
12+
13+
compileOptions {
14+
sourceCompatibility = JavaVersion.VERSION_1_8
15+
targetCompatibility = JavaVersion.VERSION_1_8
16+
}
3017

31-
sourceSets {
32-
main.java.srcDirs += 'src/main/kotlin'
18+
kotlinOptions {
19+
jvmTarget = JavaVersion.VERSION_1_8
3320
}
3421

3522
defaultConfig {
36-
applicationId "dev.dartoos.example"
37-
minSdkVersion flutter.minSdkVersion
38-
targetSdkVersion 30
39-
versionCode flutterVersionCode.toInteger()
40-
versionName flutterVersionName
23+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24+
applicationId = "dev.dartoos.example"
25+
// You can update the following values to match your application needs.
26+
// For more information, see: https://flutter.dev/to/review-gradle-config.
27+
minSdk = flutter.minSdkVersion
28+
targetSdk = flutter.targetSdkVersion
29+
versionCode = flutter.versionCode
30+
versionName = flutter.versionName
4131
}
4232

4333
buildTypes {
4434
release {
45-
signingConfig signingConfigs.debug
35+
// TODO: Add your own signing config for the release build.
36+
// Signing with the debug keys for now, so `flutter run --release` works.
37+
signingConfig = signingConfigs.debug
4638
}
4739
}
4840
}
4941

5042
flutter {
51-
source '../..'
52-
}
53-
54-
dependencies {
55-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
43+
source = "../.."
5644
}

example/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="dev.dartoos.example">
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: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="dev.dartoos.example">
3-
<application
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<application
43
android:label="example"
4+
android:name="${applicationName}"
55
android:icon="@mipmap/ic_launcher">
66
<activity
77
android:name=".MainActivity"
8+
android:exported="true"
89
android:launchMode="singleTop"
10+
android:taskAffinity=""
911
android:theme="@style/LaunchTheme"
1012
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1113
android:hardwareAccelerated="true"
@@ -18,15 +20,6 @@
1820
android:name="io.flutter.embedding.android.NormalTheme"
1921
android:resource="@style/NormalTheme"
2022
/>
21-
<!-- Displays an Android View that continues showing the launch screen
22-
Drawable until Flutter paints its first frame, then this splash
23-
screen fades out. A splash screen is useful to avoid any visual
24-
gap between the end of Android's launch screen and the painting of
25-
Flutter's first frame. -->
26-
<meta-data
27-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
28-
android:resource="@drawable/launch_background"
29-
/>
3023
<intent-filter>
3124
<action android:name="android.intent.action.MAIN"/>
3225
<category android:name="android.intent.category.LAUNCHER"/>
@@ -38,4 +31,15 @@
3831
android:name="flutterEmbedding"
3932
android:value="2" />
4033
</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>
4145
</manifest>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package dev.dartoos.example
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity()

example/android/build.gradle

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
1-
buildscript {
2-
ext.kotlin_version = '1.3.50'
3-
repositories {
4-
google()
5-
jcenter()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.1.0'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
141
allprojects {
152
repositories {
163
google()
17-
jcenter()
4+
mavenCentral()
185
}
196
}
207

21-
rootProject.buildDir = '../build'
8+
rootProject.buildDir = "../build"
229
subprojects {
2310
project.buildDir = "${rootProject.buildDir}/${project.name}"
24-
project.evaluationDependsOn(':app')
11+
}
12+
subprojects {
13+
project.evaluationDependsOn(":app")
2514
}
2615

2716
tasks.register("clean", Delete) {

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
org.gradle.jvmargs=-Xmx1536M
1+
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
22
android.useAndroidX=true
33
android.enableJetifier=true
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip

example/android/settings.gradle

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

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"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "7.3.0" apply false
22+
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
23+
}
24+
25+
include ":app"

example/ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>8.0</string>
24+
<string>12.0</string>
2525
</dict>
2626
</plist>

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -127,7 +127,7 @@
127127
97C146E61CF9000F007C117D /* Project object */ = {
128128
isa = PBXProject;
129129
attributes = {
130-
LastUpgradeCheck = 1020;
130+
LastUpgradeCheck = 1510;
131131
ORGANIZATIONNAME = "";
132132
TargetAttributes = {
133133
97C146ED1CF9000F007C117D = {
@@ -171,10 +171,12 @@
171171
/* Begin PBXShellScriptBuildPhase section */
172172
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
173173
isa = PBXShellScriptBuildPhase;
174+
alwaysOutOfDate = 1;
174175
buildActionMask = 2147483647;
175176
files = (
176177
);
177178
inputPaths = (
179+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
178180
);
179181
name = "Thin Binary";
180182
outputPaths = (
@@ -185,6 +187,7 @@
185187
};
186188
9740EEB61CF901F6004384FC /* Run Script */ = {
187189
isa = PBXShellScriptBuildPhase;
190+
alwaysOutOfDate = 1;
188191
buildActionMask = 2147483647;
189192
files = (
190193
);
@@ -272,7 +275,7 @@
272275
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
273276
GCC_WARN_UNUSED_FUNCTION = YES;
274277
GCC_WARN_UNUSED_VARIABLE = YES;
275-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
278+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
276279
MTL_ENABLE_DEBUG_INFO = NO;
277280
SDKROOT = iphoneos;
278281
SUPPORTED_PLATFORMS = iphoneos;
@@ -346,7 +349,7 @@
346349
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
347350
GCC_WARN_UNUSED_FUNCTION = YES;
348351
GCC_WARN_UNUSED_VARIABLE = YES;
349-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
352+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
350353
MTL_ENABLE_DEBUG_INFO = YES;
351354
ONLY_ACTIVE_ARCH = YES;
352355
SDKROOT = iphoneos;
@@ -395,7 +398,7 @@
395398
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
396399
GCC_WARN_UNUSED_FUNCTION = YES;
397400
GCC_WARN_UNUSED_VARIABLE = YES;
398-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
401+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
399402
MTL_ENABLE_DEBUG_INFO = NO;
400403
SDKROOT = iphoneos;
401404
SUPPORTED_PLATFORMS = iphoneos;

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22
import Flutter
33

4-
@UIApplicationMain
4+
@main
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,

example/ios/Runner/Info.plist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,9 @@
4141
</array>
4242
<key>UIViewControllerBasedStatusBarAppearance</key>
4343
<false/>
44+
<key>CADisableMinimumFrameDurationOnPhone</key>
45+
<true/>
46+
<key>UIApplicationSupportsIndirectInputEvents</key>
47+
<true/>
4448
</dict>
4549
</plist>

0 commit comments

Comments
 (0)