From a7dcfb660bc1159c30b75e626da320e5fa74d7ab Mon Sep 17 00:00:00 2001 From: bluesea <307723040@qq.com> Date: Tue, 14 May 2024 17:40:02 +0800 Subject: [PATCH] s --- wallpaper/ios/Podfile.lock | 12 ++++++++++++ .../imgcategorypage/imgcategorypage_controller.dart | 4 ++++ .../pages/imgcategorypage/imgcategorypage_view.dart | 1 + wallpaper/lib/utils/downloadmanager.dart | 2 +- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/wallpaper/ios/Podfile.lock b/wallpaper/ios/Podfile.lock index 8e1ff16..ce7cca5 100644 --- a/wallpaper/ios/Podfile.lock +++ b/wallpaper/ios/Podfile.lock @@ -2,27 +2,39 @@ PODS: - Flutter (1.0.0) - flutter_keyboard_visibility (0.0.1): - Flutter + - image_gallery_saver (1.5.0): + - Flutter - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS + - permission_handler_apple (9.1.1): + - Flutter DEPENDENCIES: - Flutter (from `Flutter`) - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) + - image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) EXTERNAL SOURCES: Flutter: :path: Flutter flutter_keyboard_visibility: :path: ".symlinks/plugins/flutter_keyboard_visibility/ios" + image_gallery_saver: + :path: ".symlinks/plugins/image_gallery_saver/ios" path_provider_foundation: :path: ".symlinks/plugins/path_provider_foundation/darwin" + permission_handler_apple: + :path: ".symlinks/plugins/permission_handler_apple/ios" SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 + image_gallery_saver: 259eab68fb271cfd57d599904f7acdc7832e7ef2 path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6 PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 diff --git a/wallpaper/lib/pages/imgcategorypage/imgcategorypage_controller.dart b/wallpaper/lib/pages/imgcategorypage/imgcategorypage_controller.dart index 1c4c075..686ebc5 100644 --- a/wallpaper/lib/pages/imgcategorypage/imgcategorypage_controller.dart +++ b/wallpaper/lib/pages/imgcategorypage/imgcategorypage_controller.dart @@ -24,4 +24,8 @@ class ImgCategoryPageController extends GetxController { void goScanView(var index,var dataModel){ Get.toNamed(AppRoutes.imgscanpage, arguments: {"index":index,"dataModel":dataModel}); } + + Future < void> saveImgToAlbum(String imgUrl) async { + await DownloadManager.saveNetworkImage(imgUrl); + } } \ No newline at end of file diff --git a/wallpaper/lib/pages/imgcategorypage/imgcategorypage_view.dart b/wallpaper/lib/pages/imgcategorypage/imgcategorypage_view.dart index a85f7e1..5209d2e 100644 --- a/wallpaper/lib/pages/imgcategorypage/imgcategorypage_view.dart +++ b/wallpaper/lib/pages/imgcategorypage/imgcategorypage_view.dart @@ -92,6 +92,7 @@ class ImgCategoryPageView extends GetView { IconButton(onPressed:() { print("设置壁纸"); + controller.saveImgToAlbum(imgUrl); }, icon: Icon(Icons.wallpaper),color: Colors.white,), ], diff --git a/wallpaper/lib/utils/downloadmanager.dart b/wallpaper/lib/utils/downloadmanager.dart index 4ae5805..3916719 100644 --- a/wallpaper/lib/utils/downloadmanager.dart +++ b/wallpaper/lib/utils/downloadmanager.dart @@ -40,7 +40,7 @@ class DownloadManager { // } //从网络保存至相册 - static void saveNetworkImage(String urlStr) async { + static Future saveNetworkImage(String urlStr) async { var httpClient = HttpClient(); var reqiest = await httpClient.getUrl(Uri.parse(urlStr)); var response = await reqiest.close();