From 94a356994ef1b07418e9cbc7732e0d6aa5ed139d Mon Sep 17 00:00:00 2001 From: wuxinglong Date: Fri, 14 Nov 2025 09:51:16 +0800 Subject: [PATCH 1/8] =?UTF-8?q?feat=EF=BC=9A=E9=A2=84=E8=A7=88=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=BB=84=E4=BB=B6=E6=96=B0=E5=A2=9E=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=8F=8A=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/lib/main.dart | 1 - lib/upload_image/look_images_widget.dart | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 8e8b759..e99774e 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -121,7 +121,6 @@ class _MyHomePageState extends State { ), ), ); - print(editedImage); } } diff --git a/lib/upload_image/look_images_widget.dart b/lib/upload_image/look_images_widget.dart index 563b862..1a2e76d 100644 --- a/lib/upload_image/look_images_widget.dart +++ b/lib/upload_image/look_images_widget.dart @@ -7,6 +7,7 @@ class LookImagesTool { static lookImages({ required List listData, int? currentPage, + Function? editCallback, }) async { showDialog( context: Get.context!, @@ -15,6 +16,7 @@ class LookImagesTool { return LookImagesWidget( listData: listData, currentPage: currentPage, + editCallback: editCallback, ); }); } @@ -23,11 +25,13 @@ class LookImagesTool { class LookImagesWidget extends StatefulWidget { final List listData; final int? currentPage; + final Function? editCallback; const LookImagesWidget({ super.key, required this.listData, this.currentPage, + this.editCallback, }); @override @@ -77,6 +81,10 @@ class _LookImagesWidgetState extends State { left: 15, top: 50, child: GestureDetector(onTap: () => Get.back(), child: Icon(Icons.arrow_back_ios, color: Colors.white))), + Positioned( + right: 15, + top: 50, + child: GestureDetector(onTap: () => widget.editCallback?.call(), child: Icon(Icons.edit, color: Colors.white))), //图片张数指示器 Positioned( left: 0, From f0f8d9ef6915e101f6b0d0eae884d4352cd9e9b9 Mon Sep 17 00:00:00 2001 From: wuxinglong Date: Fri, 14 Nov 2025 11:35:45 +0800 Subject: [PATCH 2/8] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dart_tool/package_config.json | 98 ++- .dart_tool/package_config_subset | 64 ++ .idea/flutter_common.iml | 3 + example/android/settings.gradle | 2 +- example/lib/main.dart | 58 +- .../flutter/generated_plugin_registrant.cc | 4 + example/linux/flutter/generated_plugins.cmake | 1 + example/pubspec.lock | 577 +++++++++++++++++- example/pubspec.yaml | 7 +- lib/upload_image/look_images_widget.dart | 171 +++++- pubspec.lock | 130 +++- pubspec.yaml | 2 + 12 files changed, 1063 insertions(+), 54 deletions(-) diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index f048d10..3ef8d17 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -1,6 +1,12 @@ { "configVersion": 2, "packages": [ + { + "name": "archive", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/archive-4.0.7", + "packageUri": "lib/", + "languageVersion": "3.0" + }, { "name": "args", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/args-2.7.0", @@ -37,6 +43,12 @@ "packageUri": "lib/", "languageVersion": "3.4" }, + { + "name": "colorfilter_generator", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/colorfilter_generator-0.0.8", + "packageUri": "lib/", + "languageVersion": "2.15" + }, { "name": "common_utils", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/common_utils-2.1.0", @@ -103,6 +115,18 @@ "packageUri": "lib/", "languageVersion": "3.3" }, + { + "name": "extended_image", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/extended_image-8.3.1", + "packageUri": "lib/", + "languageVersion": "2.18" + }, + { + "name": "extended_image_library", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/extended_image_library-4.0.6", + "packageUri": "lib/", + "languageVersion": "3.2" + }, { "name": "fake_async", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/fake_async-1.3.1", @@ -145,6 +169,18 @@ "packageUri": "lib/", "languageVersion": "3.4" }, + { + "name": "flex_color_picker", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flex_color_picker-3.7.1", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "flex_seed_scheme", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flex_seed_scheme-3.5.1", + "packageUri": "lib/", + "languageVersion": "3.0" + }, { "name": "flustars_flutter3", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flustars_flutter3-3.0.0", @@ -259,12 +295,24 @@ "packageUri": "lib/", "languageVersion": "3.4" }, + { + "name": "font_awesome_flutter", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/font_awesome_flutter-10.9.1", + "packageUri": "lib/", + "languageVersion": "3.0" + }, { "name": "get", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/get-4.7.2", "packageUri": "lib/", "languageVersion": "2.15" }, + { + "name": "hand_signature", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/hand_signature-3.1.0+2", + "packageUri": "lib/", + "languageVersion": "3.0" + }, { "name": "html", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/html-0.15.6", @@ -277,12 +325,30 @@ "packageUri": "lib/", "languageVersion": "3.4" }, + { + "name": "http_client_helper", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/http_client_helper-3.0.0", + "packageUri": "lib/", + "languageVersion": "2.12" + }, { "name": "http_parser", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/http_parser-4.1.2", "packageUri": "lib/", "languageVersion": "3.4" }, + { + "name": "image", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image-4.5.4", + "packageUri": "lib/", + "languageVersion": "3.0" + }, + { + "name": "image_editor_plus", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_editor_plus-1.0.6", + "packageUri": "lib/", + "languageVersion": "2.17" + }, { "name": "image_gallery_saver_plus", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_gallery_saver_plus-4.0.1", @@ -343,6 +409,12 @@ "packageUri": "lib/", "languageVersion": "3.3" }, + { + "name": "js", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/js-0.7.1", + "packageUri": "lib/", + "languageVersion": "3.1" + }, { "name": "leak_tracker", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/leak_tracker-10.0.7", @@ -385,6 +457,12 @@ "packageUri": "lib/", "languageVersion": "2.17" }, + { + "name": "matrix2d", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/matrix2d-1.0.4", + "packageUri": "lib/", + "languageVersion": "2.12" + }, { "name": "meta", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/meta-1.15.0", @@ -517,6 +595,12 @@ "packageUri": "lib/", "languageVersion": "3.0" }, + { + "name": "posix", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/posix-6.0.3", + "packageUri": "lib/", + "languageVersion": "3.0" + }, { "name": "provider", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/provider-6.1.5+1", @@ -535,6 +619,12 @@ "packageUri": "lib/", "languageVersion": "2.14" }, + { + "name": "reorderables", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/reorderables-0.6.0", + "packageUri": "lib/", + "languageVersion": "2.12" + }, { "name": "screen_brightness", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screen_brightness-2.1.7", @@ -577,6 +667,12 @@ "packageUri": "lib/", "languageVersion": "3.0" }, + { + "name": "screenshot", + "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screenshot-3.0.0", + "packageUri": "lib/", + "languageVersion": "2.12" + }, { "name": "shared_preferences", "rootUri": "file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-2.5.3", @@ -830,7 +926,7 @@ "languageVersion": "3.6" } ], - "generated": "2025-11-10T09:10:29.853637Z", + "generated": "2025-11-14T03:05:37.015796Z", "generator": "pub", "generatorVersion": "3.6.2", "flutterRoot": "file:///Users/wxl/Desktop/flutter", diff --git a/.dart_tool/package_config_subset b/.dart_tool/package_config_subset index 0a9c361..9555d02 100644 --- a/.dart_tool/package_config_subset +++ b/.dart_tool/package_config_subset @@ -1,3 +1,7 @@ +archive +3.0 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/archive-4.0.7/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/archive-4.0.7/lib/ args 3.3 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/args-2.7.0/ @@ -22,6 +26,10 @@ collection 3.4 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/collection-1.19.0/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/collection-1.19.0/lib/ +colorfilter_generator +2.15 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/colorfilter_generator-0.0.8/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/colorfilter_generator-0.0.8/lib/ common_utils 2.12 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/common_utils-2.1.0/ @@ -66,6 +74,14 @@ dio_web_adapter 3.3 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/dio_web_adapter-2.1.1/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/dio_web_adapter-2.1.1/lib/ +extended_image +2.18 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/extended_image-8.3.1/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/extended_image-8.3.1/lib/ +extended_image_library +3.2 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/extended_image_library-4.0.6/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/extended_image_library-4.0.6/lib/ fake_async 2.12 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/fake_async-1.3.1/ @@ -94,6 +110,14 @@ file_selector_windows 3.4 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/file_selector_windows-0.9.3+4/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/file_selector_windows-0.9.3+4/lib/ +flex_color_picker +3.0 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flex_color_picker-3.7.1/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flex_color_picker-3.7.1/lib/ +flex_seed_scheme +3.0 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flex_seed_scheme-3.5.1/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flex_seed_scheme-3.5.1/lib/ flustars_flutter3 2.12 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flustars_flutter3-3.0.0/ @@ -158,10 +182,18 @@ flutter_widget_from_html_core 3.4 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flutter_widget_from_html_core-0.16.1/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/flutter_widget_from_html_core-0.16.1/lib/ +font_awesome_flutter +3.0 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/font_awesome_flutter-10.9.1/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/font_awesome_flutter-10.9.1/lib/ get 2.15 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/get-4.7.2/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/get-4.7.2/lib/ +hand_signature +3.0 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/hand_signature-3.1.0+2/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/hand_signature-3.1.0+2/lib/ html 3.2 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/html-0.15.6/ @@ -170,10 +202,22 @@ http 3.4 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/http-1.5.0/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/http-1.5.0/lib/ +http_client_helper +2.12 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/http_client_helper-3.0.0/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/http_client_helper-3.0.0/lib/ http_parser 3.4 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/http_parser-4.1.2/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/http_parser-4.1.2/lib/ +image +3.0 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image-4.5.4/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image-4.5.4/lib/ +image_editor_plus +2.17 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_editor_plus-1.0.6/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_editor_plus-1.0.6/lib/ image_gallery_saver_plus 3.5 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/image_gallery_saver_plus-4.0.1/ @@ -214,6 +258,10 @@ intl 3.3 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/intl-0.20.2/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/intl-0.20.2/lib/ +js +3.1 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/js-0.7.1/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/js-0.7.1/lib/ leak_tracker 3.2 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/leak_tracker-10.0.7/ @@ -242,6 +290,10 @@ material_color_utilities 2.17 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/material_color_utilities-0.11.1/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/material_color_utilities-0.11.1/lib/ +matrix2d +2.12 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/matrix2d-1.0.4/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/matrix2d-1.0.4/lib/ meta 2.12 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/meta-1.15.0/ @@ -330,6 +382,10 @@ plugin_platform_interface 3.0 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/plugin_platform_interface-2.1.8/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/plugin_platform_interface-2.1.8/lib/ +posix +3.0 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/posix-6.0.3/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/posix-6.0.3/lib/ provider 2.12 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/provider-6.1.5+1/ @@ -342,6 +398,10 @@ rational 2.14 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/rational-2.2.3/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/rational-2.2.3/lib/ +reorderables +2.12 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/reorderables-0.6.0/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/reorderables-0.6.0/lib/ screen_brightness 3.0 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screen_brightness-2.1.7/ @@ -370,6 +430,10 @@ screen_brightness_windows 3.0 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screen_brightness_windows-2.1.0/ file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screen_brightness_windows-2.1.0/lib/ +screenshot +2.12 +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screenshot-3.0.0/ +file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/screenshot-3.0.0/lib/ shared_preferences 3.5 file:///Users/wxl/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-2.5.3/ diff --git a/.idea/flutter_common.iml b/.idea/flutter_common.iml index c7d8949..0e5878c 100644 --- a/.idea/flutter_common.iml +++ b/.idea/flutter_common.iml @@ -6,6 +6,9 @@ + + + diff --git a/example/android/settings.gradle b/example/android/settings.gradle index b9e43bd..3723bfb 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -19,7 +19,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.1.0" apply false - id "org.jetbrains.kotlin.android" version "1.8.22" apply false + id "org.jetbrains.kotlin.android" version "2.2.21" apply false } include ":app" diff --git a/example/lib/main.dart b/example/lib/main.dart index 6626bf2..cf44fdf 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -2,6 +2,9 @@ import 'package:dio/dio.dart'; import 'package:example/exif/customer_exif_Page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_common/upload_image/look_images_widget.dart'; +import 'package:flutter_common/upload_image/upload_images_tool.dart'; +import 'package:get/get.dart'; import 'package:image_editor_plus/image_editor_plus.dart'; void main() { @@ -14,34 +17,21 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo', + return GetMaterialApp( + title: '熊猫文旅通', + debugShowCheckedModeBanner: false, theme: ThemeData( - // This is the theme of your application. - // - // TRY THIS: Try running your application with "flutter run". You'll see - // the application has a purple toolbar. Then, without quitting the app, - // try changing the seedColor in the colorScheme below to Colors.green - // and then invoke "hot reload" (save your changes or press the "hot - // reload" button in a Flutter-supported IDE, or press "r" if you used - // the command line to start the app). - // - // Notice that the counter didn't reset back to zero; the application - // state is not lost during the reload. To reset the state, use hot - // restart instead. - // - // This works for code too, not just values: Most code changes can be - // tested with just a hot reload. - colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), - useMaterial3: true, + appBarTheme: AppBarTheme(surfaceTintColor: Colors.transparent), + scaffoldBackgroundColor: const Color(0xffF5F5F5), + // useMaterial3: true, + // colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple) + // .copyWith(background: const Color(0xffF5F5F5)), ), - // home: const MyHomePage(title: 'Flutter Demo Home Page'), - home: CustomerExifPage(), + home: const MyHomePage(title: '编辑图片'), ); } } - /// Dio 最简版:网络图片转 Uint8List Future networkImageToUint8ListWithDio(String imageUrl) async { final dio = Dio(); // 初始化 Dio 实例 @@ -52,16 +42,13 @@ Future networkImageToUint8ListWithDio(String imageUrl) async { options: Options(responseType: ResponseType.bytes), ); // 响应成功且数据非空时,直接转为 Uint8List - return response.statusCode == 200 && response.data != null - ? Uint8List.fromList(response.data!) - : null; + return response.statusCode == 200 && response.data != null ? Uint8List.fromList(response.data!) : null; } catch (e) { print('图片转换失败:$e'); // 捕获网络错误、URL 非法等异常 return null; } } - class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); @@ -83,16 +70,15 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { final int _counter = 0; - Future _incrementCounter()async { - String imageUrl = 'https://static.cop.jingheyijia.com/wxapp-map2/upload/moment/20251029/app-bpItvFOQufCL.jpg'; - Uint8List? imageBytes = await networkImageToUint8ListWithDio(imageUrl); + Future editImage({required String url})async{ + Uint8List? imageBytes = await networkImageToUint8ListWithDio(url); ImageEditor.setI18n({ 'crop': '裁剪', 'rotate left': '左旋转', 'rotate right': '右旋转', 'flip': '水平翻转', 'brush': '涂抹', - 'link':'链接', + 'link': '链接', 'save': '保存', 'text': '文本', 'blur': '模糊', @@ -109,8 +95,8 @@ class _MyHomePageState extends State { 'color opacity': '透明度', 'blur radius': '模糊半径', }); - if(mounted){ - final editedImage = await Navigator.push( + if (mounted) { + Uint8List? editedImage = await Navigator.push( context, MaterialPageRoute( builder: (context) => ImageEditor( @@ -123,10 +109,16 @@ class _MyHomePageState extends State { ), ), ); + return editedImage; } + return null; } + Future _incrementCounter() async { + + } + @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done @@ -181,4 +173,4 @@ class _MyHomePageState extends State { ), // This trailing comma makes auto-formatting nicer for build methods. ); } -} \ No newline at end of file +} diff --git a/example/linux/flutter/generated_plugin_registrant.cc b/example/linux/flutter/generated_plugin_registrant.cc index 64a0ece..7299b5c 100644 --- a/example/linux/flutter/generated_plugin_registrant.cc +++ b/example/linux/flutter/generated_plugin_registrant.cc @@ -7,9 +7,13 @@ #include "generated_plugin_registrant.h" #include +#include void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); file_selector_plugin_register_with_registrar(file_selector_linux_registrar); + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/example/linux/flutter/generated_plugins.cmake b/example/linux/flutter/generated_plugins.cmake index 2db3c22..786ff5c 100644 --- a/example/linux/flutter/generated_plugins.cmake +++ b/example/linux/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST file_selector_linux + url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/example/pubspec.lock b/example/pubspec.lock index bc9fda1..2b8aa30 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -9,6 +9,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.0.7" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.7.0" async: dependency: transitive description: @@ -57,6 +65,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.0.8" + common_utils: + dependency: transitive + description: + name: common_utils + sha256: c26884339b13ff99b0739e56f4b02090c84054ed9dd3a045435cd24e7b99c2c1 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.2" cross_file: dependency: transitive description: @@ -73,6 +97,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.0.7" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.2" cupertino_icons: dependency: "direct main" description: @@ -81,6 +113,38 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.8" + dbus: + dependency: transitive + description: + name: dbus + sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.7.11" + decimal: + dependency: transitive + description: + name: decimal + sha256: fc706a5618b81e5b367b01dd62621def37abc096f2b46a9bd9068b64c1fa36d0 + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.4" + device_info_plus: + dependency: transitive + description: + name: device_info_plus + sha256: "72d146c6d7098689ff5c5f66bcf593ac11efc530095385356e131070333e64da" + url: "https://pub.flutter-io.cn" + source: hosted + version: "11.3.0" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: "0b04e02b30791224b31969eb1b50d723498f402971bff3630bca2ba839bd1ed2" + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.2" dio: dependency: "direct main" description: @@ -129,6 +193,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.3" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.1" file_selector_linux: dependency: transitive description: @@ -177,11 +249,98 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.5.1" + flustars_flutter3: + dependency: transitive + description: + name: flustars_flutter3 + sha256: d4f412eeb97e648dfe5cf888aa9066f6c1b1f133ff72dca264c0d23a906e3dab + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_common: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "0.0.1" + flutter_easyloading: + dependency: transitive + description: + name: flutter_easyloading + sha256: ba21a3c883544e582f9cc455a4a0907556714e1e9cf0eababfcb600da191d17c + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.5" + flutter_inappwebview: + dependency: transitive + description: + name: flutter_inappwebview + sha256: "80092d13d3e29b6227e25b67973c67c7210bd5e35c4b747ca908e31eb71a46d5" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.1.5" + flutter_inappwebview_android: + dependency: transitive + description: + name: flutter_inappwebview_android + sha256: "62557c15a5c2db5d195cb3892aab74fcaec266d7b86d59a6f0027abd672cddba" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.3" + flutter_inappwebview_internal_annotations: + dependency: transitive + description: + name: flutter_inappwebview_internal_annotations + sha256: "787171d43f8af67864740b6f04166c13190aa74a1468a1f1f1e9ee5b90c359cd" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.2.0" + flutter_inappwebview_ios: + dependency: transitive + description: + name: flutter_inappwebview_ios + sha256: "5818cf9b26cf0cbb0f62ff50772217d41ea8d3d9cc00279c45f8aabaa1b4025d" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.2" + flutter_inappwebview_macos: + dependency: transitive + description: + name: flutter_inappwebview_macos + sha256: c1fbb86af1a3738e3541364d7d1866315ffb0468a1a77e34198c9be571287da1 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.2" + flutter_inappwebview_platform_interface: + dependency: transitive + description: + name: flutter_inappwebview_platform_interface + sha256: cf5323e194096b6ede7a1ca808c3e0a078e4b33cc3f6338977d75b4024ba2500 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0+1" + flutter_inappwebview_web: + dependency: transitive + description: + name: flutter_inappwebview_web + sha256: "55f89c83b0a0d3b7893306b3bb545ba4770a4df018204917148ebb42dc14a598" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.2" + flutter_inappwebview_windows: + dependency: transitive + description: + name: flutter_inappwebview_windows + sha256: "8b4d3a46078a2cdc636c4a3d10d10f2a16882f6be607962dbfff8874d1642055" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.0" flutter_lints: dependency: "direct dev" description: @@ -198,6 +357,30 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.0.29" + flutter_screenutil: + dependency: transitive + description: + name: flutter_screenutil + sha256: "8239210dd68bee6b0577aa4a090890342d04a136ce1c81f98ee513fc0ce891de" + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.9.3" + flutter_spinkit: + dependency: transitive + description: + name: flutter_spinkit + sha256: "77850df57c00dc218bfe96071d576a8babec24cf58b2ed121c83cca4a2fdce7f" + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.2.2" + flutter_staggered_grid_view: + dependency: transitive + description: + name: flutter_staggered_grid_view + sha256: "19e7abb550c96fbfeb546b23f3ff356ee7c59a019a651f8f102a4ba9b7349395" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.7.0" flutter_test: dependency: "direct dev" description: flutter @@ -208,6 +391,14 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_widget_from_html_core: + dependency: transitive + description: + name: flutter_widget_from_html_core + sha256: "50990ec287434a280ed15d602aa3bf6e8db9c54159762d906057a04e9493b91a" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.16.1" font_awesome_flutter: dependency: transitive description: @@ -216,6 +407,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "10.9.1" + get: + dependency: "direct main" + description: + name: get + sha256: c79eeb4339f1f3deffd9ec912f8a923834bec55f7b49c9e882b8fef2c139d425 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.7.2" hand_signature: dependency: transitive description: @@ -224,14 +423,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.1.0+2" + html: + dependency: transitive + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.15.6" http: dependency: transitive description: name: http - sha256: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007 + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" url: "https://pub.flutter-io.cn" source: hosted - version: "1.5.0" + version: "1.6.0" http_client_helper: dependency: transitive description: @@ -264,8 +471,16 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.6" - image_picker: + image_gallery_saver_plus: dependency: transitive + description: + name: image_gallery_saver_plus + sha256: "199b9e24f8d85e98f11e3d35571ab68ae50626ad40e2bb85c84383f69a6950ad" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.1" + image_picker: + dependency: "direct main" description: name: image_picker sha256: "736eb56a911cf24d1859315ad09ddec0b66104bc41a7f8c5b96b4e2620cf5041" @@ -328,6 +543,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.2.2" + intl: + dependency: transitive + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.20.2" js: dependency: transitive description: @@ -368,6 +591,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "5.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" matcher: dependency: transitive description: @@ -408,6 +639,30 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d + url: "https://pub.flutter-io.cn" + source: hosted + version: "9.0.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.1" path: dependency: transitive description: @@ -520,6 +775,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "6.0.2" + photo_view: + dependency: transitive + description: + name: photo_view + sha256: "1fc3d970a91295fbd1364296575f854c9863f225505c28c46e0a03e48960c75e" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.15.0" platform: dependency: transitive description: @@ -544,6 +807,30 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "6.0.3" + provider: + dependency: transitive + description: + name: provider + sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.1.5+1" + pull_to_refresh: + dependency: transitive + description: + name: pull_to_refresh + sha256: bbadd5a931837b57739cf08736bea63167e284e71fb23b218c8c9a6e042aad12 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.2.3" reorderables: dependency: transitive description: @@ -552,6 +839,62 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.6.0" + screen_brightness: + dependency: transitive + description: + name: screen_brightness + sha256: "5f70754028f169f059fdc61112a19dcbee152f8b293c42c848317854d650cba3" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.7" + screen_brightness_android: + dependency: transitive + description: + name: screen_brightness_android + sha256: d34f5321abd03bc3474f4c381f53d189117eba0b039eac1916aa92cca5fd0a96 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.3" + screen_brightness_ios: + dependency: transitive + description: + name: screen_brightness_ios + sha256: "2493953340ecfe8f4f13f61db50ce72533a55b0bbd58ba1402893feecf3727f5" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.2" + screen_brightness_macos: + dependency: transitive + description: + name: screen_brightness_macos + sha256: "4edf330ad21078686d8bfaf89413325fbaf571dcebe1e89254d675a3f288b5b9" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.1" + screen_brightness_ohos: + dependency: transitive + description: + name: screen_brightness_ohos + sha256: a93a263dcd39b5c56e589eb495bcd001ce65cdd96ff12ab1350683559d5c5bb7 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.2" + screen_brightness_platform_interface: + dependency: transitive + description: + name: screen_brightness_platform_interface + sha256: "737bd47b57746bc4291cab1b8a5843ee881af499514881b0247ec77447ee769c" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" + screen_brightness_windows: + dependency: transitive + description: + name: screen_brightness_windows + sha256: d3518bf0f5d7a884cee2c14449ae0b36803802866de09f7ef74077874b6b2448 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" screenshot: dependency: transitive description: @@ -560,6 +903,62 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.0.0" + shared_preferences: + dependency: transitive + description: + name: shared_preferences + sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.5.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "5bcf0772a761b04f8c6bf814721713de6f3e5d9d89caf8d3fe031b02a342379e" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.11" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.5.4" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" sky_engine: dependency: transitive description: flutter @@ -573,6 +972,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.10.0" + sp_util: + dependency: transitive + description: + name: sp_util + sha256: "9da43dce5de79c17a787d0626bf01538d63090ca32521200d22a232171c495dc" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.3" stack_trace: dependency: transitive description: @@ -581,6 +988,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.12.0" + sticky_headers: + dependency: transitive + description: + name: sticky_headers + sha256: "9b3dd2cb0fd6a7038170af3261f855660cbb241cb56c501452cb8deed7023ede" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.0+2" stream_channel: dependency: transitive description: @@ -597,6 +1012,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.3.0+3" term_glyph: dependency: transitive description: @@ -613,6 +1036,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.7.3" + transparent_image: + dependency: transitive + description: + name: transparent_image + sha256: e8991d955a2094e197ca24c645efec2faf4285772a4746126ca12875e54ca02f + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.1" typed_data: dependency: transitive description: @@ -621,6 +1052,70 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.4.0" + url_launcher: + dependency: transitive + description: + name: url_launcher + sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8 + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.3.2" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "0aedad096a85b49df2e4725fa32118f9fa580f3b14af7a2d2221896a02cd5656" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.3.17" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.3.3" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.2.2" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.4" vector_math: dependency: transitive description: @@ -629,6 +1124,46 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.4" + video_player: + dependency: transitive + description: + name: video_player + sha256: "0d55b1f1a31e5ad4c4967bfaa8ade0240b07d20ee4af1dfef5f531056512961a" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.10.0" + video_player_android: + dependency: transitive + description: + name: video_player_android + sha256: "28dcc4122079f40f93a0965b3679aff1a5f4251cf79611bd8011f937eb6b69de" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.8.4" + video_player_avfoundation: + dependency: transitive + description: + name: video_player_avfoundation + sha256: f9a780aac57802b2892f93787e5ea53b5f43cc57dc107bee9436458365be71cd + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.8.4" + video_player_platform_interface: + dependency: transitive + description: + name: video_player_platform_interface + sha256: cf2a1d29a284db648fd66cbd18aacc157f9862d77d2cc790f6f9678a46c1db5a + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.4.0" + video_player_web: + dependency: transitive + description: + name: video_player_web + sha256: "9f3c00be2ef9b76a95d94ac5119fb843dca6f2c69e6c9968f6f2b6c9e7afbdeb" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.4.0" vm_service: dependency: transitive description: @@ -637,14 +1172,46 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "14.3.0" + wakelock_plus: + dependency: transitive + description: + name: wakelock_plus + sha256: "9296d40c9adbedaba95d1e704f4e0b434be446e2792948d0e4aa977048104228" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.4.0" + wakelock_plus_platform_interface: + dependency: transitive + description: + name: wakelock_plus_platform_interface + sha256: "036deb14cd62f558ca3b73006d52ce049fabcdcb2eddfe0bf0fe4e8a943b5cf2" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.3.0" web: dependency: transitive description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" url: "https://pub.flutter-io.cn" source: hosted - version: "0.5.1" + version: "1.1.1" + win32: + dependency: transitive + description: + name: win32 + sha256: daf97c9d80197ed7b619040e86c8ab9a9dad285e7671ee7390f9180cc828a51e + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.10.1" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "21ec76dfc731550fd3e2ce7a33a9ea90b828fdf19a5c3bcf556fa992cfa99852" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.5" xdg_directories: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f8216f1..6f50b3a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -28,6 +28,8 @@ environment: # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: + flutter_common: + path: ../ flutter: sdk: flutter @@ -35,15 +37,12 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 image_editor_plus: ^1.0.6 + get: ^4.6.5 dio: ^5.9.0 image_picker: ^1.1.0 #相册单选 # native_exif: ^0.6.2 # exif: ^3.3.0 - flutter_common: - git: - url: https://code.keplerjai.com/wangliankun/flutter_common.git - dev_dependencies: flutter_test: sdk: flutter diff --git a/lib/upload_image/look_images_widget.dart b/lib/upload_image/look_images_widget.dart index 1a2e76d..80c3c3b 100644 --- a/lib/upload_image/look_images_widget.dart +++ b/lib/upload_image/look_images_widget.dart @@ -1,23 +1,38 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_common/upload_image/ossUtil.dart'; import 'package:get/get.dart'; -import 'package:photo_view/photo_view.dart'; +import 'package:image_editor_plus/image_editor_plus.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:photo_view/photo_view_gallery.dart'; class LookImagesTool { static lookImages({ required List listData, int? currentPage, - Function? editCallback, + String? oSSAccessKeyId, + String? policy, + String? callback, + String? signature, + String? ossDirectory, + String? ossHost, }) async { showDialog( context: Get.context!, useSafeArea: false, builder: (_) { return LookImagesWidget( - listData: listData, - currentPage: currentPage, - editCallback: editCallback, - ); + listData: listData, + currentPage: currentPage, + oSSAccessKeyId: oSSAccessKeyId, + policy: policy, + callback: callback, + signature: signature, + ossDirectory: ossDirectory, + ossHost: ossHost); }); } } @@ -25,13 +40,23 @@ class LookImagesTool { class LookImagesWidget extends StatefulWidget { final List listData; final int? currentPage; - final Function? editCallback; + final String? oSSAccessKeyId; + final String? policy; + final String? callback; + final String? signature; + final String? ossDirectory; + final String? ossHost; const LookImagesWidget({ super.key, required this.listData, this.currentPage, - this.editCallback, + this.oSSAccessKeyId, + this.policy, + this.callback, + this.signature, + this.ossDirectory, + this.ossHost, }); @override @@ -43,6 +68,67 @@ class _LookImagesWidgetState extends State { late int currentPage; late int initialPage = 0; + /// Dio 最简版:网络图片转 Uint8List + Future networkImageToUint8ListWithDio(String imageUrl) async { + final dio = Dio(); // 初始化 Dio 实例 + try { + // 发起 GET 请求,响应类型设为字节数组(关键) + final response = await dio.get>( + imageUrl, + options: Options(responseType: ResponseType.bytes), + ); + // 响应成功且数据非空时,直接转为 Uint8List + return response.statusCode == 200 && response.data != null ? Uint8List.fromList(response.data!) : null; + } catch (e) { + print('图片转换失败:$e'); // 捕获网络错误、URL 非法等异常 + return null; + } + } + + Future editImage({required String url}) async { + Uint8List? imageBytes = await networkImageToUint8ListWithDio(url); + ImageEditor.setI18n({ + 'crop': '裁剪', + 'rotate left': '左旋转', + 'rotate right': '右旋转', + 'flip': '水平翻转', + 'brush': '涂抹', + 'link': '链接', + 'save': '保存', + 'text': '文本', + 'blur': '模糊', + 'filter': '滤镜', + 'size': '大小', + 'color': '颜色', + 'background color': '背景颜色', + 'background opacity': '背景透明度', + 'reset': '重置', + 'freeform': '自由裁剪', + 'remove': '移除', + 'emoji': '表情', + 'slider color': '滑块颜色', + 'color opacity': '透明度', + 'blur radius': '模糊半径', + }); + if (mounted) { + Uint8List? editedImage = await Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ImageEditor( + image: imageBytes, + blurOption: null, + filtersOption: null, + brushOption: null, + textOption: null, + emojiOption: null, + ), + ), + ); + return editedImage; + } + return null; + } + @override void initState() { listData = widget.listData; @@ -84,7 +170,74 @@ class _LookImagesWidgetState extends State { Positioned( right: 15, top: 50, - child: GestureDetector(onTap: () => widget.editCallback?.call(), child: Icon(Icons.edit, color: Colors.white))), + child: GestureDetector( + onTap: () async { + Uint8List? imageFile = await editImage(url: listData[currentPage]); + + /// 可选:根据字节头自动识别文件后缀(如图片、视频) + String getExtension(Uint8List uint8List) { + if (uint8List.length < 4) return "bin"; // 无法识别时返回二进制后缀 + + // PNG 头:89 50 4E 47 + if (uint8List[0] == 0x89 && + uint8List[1] == 0x50 && + uint8List[2] == 0x4E && + uint8List[3] == 0x47) { + return "png"; + } + // JPG 头:FF D8 FF + else if (uint8List[0] == 0xFF && uint8List[1] == 0xD8 && uint8List[2] == 0xFF) { + return "jpg"; + } + // MP4 头:00 00 00 18 66 74 79 70 + else if (uint8List.length >= 8 && + uint8List[0] == 0x00 && + uint8List[1] == 0x00 && + uint8List[2] == 0x00 && + uint8List[3] == 0x18 && + uint8List[4] == 0x66 && + uint8List[5] == 0x74 && + uint8List[6] == 0x79 && + uint8List[7] == 0x70) { + return "mp4"; + } + // 其他格式可自行扩展(如 GIF、PDF 等) + else { + return "bin"; + } + } + + /// Uint8List 转临时 File + Future uint8ListToTempFile(Uint8List uint8List, {String fileName = "temp_file"}) async { + try { + // 1. 获取临时存储目录(跨平台兼容) + Directory tempDir = await getTemporaryDirectory(); + String tempPath = tempDir.path; + + // 2. 拼接文件路径(可自定义后缀,如 .png、.mp4 等) + File tempFile = File("$tempPath/$fileName.${getExtension(uint8List)}"); // 自动识别后缀(可选) + + // 3. 将 Uint8List 写入文件 + await tempFile.writeAsBytes(uint8List); + print("临时文件路径:${tempFile.path}"); + String string = await UploadOss.upload( + tempFile.path, + fileType: getExtension(uint8List), + oSSAccessKeyId: widget.oSSAccessKeyId ?? '', + ossHost: widget.ossHost ?? '', + ossDirectory: widget.ossDirectory ?? '', + policy: widget.policy ?? '', + callback: widget.callback ?? '', + signature: widget.signature ?? '', + ); + return tempFile; + } catch (e) { + print("转换临时文件失败:$e"); + return null; + } + } + }, + child: Icon(Icons.edit, color: Colors.white))), //图片张数指示器 Positioned( left: 0, diff --git a/pubspec.lock b/pubspec.lock index 11bd018..5a69849 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.7" args: dependency: transitive description: @@ -49,6 +57,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.19.0" + colorfilter_generator: + dependency: transitive + description: + name: colorfilter_generator + sha256: ccc2995e440b1d828d55d99150e7cad64624f3cb4a1e235000de3f93cf10d35c + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.8" common_utils: dependency: transitive description: @@ -137,6 +153,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" + extended_image: + dependency: transitive + description: + name: extended_image + sha256: "69d4299043334ecece679996e47d0b0891cd8c29d8da0034868443506f1d9a78" + url: "https://pub.flutter-io.cn" + source: hosted + version: "8.3.1" + extended_image_library: + dependency: transitive + description: + name: extended_image_library + sha256: e61dafd94400fff6ef7ed1523d445ff3af137f198f3228e4a3107bc5b4bec5d1 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.6" fake_async: dependency: transitive description: @@ -193,6 +225,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.9.3+4" + flex_color_picker: + dependency: transitive + description: + name: flex_color_picker + sha256: "8f753a1a026a13ea5cc5eddbae3ceb886f2537569ab2e5208efb1e3bb5af72ff" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.7.1" + flex_seed_scheme: + dependency: transitive + description: + name: flex_seed_scheme + sha256: b06d8b367b84cbf7ca5c5603c858fa5edae88486c4e4da79ac1044d73b6c62ec + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.5.1" flustars_flutter3: dependency: "direct main" description: @@ -336,6 +384,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.16.1" + font_awesome_flutter: + dependency: transitive + description: + name: font_awesome_flutter + sha256: b738e35f8bb4957896c34957baf922f99c5d415b38ddc8b070d14b7fa95715d4 + url: "https://pub.flutter-io.cn" + source: hosted + version: "10.9.1" get: dependency: "direct main" description: @@ -344,6 +400,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.7.2" + hand_signature: + dependency: transitive + description: + name: hand_signature + sha256: "05b40d3b2d1885a5dda126f26db386660aa46e497b63c96feb91d3198a667eea" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.1.0+2" html: dependency: transitive description: @@ -360,6 +424,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.5.0" + http_client_helper: + dependency: transitive + description: + name: http_client_helper + sha256: "8a9127650734da86b5c73760de2b404494c968a3fd55602045ffec789dac3cb1" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" http_parser: dependency: transitive description: @@ -368,6 +440,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928" + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.5.4" + image_editor_plus: + dependency: "direct main" + description: + name: image_editor_plus + sha256: "0108c24756e7867f9a325c8f1d15ff29ca0a40aae03517e7d55dee6135f9b3e6" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.6" image_gallery_saver_plus: dependency: "direct main" description: @@ -448,6 +536,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.20.2" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.7.1" leak_tracker: dependency: transitive description: @@ -504,6 +600,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.11.1" + matrix2d: + dependency: transitive + description: + name: matrix2d + sha256: "188718dd3bc2a31e372cfd0791b0f77f4f13ea76164147342cc378d9132949e7" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.4" meta: dependency: transitive description: @@ -553,7 +657,7 @@ packages: source: hosted version: "1.9.0" path_provider: - dependency: transitive + dependency: "direct main" description: name: path_provider sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" @@ -680,6 +784,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.8" + posix: + dependency: transitive + description: + name: posix + sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61" + url: "https://pub.flutter-io.cn" + source: hosted + version: "6.0.3" provider: dependency: "direct main" description: @@ -704,6 +816,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.2.3" + reorderables: + dependency: transitive + description: + name: reorderables + sha256: "004a886e4878df1ee27321831c838bc1c976311f4ca6a74ce7d561e506540a77" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.6.0" screen_brightness: dependency: "direct main" description: @@ -760,6 +880,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.0" + screenshot: + dependency: transitive + description: + name: screenshot + sha256: "63817697a7835e6ce82add4228e15d233b74d42975c143ad8cfe07009fab866b" + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" shared_preferences: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 464536d..2395fcb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -38,6 +38,8 @@ dependencies: url_launcher: ^6.1.10 flutter_inappwebview: ^6.1.5 device_info_plus: ^11.3.0 + image_editor_plus: ^1.0.6 + path_provider: ^2.1.5 dev_dependencies: flutter_test: From 13d5a31197f7f89483b93206af91d611cf297d63 Mon Sep 17 00:00:00 2001 From: wuxinglong Date: Fri, 14 Nov 2025 13:43:24 +0800 Subject: [PATCH 3/8] =?UTF-8?q?feat:=E8=B0=83=E6=95=B4=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/upload_image/look_images_widget.dart | 129 ++++++++++++----------- 1 file changed, 66 insertions(+), 63 deletions(-) diff --git a/lib/upload_image/look_images_widget.dart b/lib/upload_image/look_images_widget.dart index 80c3c3b..641dd65 100644 --- a/lib/upload_image/look_images_widget.dart +++ b/lib/upload_image/look_images_widget.dart @@ -129,6 +129,71 @@ class _LookImagesWidgetState extends State { return null; } + + /// 可选:根据字节头自动识别文件后缀(如图片、视频) + String getExtension(Uint8List uint8List) { + if (uint8List.length < 4) return "bin"; // 无法识别时返回二进制后缀 + + // PNG 头:89 50 4E 47 + if (uint8List[0] == 0x89 && + uint8List[1] == 0x50 && + uint8List[2] == 0x4E && + uint8List[3] == 0x47) { + return "png"; + } + // JPG 头:FF D8 FF + else if (uint8List[0] == 0xFF && uint8List[1] == 0xD8 && uint8List[2] == 0xFF) { + return "jpg"; + } + // MP4 头:00 00 00 18 66 74 79 70 + else if (uint8List.length >= 8 && + uint8List[0] == 0x00 && + uint8List[1] == 0x00 && + uint8List[2] == 0x00 && + uint8List[3] == 0x18 && + uint8List[4] == 0x66 && + uint8List[5] == 0x74 && + uint8List[6] == 0x79 && + uint8List[7] == 0x70) { + return "mp4"; + } + // 其他格式可自行扩展(如 GIF、PDF 等) + else { + return "bin"; + } + } + + /// Uint8List 转临时 File + Future uint8ListToTempFile(Uint8List uint8List, {String fileName = "temp_file"}) async { + try { + // 1. 获取临时存储目录(跨平台兼容) + Directory tempDir = await getTemporaryDirectory(); + String tempPath = tempDir.path; + + // 2. 拼接文件路径(可自定义后缀,如 .png、.mp4 等) + File tempFile = File("$tempPath/$fileName.${getExtension(uint8List)}"); // 自动识别后缀(可选) + + // 3. 将 Uint8List 写入文件 + await tempFile.writeAsBytes(uint8List); + print("临时文件路径:${tempFile.path}"); + String imageUrl = await UploadOss.upload( + tempFile.path, + fileType: getExtension(uint8List), + oSSAccessKeyId: widget.oSSAccessKeyId ?? '', + ossHost: widget.ossHost ?? '', + ossDirectory: widget.ossDirectory ?? '', + policy: widget.policy ?? '', + callback: widget.callback ?? '', + signature: widget.signature ?? '', + ); + print("上传后的路径:$imageUrl"); + return tempFile; + } catch (e) { + print("转换临时文件失败:$e"); + return null; + } + } + @override void initState() { listData = widget.listData; @@ -173,69 +238,7 @@ class _LookImagesWidgetState extends State { child: GestureDetector( onTap: () async { Uint8List? imageFile = await editImage(url: listData[currentPage]); - - /// 可选:根据字节头自动识别文件后缀(如图片、视频) - String getExtension(Uint8List uint8List) { - if (uint8List.length < 4) return "bin"; // 无法识别时返回二进制后缀 - - // PNG 头:89 50 4E 47 - if (uint8List[0] == 0x89 && - uint8List[1] == 0x50 && - uint8List[2] == 0x4E && - uint8List[3] == 0x47) { - return "png"; - } - // JPG 头:FF D8 FF - else if (uint8List[0] == 0xFF && uint8List[1] == 0xD8 && uint8List[2] == 0xFF) { - return "jpg"; - } - // MP4 头:00 00 00 18 66 74 79 70 - else if (uint8List.length >= 8 && - uint8List[0] == 0x00 && - uint8List[1] == 0x00 && - uint8List[2] == 0x00 && - uint8List[3] == 0x18 && - uint8List[4] == 0x66 && - uint8List[5] == 0x74 && - uint8List[6] == 0x79 && - uint8List[7] == 0x70) { - return "mp4"; - } - // 其他格式可自行扩展(如 GIF、PDF 等) - else { - return "bin"; - } - } - - /// Uint8List 转临时 File - Future uint8ListToTempFile(Uint8List uint8List, {String fileName = "temp_file"}) async { - try { - // 1. 获取临时存储目录(跨平台兼容) - Directory tempDir = await getTemporaryDirectory(); - String tempPath = tempDir.path; - - // 2. 拼接文件路径(可自定义后缀,如 .png、.mp4 等) - File tempFile = File("$tempPath/$fileName.${getExtension(uint8List)}"); // 自动识别后缀(可选) - - // 3. 将 Uint8List 写入文件 - await tempFile.writeAsBytes(uint8List); - print("临时文件路径:${tempFile.path}"); - String string = await UploadOss.upload( - tempFile.path, - fileType: getExtension(uint8List), - oSSAccessKeyId: widget.oSSAccessKeyId ?? '', - ossHost: widget.ossHost ?? '', - ossDirectory: widget.ossDirectory ?? '', - policy: widget.policy ?? '', - callback: widget.callback ?? '', - signature: widget.signature ?? '', - ); - return tempFile; - } catch (e) { - print("转换临时文件失败:$e"); - return null; - } - } + uint8ListToTempFile(imageFile??Uint8List(0)); }, child: Icon(Icons.edit, color: Colors.white))), //图片张数指示器 From f2ab06e4bb01fa36e8778e6fd351dfc6880354b7 Mon Sep 17 00:00:00 2001 From: wuxinglong Date: Fri, 14 Nov 2025 13:55:55 +0800 Subject: [PATCH 4/8] no message --- lib/upload_image/look_images_widget.dart | 27 +++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/upload_image/look_images_widget.dart b/lib/upload_image/look_images_widget.dart index 641dd65..0a9c4bb 100644 --- a/lib/upload_image/look_images_widget.dart +++ b/lib/upload_image/look_images_widget.dart @@ -13,7 +13,9 @@ class LookImagesTool { static lookImages({ required List listData, int? currentPage, + void Function(String)? onCallBack, String? oSSAccessKeyId, + Function? callBack, String? policy, String? callback, String? signature, @@ -46,6 +48,7 @@ class LookImagesWidget extends StatefulWidget { final String? signature; final String? ossDirectory; final String? ossHost; + final void Function(String)? onCallBack; const LookImagesWidget({ super.key, @@ -57,6 +60,7 @@ class LookImagesWidget extends StatefulWidget { this.signature, this.ossDirectory, this.ossHost, + this.onCallBack, }); @override @@ -129,16 +133,12 @@ class _LookImagesWidgetState extends State { return null; } - /// 可选:根据字节头自动识别文件后缀(如图片、视频) String getExtension(Uint8List uint8List) { if (uint8List.length < 4) return "bin"; // 无法识别时返回二进制后缀 // PNG 头:89 50 4E 47 - if (uint8List[0] == 0x89 && - uint8List[1] == 0x50 && - uint8List[2] == 0x4E && - uint8List[3] == 0x47) { + if (uint8List[0] == 0x89 && uint8List[1] == 0x50 && uint8List[2] == 0x4E && uint8List[3] == 0x47) { return "png"; } // JPG 头:FF D8 FF @@ -163,11 +163,12 @@ class _LookImagesWidgetState extends State { } } - /// Uint8List 转临时 File - Future uint8ListToTempFile(Uint8List uint8List, {String fileName = "temp_file"}) async { + /// Uint8List 转临时 File 并且上传到oss并返回访问路径 + Future uint8ListToTempFile(Uint8List uint8List, {String fileName = "temp_file"}) async { try { // 1. 获取临时存储目录(跨平台兼容) Directory tempDir = await getTemporaryDirectory(); + String tempPath = tempDir.path; // 2. 拼接文件路径(可自定义后缀,如 .png、.mp4 等) @@ -175,7 +176,9 @@ class _LookImagesWidgetState extends State { // 3. 将 Uint8List 写入文件 await tempFile.writeAsBytes(uint8List); - print("临时文件路径:${tempFile.path}"); + + // print("临时文件路径:${tempFile.path}"); + String imageUrl = await UploadOss.upload( tempFile.path, fileType: getExtension(uint8List), @@ -186,8 +189,8 @@ class _LookImagesWidgetState extends State { callback: widget.callback ?? '', signature: widget.signature ?? '', ); - print("上传后的路径:$imageUrl"); - return tempFile; + // print("上传后的访问路径:$imageUrl"); + return imageUrl; } catch (e) { print("转换临时文件失败:$e"); return null; @@ -201,7 +204,6 @@ class _LookImagesWidgetState extends State { initialPage = 0; currentPage = 0; } else { - // initialPage = 0; currentPage = widget.currentPage ?? 0; } super.initState(); @@ -238,7 +240,8 @@ class _LookImagesWidgetState extends State { child: GestureDetector( onTap: () async { Uint8List? imageFile = await editImage(url: listData[currentPage]); - uint8ListToTempFile(imageFile??Uint8List(0)); + String? url = await uint8ListToTempFile(imageFile ?? Uint8List(0)); + widget.onCallBack!(url??''); }, child: Icon(Icons.edit, color: Colors.white))), //图片张数指示器 From b086c5c5c9711ccae04bd02dff6284a412486ef8 Mon Sep 17 00:00:00 2001 From: wuxinglong Date: Fri, 14 Nov 2025 14:12:47 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fix=EF=BC=9A=E5=A2=9E=E5=8A=A0=E9=9D=9E?= =?UTF-8?q?=E7=A9=BA=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/upload_image/look_images_widget.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/upload_image/look_images_widget.dart b/lib/upload_image/look_images_widget.dart index 0a9c4bb..2f2f56a 100644 --- a/lib/upload_image/look_images_widget.dart +++ b/lib/upload_image/look_images_widget.dart @@ -29,6 +29,7 @@ class LookImagesTool { return LookImagesWidget( listData: listData, currentPage: currentPage, + onCallBack: onCallBack, oSSAccessKeyId: oSSAccessKeyId, policy: policy, callback: callback, @@ -241,7 +242,9 @@ class _LookImagesWidgetState extends State { onTap: () async { Uint8List? imageFile = await editImage(url: listData[currentPage]); String? url = await uint8ListToTempFile(imageFile ?? Uint8List(0)); - widget.onCallBack!(url??''); + if(widget.onCallBack != null){ + widget.onCallBack!(url??''); + } }, child: Icon(Icons.edit, color: Colors.white))), //图片张数指示器 From 4ab9a5ad1836f66c112d21301056b306d94c9f7c Mon Sep 17 00:00:00 2001 From: wuxinglong Date: Mon, 17 Nov 2025 15:54:21 +0800 Subject: [PATCH 6/8] =?UTF-8?q?feat:=E6=9A=B4=E9=9C=B2=E5=87=BA=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=9B=BE=E7=89=87=E5=8A=9F=E8=83=BD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/upload_image/look_images_widget.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/upload_image/look_images_widget.dart b/lib/upload_image/look_images_widget.dart index 2f2f56a..5f8463c 100644 --- a/lib/upload_image/look_images_widget.dart +++ b/lib/upload_image/look_images_widget.dart @@ -16,6 +16,7 @@ class LookImagesTool { void Function(String)? onCallBack, String? oSSAccessKeyId, Function? callBack, + bool? isShowEdit, String? policy, String? callback, String? signature, @@ -50,6 +51,7 @@ class LookImagesWidget extends StatefulWidget { final String? ossDirectory; final String? ossHost; final void Function(String)? onCallBack; + final bool? isShowEdit; const LookImagesWidget({ super.key, @@ -62,6 +64,7 @@ class LookImagesWidget extends StatefulWidget { this.ossDirectory, this.ossHost, this.onCallBack, + this.isShowEdit, }); @override @@ -246,7 +249,9 @@ class _LookImagesWidgetState extends State { widget.onCallBack!(url??''); } }, - child: Icon(Icons.edit, color: Colors.white))), + child: Visibility( + visible: widget.isShowEdit??false, + child: Icon(Icons.edit, color: Colors.white)))), //图片张数指示器 Positioned( left: 0, From aaae40ae02be33113550f02a237dda1b18607fd3 Mon Sep 17 00:00:00 2001 From: wuxinglong Date: Mon, 17 Nov 2025 16:01:13 +0800 Subject: [PATCH 7/8] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=BC=96=E8=BE=91=E6=98=BE=E7=A4=BA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/upload_image/look_images_widget.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/upload_image/look_images_widget.dart b/lib/upload_image/look_images_widget.dart index 5f8463c..f8443e4 100644 --- a/lib/upload_image/look_images_widget.dart +++ b/lib/upload_image/look_images_widget.dart @@ -34,6 +34,7 @@ class LookImagesTool { oSSAccessKeyId: oSSAccessKeyId, policy: policy, callback: callback, + isShowEdit: isShowEdit, signature: signature, ossDirectory: ossDirectory, ossHost: ossHost); From 11d2bd02ff9fb7a8111e252be98f9249b6ad3d4e Mon Sep 17 00:00:00 2001 From: wuxinglong Date: Mon, 17 Nov 2025 17:47:26 +0800 Subject: [PATCH 8/8] no message --- lib/upload_image/look_images_widget.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/upload_image/look_images_widget.dart b/lib/upload_image/look_images_widget.dart index f8443e4..47c1f2c 100644 --- a/lib/upload_image/look_images_widget.dart +++ b/lib/upload_image/look_images_widget.dart @@ -170,6 +170,7 @@ class _LookImagesWidgetState extends State { /// Uint8List 转临时 File 并且上传到oss并返回访问路径 Future uint8ListToTempFile(Uint8List uint8List, {String fileName = "temp_file"}) async { + if (uint8List.isEmpty) return null; try { // 1. 获取临时存储目录(跨平台兼容) Directory tempDir = await getTemporaryDirectory();