Skip to content

Commit

Permalink
DEV UPDATE:Maybe fixed ios gif save
Browse files Browse the repository at this point in the history
  • Loading branch information
misakajimmy committed Feb 22, 2023
1 parent 6e5fea7 commit 8ddc696
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/routes/picture/pictureDetail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:photo_manager/photo_manager.dart';

class PictureDetail extends StatefulWidget {
const PictureDetail({
Expand Down Expand Up @@ -38,8 +39,11 @@ class _PictureDetailState extends State<PictureDetail> {
var appDocDir = await getTemporaryDirectory();
String savePath = appDocDir.path + "/tmp.gif";
await Dio().download(url, savePath);
final result = await ImageGallerySaver.saveFile(savePath);
print(result);
final result = await PhotoManager.requestPermissionExtend();
if (result.isAuth) {
final asset = await PhotoManager.editor
.saveImageWithPath(savePath, title: url.split("/").last);
}
} else {
var response = await Dio()
.get(url, options: Options(responseType: ResponseType.bytes));
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation

import package_info_plus
import path_provider_foundation
import photo_manager
import sentry_flutter
import shared_preferences_foundation
import sqflite
Expand All @@ -15,6 +16,7 @@ import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
PhotoManagerPlugin.register(with: registry.registrar(forPlugin: "PhotoManagerPlugin"))
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.1.0"
photo_manager:
dependency: "direct main"
description:
name: photo_manager
sha256: "55d50ad1b8f984c57fa7c4bd4980f4760e80d3d9355263cf72624a6ff1bf2b5b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.2"
platform:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dependencies:
modal_bottom_sheet: ^2.1.2
path_provider: ^2.0.12
sentry_flutter: ^6.20.1
photo_manager: ^2.5.2

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 8ddc696

Please sign in to comment.