From 1e2e42064d23f548e5cc88b16f9eb014ae2a16cb Mon Sep 17 00:00:00 2001 From: Eimen2018 Date: Tue, 21 Oct 2025 01:42:45 +0400 Subject: [PATCH] feat: update Android and iOS configurations, improve Gradle setup, and enhance theme management --- example/android/app/build.gradle | 61 ++++++------------- .../android/app/src/main/AndroidManifest.xml | 2 +- example/android/build.gradle | 56 ++++++++++++----- .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/settings.gradle | 32 +++++++--- .../Flutter/ephemeral/flutter_lldb_helper.py | 32 ++++++++++ .../ios/Flutter/ephemeral/flutter_lldbinit | 5 ++ example/lib/main.dart | 4 +- .../lib/ui/dark_light/dark_light_view.dart | 2 +- .../multiple_themes/multiple_themes_view.dart | 2 +- .../multiple_themes_viewmodel.dart | 2 +- pubspec.yaml | 4 +- 12 files changed, 131 insertions(+), 73 deletions(-) create mode 100644 example/ios/Flutter/ephemeral/flutter_lldb_helper.py create mode 100644 example/ios/Flutter/ephemeral/flutter_lldbinit diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 51f8692..5b57023 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,63 +1,40 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -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' +plugins { + id "com.android.application" + id "org.jetbrains.kotlin.android" + // Apply Flutter plugin after Android and Kotlin plugins. + id "dev.flutter.flutter-gradle-plugin" } -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion 31 + namespace "com.example.themes_example" + compileSdk flutter.compileSdkVersion + ndkVersion flutter.ndkVersion - sourceSets { - main.java.srcDirs += 'src/main/kotlin' + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } - lintOptions { - disable 'InvalidPackage' + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.themes_example" - minSdkVersion 16 - targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion + versionCode flutter.versionCode + versionName flutter.versionName } buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. + // Signing with debug keys so `flutter run --release` keeps working. signingConfig signingConfigs.debug } } } flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + source "../.." } diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index ecf4cb2..31afce7 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -5,7 +5,7 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> - +