From 91964b800a278cc648237fe02d1a4e6db989e540 Mon Sep 17 00:00:00 2001 From: hm21 Date: Tue, 7 Jul 2026 10:24:08 +0200 Subject: [PATCH 1/2] chore: migrate Android module to Flutter's built-in Kotlin and update version to 13.1.0 --- CHANGELOG.md | 3 ++ android/build.gradle | 13 ++++---- example/android/app/build.gradle | 11 +++---- example/android/app/build.gradle.kts | 44 ---------------------------- example/android/build.gradle.kts | 21 ------------- example/android/gradle.properties | 4 +++ example/android/settings.gradle | 4 ++- example/android/settings.gradle.kts | 25 ---------------- pubspec.yaml | 6 ++-- 9 files changed, 25 insertions(+), 106 deletions(-) delete mode 100644 example/android/app/build.gradle.kts delete mode 100644 example/android/build.gradle.kts delete mode 100644 example/android/settings.gradle.kts diff --git a/CHANGELOG.md b/CHANGELOG.md index da082f92e..1e5eb82ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 13.1.0 +- **CHORE**(android): Migrate the Android module to Flutter's built-in Kotlin (drop the manual Kotlin Gradle Plugin apply) so the plugin no longer triggers the KGP deprecation warning and stays AGP 9+ compatible. Now requires Flutter 3.44+. + ## 13.0.0 - **FEAT**(tune): Replace the `luminance` control (which only desaturated) with a real `tint` green–magenta adjustment, the natural complement to `temperature`. - **FIX**(filter): Fix `colorOverlay` tinting towards the complementary color instead of the overlay color (inverted sign), and rebuild `fade` as a proper fade (lower contrast + lifted black point) instead of a desaturation. diff --git a/android/build.gradle b/android/build.gradle index b8f0ce44e..de49aaaf0 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,7 +2,6 @@ group = "ch.waio.pro_image_editor" version = "1.0-SNAPSHOT" buildscript { - ext.kotlin_version = "2.1.0" repositories { google() mavenCentral() @@ -10,7 +9,6 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:8.13.0") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") } } @@ -22,7 +20,6 @@ allprojects { } apply plugin: "com.android.library" -apply plugin: "kotlin-android" android { namespace = "ch.waio.pro_image_editor" @@ -34,10 +31,6 @@ android { targetCompatibility = JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17 - } - sourceSets { main.java.srcDirs += "src/main/kotlin" test.java.srcDirs += "src/test/kotlin" @@ -64,3 +57,9 @@ android { } } } + +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 8de510895..c6e26c372 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,6 +1,5 @@ plugins { id "com.android.application" - id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" } @@ -31,10 +30,6 @@ android { targetCompatibility JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = '17' - } - sourceSets { main.java.srcDirs += 'src/main/kotlin' } @@ -59,6 +54,12 @@ android { } } +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + flutter { source '../..' } diff --git a/example/android/app/build.gradle.kts b/example/android/app/build.gradle.kts deleted file mode 100644 index 2bbbef8b1..000000000 --- a/example/android/app/build.gradle.kts +++ /dev/null @@ -1,44 +0,0 @@ -plugins { - id("com.android.application") - id("kotlin-android") - // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. - id("dev.flutter.flutter-gradle-plugin") -} - -android { - namespace = "ch.waio.pro_image_editor_example" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } - - defaultConfig { - // Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId = "ch.waio.pro_image_editor_example" - // You can update the following values to match your application needs. - // For more information, see: https://flutter.dev/to/review-gradle-config. - minSdk = flutter.minSdkVersion - targetSdk = flutter.targetSdkVersion - versionCode = flutter.versionCode - versionName = flutter.versionName - } - - buildTypes { - release { - // Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") - } - } -} - -flutter { - source = "../.." -} diff --git a/example/android/build.gradle.kts b/example/android/build.gradle.kts deleted file mode 100644 index 89176ef44..000000000 --- a/example/android/build.gradle.kts +++ /dev/null @@ -1,21 +0,0 @@ -allprojects { - repositories { - google() - mavenCentral() - } -} - -val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() -rootProject.layout.buildDirectory.value(newBuildDir) - -subprojects { - val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) - project.layout.buildDirectory.value(newSubprojectBuildDir) -} -subprojects { - project.evaluationDependsOn(":app") -} - -tasks.register("clean") { - delete(rootProject.layout.buildDirectory) -} diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 598d13fee..f2122b21a 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,7 @@ org.gradle.jvmargs=-Xmx4G android.useAndroidX=true android.enableJetifier=true +# This builtInKotlin flag was added automatically by Flutter migrator +android.builtInKotlin=false +# This newDsl flag was added automatically by Flutter migrator +android.newDsl=false diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 65541b2b7..ea21f5e8e 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -20,7 +20,9 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.12.2" apply false - id "org.jetbrains.kotlin.android" version "2.2.10" apply false + // Kept for third-party plugins that still apply KGP (device_info_plus, audioplayers_android, ...). + // The example app itself uses Flutter's built-in Kotlin (no kotlin-android in app/build.gradle). + id "org.jetbrains.kotlin.android" version "2.2.20" apply false } include ":app" diff --git a/example/android/settings.gradle.kts b/example/android/settings.gradle.kts deleted file mode 100644 index f0e341ddb..000000000 --- a/example/android/settings.gradle.kts +++ /dev/null @@ -1,25 +0,0 @@ -pluginManagement { - val flutterSdkPath = run { - val properties = java.util.Properties() - file("local.properties").inputStream().use { properties.load(it) } - val flutterSdkPath = properties.getProperty("flutter.sdk") - require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } - flutterSdkPath - } - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -plugins { - id("dev.flutter.flutter-plugin-loader") version "1.0.0" - id("com.android.application") version "8.13.0" apply false - id("org.jetbrains.kotlin.android") version "2.1.0" apply false -} - -include(":app") diff --git a/pubspec.yaml b/pubspec.yaml index 8fbf4c449..97ad92134 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: pro_image_editor description: "A Flutter image editor: Seamlessly enhance your images with user-friendly editing features." -version: 13.0.0 +version: 13.1.0 homepage: https://github.com/hm21/pro_image_editor/ repository: https://github.com/hm21/pro_image_editor/ documentation: https://github.com/hm21/pro_image_editor/ @@ -31,8 +31,8 @@ platforms: windows: environment: - sdk: '>=3.11.0 <4.0.0' - flutter: ">=3.41.0" + sdk: '>=3.12.0 <4.0.0' + flutter: ">=3.44.0" dependencies: flutter: From dd632eb64c2dfe9b5b5ebd0a07db577a19e426ef Mon Sep 17 00:00:00 2001 From: hm21 Date: Tue, 7 Jul 2026 10:28:37 +0200 Subject: [PATCH 2/2] refactor: streamline constructor parameters in gesture handler and export state history classes --- ...side_render_semantics_gesture_handler.dart | 13 +++++------ .../content_recorder_controller.dart | 4 ++-- .../import_export/export_state_history.dart | 22 +++++++------------ 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/lib/features/crop_rotate_editor/widgets/outside_gestures/outside_render_semantics_gesture_handler.dart b/lib/features/crop_rotate_editor/widgets/outside_gestures/outside_render_semantics_gesture_handler.dart index 6d97911f3..6c996dd25 100644 --- a/lib/features/crop_rotate_editor/widgets/outside_gestures/outside_render_semantics_gesture_handler.dart +++ b/lib/features/crop_rotate_editor/widgets/outside_gestures/outside_render_semantics_gesture_handler.dart @@ -12,16 +12,13 @@ class OutsideRenderSemanticsGestureHandler /// Creates a render object that listens for specific semantic gestures. OutsideRenderSemanticsGestureHandler({ super.child, - GestureTapCallback? onTap, - GestureLongPressCallback? onLongPress, - GestureDragUpdateCallback? onHorizontalDragUpdate, - GestureDragUpdateCallback? onVerticalDragUpdate, + this._onTap, + this._onLongPress, + this._onHorizontalDragUpdate, + this._onVerticalDragUpdate, this.scrollFactor = 0.8, super.behavior, - }) : _onTap = onTap, - _onLongPress = onLongPress, - _onHorizontalDragUpdate = onHorizontalDragUpdate, - _onVerticalDragUpdate = onVerticalDragUpdate; + }); /// If non-null, the set of actions to allow. Other actions will be omitted, /// even if their callback is provided. diff --git a/lib/shared/services/content_recorder/controllers/content_recorder_controller.dart b/lib/shared/services/content_recorder/controllers/content_recorder_controller.dart index 4a62c0171..435037edb 100644 --- a/lib/shared/services/content_recorder/controllers/content_recorder_controller.dart +++ b/lib/shared/services/content_recorder/controllers/content_recorder_controller.dart @@ -29,11 +29,11 @@ class ContentRecorderController { /// Initializes the controller with the specified configuration. /// Optionally enables thumbnail generation and skips initialization. ContentRecorderController({ - required ImageGenerationConfigs configs, + required this._configs, required this.isVideoEditor, this.enableThumbnailGeneration = false, bool ignoreGeneration = false, - }) : _configs = configs { + }) { containerKey = GlobalKey(); recorderKey = GlobalKey(); recorderStream = StreamController(); diff --git a/lib/shared/services/import_export/export_state_history.dart b/lib/shared/services/import_export/export_state_history.dart index 601cec489..092ef55de 100644 --- a/lib/shared/services/import_export/export_state_history.dart +++ b/lib/shared/services/import_export/export_state_history.dart @@ -28,20 +28,14 @@ import 'utils/key_minifier.dart'; class ExportStateHistory { /// Constructs an [ExportStateHistory] object with the given parameters. ExportStateHistory({ - required ProImageEditorConfigs editorConfigs, - required List stateHistory, - required ImageInfos imageInfos, - required int editorPosition, - required ContentRecorderController contentRecorderCtrl, - required BuildContext context, - ExportEditorConfigs configs = const ExportEditorConfigs(), - }) : _configs = configs, - _editorConfigs = editorConfigs, - _stateHistory = stateHistory, - _imageInfos = imageInfos, - _contentRecorderCtrl = contentRecorderCtrl, - _context = context, - _editorPosition = editorPosition; + required this._editorConfigs, + required this._stateHistory, + required this._imageInfos, + required this._editorPosition, + required this._contentRecorderCtrl, + required this._context, + this._configs = const ExportEditorConfigs(), + }); /// The current position of the editor in the state history. ///