From e33e115ffa6310c32fc88198a42999135400a631 Mon Sep 17 00:00:00 2001 From: song_zhifei Date: Mon, 25 Nov 2024 15:23:21 +0800 Subject: [PATCH 1/3] format Signed-off-by: song_zhifei --- OAT.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OAT.xml b/OAT.xml index bc7d794..5dfbe29 100644 --- a/OAT.xml +++ b/OAT.xml @@ -17,6 +17,7 @@ --> + -- Gitee From e21525293db094dd64a047bb938d89444a678850 Mon Sep 17 00:00:00 2001 From: song_zhifei Date: Thu, 5 Dec 2024 10:36:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=BA=93=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: song_zhifei --- image_cropper/ohos/example/lib/main.dart | 18 +++++++++++------- .../ohos/example/ohos/entry/oh-package.json5 | 4 ++-- .../ets/plugins/GeneratedPluginRegistrant.ets | 4 ++-- .../ohos/example/ohos/oh-package.json5 | 2 +- image_cropper/ohos/example/pubspec.yaml | 13 ++++++------- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/image_cropper/ohos/example/lib/main.dart b/image_cropper/ohos/example/lib/main.dart index 80f3ed9..30ff01e 100644 --- a/image_cropper/ohos/example/lib/main.dart +++ b/image_cropper/ohos/example/lib/main.dart @@ -3,8 +3,8 @@ import 'dart:io'; import 'package:dotted_border/dotted_border.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:image_picker/image_picker.dart'; import 'package:imagecropper_ohos_example/crop_page.dart'; +import 'package:file_picker_ohos/file_picker_ohos.dart'; void main() { runApp(const MyApp()); @@ -282,12 +282,16 @@ class _HomePageState extends State { } Future _uploadImage() async { - final pickedFile = - await ImagePicker().pickImage(source: ImageSource.gallery); - if (pickedFile != null) { - setState(() { - _pickedFile = pickedFile.path; - }); + FilePickerResult? result = await FilePicker.platform.pickFiles(type:FileType.image); + if (result != null) { + File pickedFile = File(result.files.single.path!); + if (pickedFile != null) { + setState(() { + _pickedFile = pickedFile.path; + }); + } + } else { + // User canceled the picker } } diff --git a/image_cropper/ohos/example/ohos/entry/oh-package.json5 b/image_cropper/ohos/example/ohos/entry/oh-package.json5 index 003cdb2..7b4e6fa 100644 --- a/image_cropper/ohos/example/ohos/entry/oh-package.json5 +++ b/image_cropper/ohos/example/ohos/entry/oh-package.json5 @@ -7,7 +7,7 @@ "license": "", "dependencies": { "@ohos/flutter_ohos": "file:../har/flutter.har", - "imagecropper_ohos": "file:..\\har\\imagecropper_ohos.har", - "image_picker_ohos": "file:..\\har\\image_picker_ohos.har" + "imagecropper_ohos": "file:../har/imagecropper_ohos.har", + "file_picker_ohos": "file:../har/file_picker_ohos.har" } } \ No newline at end of file diff --git a/image_cropper/ohos/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/image_cropper/ohos/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets index ee71d56..0aa747f 100644 --- a/image_cropper/ohos/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets +++ b/image_cropper/ohos/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets @@ -14,7 +14,7 @@ */ import { FlutterEngine, Log } from '@ohos/flutter_ohos'; -import ImagePickerPlugin from 'image_picker_ohos'; +import FilePickerPlugin from 'file_picker_ohos'; import ImagecropperOhosPlugin from 'imagecropper_ohos'; /** @@ -29,7 +29,7 @@ export class GeneratedPluginRegistrant { static registerWith(flutterEngine: FlutterEngine) { try { - flutterEngine.getPlugins()?.add(new ImagePickerPlugin()); + flutterEngine.getPlugins()?.add(new FilePickerPlugin()); flutterEngine.getPlugins()?.add(new ImagecropperOhosPlugin()); } catch (e) { Log.e( diff --git a/image_cropper/ohos/example/ohos/oh-package.json5 b/image_cropper/ohos/example/ohos/oh-package.json5 index 07c4aaf..bbf5a6a 100644 --- a/image_cropper/ohos/example/ohos/oh-package.json5 +++ b/image_cropper/ohos/example/ohos/oh-package.json5 @@ -16,6 +16,6 @@ "@ohos/flutter_ohos": "file:./har/flutter.har", "imagecropper_ohos": "file:./har/imagecropper_ohos.har", "@ohos/flutter_module": "file:./entry", - "image_picker_ohos": "file:./har/image_picker_ohos.har" + "file_picker_ohos": "file:./har/file_picker_ohos.har" } } \ No newline at end of file diff --git a/image_cropper/ohos/example/pubspec.yaml b/image_cropper/ohos/example/pubspec.yaml index 94e36a3..d5a05b5 100644 --- a/image_cropper/ohos/example/pubspec.yaml +++ b/image_cropper/ohos/example/pubspec.yaml @@ -29,17 +29,16 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 dotted_border: ^2.1.0 - image_picker: + file_picker: git: - url: https://gitee.com/openharmony-sig/flutter_packages.git - path: packages/image_picker/image_picker + url: https://gitee.com/openharmony-sig/fluttertpc_file_picker.git dependency_overrides: - image_picker_ohos: + file_picker_ohos: git: - url: https://gitee.com/openharmony-sig/flutter_packages.git - path: packages/image_picker/image_picker_ohos - ref: br_optimize_har_structure + url: https://gitee.com/openharmony-sig/fluttertpc_file_picker.git + path: ohos + dev_dependencies: flutter_test: -- Gitee From 35d98cef5539459cbfc3028aa761730fb3377a75 Mon Sep 17 00:00:00 2001 From: song_zhifei Date: Thu, 5 Dec 2024 10:46:34 +0800 Subject: [PATCH 3/3] format Signed-off-by: song_zhifei --- OAT.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/OAT.xml b/OAT.xml index 5dfbe29..bc7d794 100644 --- a/OAT.xml +++ b/OAT.xml @@ -17,7 +17,6 @@ --> - -- Gitee