From 7d99271d7d2300c8b0f4076c8381c9d07aa44433 Mon Sep 17 00:00:00 2001 From: qinyongyi Date: Mon, 19 Sep 2022 17:18:54 +0800 Subject: [PATCH] =?UTF-8?q?APP-2745:flutter3.0=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/build.gradle | 4 ++-- android/gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/app/build.gradle | 2 +- example/android/app/src/main/AndroidManifest.xml | 2 +- example/android/build.gradle | 4 ++-- example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- example/lib/main.dart | 2 +- lib/image_gallery_saver.dart | 2 -- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index fb7b6c0..9cceea9 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,14 +2,14 @@ group 'com.example.imagegallerysaver' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.3.72' + ext.kotlin_version = '1.6.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 9bcb90d..dde4b10 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 909240b..f5ee76a 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 29 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index e939803..e2041eb 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> diff --git a/example/android/build.gradle b/example/android/build.gradle index 11ed6dd..31e9577 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.72' + ext.kotlin_version = '1.6.10' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 8adeacc..8c9ec04 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip diff --git a/example/lib/main.dart b/example/lib/main.dart index 9e87f4a..29f0779 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -113,7 +113,7 @@ class _MyHomePageState extends State { RenderRepaintBoundary boundary = _globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary; ui.Image image = await boundary.toImage(); - ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png) as FutureOr); + ByteData? byteData = await (image.toByteData(format: ui.ImageByteFormat.png)); if (byteData != null) { final result = await ImageGallerySaver.saveImage(byteData.buffer.asUint8List()); diff --git a/lib/image_gallery_saver.dart b/lib/image_gallery_saver.dart index 537a1e6..0a758ea 100644 --- a/lib/image_gallery_saver.dart +++ b/lib/image_gallery_saver.dart @@ -15,7 +15,6 @@ class ImageGallerySaver { {int quality = 80, String? name, bool isReturnImagePathOfIOS = false}) async { - assert(imageBytes != null); final result = await _channel.invokeMethod('saveImageToGallery', { 'imageBytes': imageBytes, @@ -28,7 +27,6 @@ class ImageGallerySaver { /// Save the PNG,JPG,JPEG image or video located at [file] to the local device media gallery. static Future saveFile(String file, {String? name, bool isReturnPathOfIOS = false}) async { - assert(file != null); final result = await _channel.invokeMethod( 'saveFileToGallery', { 'file': file,