Skip to content

Commit 938fbfb

Browse files
committed
adjust example
1 parent 90b992f commit 938fbfb

15 files changed

+290
-120
lines changed

example/.metadata

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

66
version:
7-
revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49"
7+
revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1"
88
channel: "stable"
99

1010
project_type: app
@@ -13,26 +13,26 @@ project_type: app
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
17-
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
16+
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
17+
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
1818
- platform: android
19-
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
20-
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
19+
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
20+
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
2121
- platform: ios
22-
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
23-
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
22+
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
23+
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
2424
- platform: linux
25-
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
26-
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
25+
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
26+
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
2727
- platform: macos
28-
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
29-
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
28+
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
29+
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
3030
- platform: web
31-
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
32-
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
31+
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
32+
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
3333
- platform: windows
34-
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
35-
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
34+
create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
35+
base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
3636

3737
# User provided section
3838

example/android/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ gradle-wrapper.jar
55
/gradlew.bat
66
/local.properties
77
GeneratedPluginRegistrant.java
8+
.cxx/
89

910
# Remember to never publicly share your keystore.
10-
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11+
# See https://flutter.dev/to/reference-keystore
1112
key.properties
1213
**/*.keystore
1314
**/*.jks

example/android/app/build.gradle

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

example/android/app/build.gradle.kts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
8+
android {
9+
namespace = "com.example.example"
10+
compileSdk = flutter.compileSdkVersion
11+
ndkVersion = flutter.ndkVersion
12+
13+
compileOptions {
14+
sourceCompatibility = JavaVersion.VERSION_11
15+
targetCompatibility = JavaVersion.VERSION_11
16+
}
17+
18+
kotlinOptions {
19+
jvmTarget = JavaVersion.VERSION_11.toString()
20+
}
21+
22+
defaultConfig {
23+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24+
applicationId = "com.example.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
31+
}
32+
33+
buildTypes {
34+
release {
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.getByName("debug")
38+
}
39+
}
40+
}
41+
42+
flutter {
43+
source = "../.."
44+
}

example/android/app/src/main/kotlin/com/example/example/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package com.example.example
22

33
import io.flutter.embedding.android.FlutterActivity
44

5-
class MainActivity: FlutterActivity()
5+
class MainActivity : FlutterActivity()

example/android/build.gradle

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

example/android/build.gradle.kts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
allprojects {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
6+
}
7+
8+
val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
9+
rootProject.layout.buildDirectory.value(newBuildDir)
10+
11+
subprojects {
12+
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
13+
project.layout.buildDirectory.value(newSubprojectBuildDir)
14+
}
15+
subprojects {
16+
project.evaluationDependsOn(":app")
17+
}
18+
19+
tasks.register<Delete>("clean") {
20+
delete(rootProject.layout.buildDirectory)
21+
}

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=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
1+
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
22
android.useAndroidX=true
33
android.enableJetifier=true

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

example/android/settings.gradle

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

example/android/settings.gradle.kts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
pluginManagement {
2+
val flutterSdkPath = run {
3+
val properties = java.util.Properties()
4+
file("local.properties").inputStream().use { properties.load(it) }
5+
val flutterSdkPath = properties.getProperty("flutter.sdk")
6+
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
7+
flutterSdkPath
8+
}
9+
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11+
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
18+
19+
plugins {
20+
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
21+
id("com.android.application") version "8.7.0" apply false
22+
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
23+
}
24+
25+
include(":app")

example/linux/runner/CMakeLists.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
project(runner LANGUAGES CXX)
3+
4+
# Define the application target. To change its name, change BINARY_NAME in the
5+
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6+
# work.
7+
#
8+
# Any new source files that you add to the application should be added here.
9+
add_executable(${BINARY_NAME}
10+
"main.cc"
11+
"my_application.cc"
12+
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
13+
)
14+
15+
# Apply the standard set of build settings. This can be removed for applications
16+
# that need different build settings.
17+
apply_standard_settings(${BINARY_NAME})
18+
19+
# Add preprocessor definitions for the application ID.
20+
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
21+
22+
# Add dependency libraries. Add any application-specific dependencies here.
23+
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
24+
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
25+
26+
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")

example/linux/runner/main.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "my_application.h"
2+
3+
int main(int argc, char** argv) {
4+
g_autoptr(MyApplication) app = my_application_new();
5+
return g_application_run(G_APPLICATION(app), argc, argv);
6+
}

0 commit comments

Comments
 (0)