분류, 패키지 및 저장소 검색

패키지 상세v2.3.2

gallery_saver

네트워크 또는 임시 파일에서 이미지와 동영상을 외부 저장소에 저장합니다. 이미지와 동영상은 Android 갤러리 및 iOS 사진 모두에서 확인할 수 있습니다.

AndroidiOS
30일 다운로드
3.7천
좋아요
489
Pub 점수
130

패키지 설치

flutter pub add gallery_saver

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Gallery Saver는 네트워크 URL 또는 임시 파일에서 이미지와 동영상을 디바이스의 외부 저장소에 저장할 수 있도록 해주는 Flutter 패키지입니다. 저장된 미디어는 안드로이드에서는 네이티브 갤러리, iOS에서는 사진 앱에서 확인할 수 있습니다. 시스템 레벨의 사진 라이브러리와 호환되며, 로컬에 멀티미디어 콘텐츠를 지속적으로 보관하는 과정을 단순화합니다. 공유하거나 다운로드한 콘텐츠를 사용자가 직접 디바이스의 미디어 컬렉션에 저장할 수 있는 앱에 적합합니다.

사용 사례

  • URL에서 다운로드한 이미지 저장
  • 사용자 생성 미디어 보존
  • 기기 갤러리에 콘텐츠 공유하기
  • 이미지/비디오 뷰어와의 통합
  • 미디어에 오프라인 액세스 활성화
  • 소셜 미디어 공유 지원

주요 기능

  • 이미지와 비디오 모두 저장
  • 안드로이드 및 iOS에서 작동합니다
  • 네이티브 갤러리/사진에서 보입니다
  • 네트워크 및 임시 파일 소스를 지원합니다
  • 미디어 저장을 위한 간단한 API
  • 미디어 메타데이터 유지

적합한 대상

  • 미디어 공유 앱
  • 사진 뷰어 애플리케이션
  • 콘텐츠 다운로더
  • 소셜 미디어 통합
  • 오프라인 미디어 액세스가 필요한 앱
  • 사용자 생성 콘텐츠 플랫폼

고려 사항

  • Android에서 적절한 권한이 필요합니다
  • 런타임 권한 요청이 필요할 수 있습니다
  • 파일 크기 제한은 장치 저장소에 따라 다릅니다
  • iOS는 Info.plist에 적절한 개인정보 보호 설명이 필요합니다
  • 대규모 미디어 처리에 적합하지 않습니다
  • 앨범 정리에 대한 제한된 통제

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Gallery Saver for Flutter

Saves images and videos from network or temporary file to external storage. Both images and videos will be visible in Android Gallery and iOS Photos.

NOTE: If you want to save network image or video link, it has to contain 'http/https' prefix.

Installation

First, add gallery_saver as a dependency in your pubspec.yaml file.

iOS

Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

  • NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.
Android
  • android.permission.WRITE_EXTERNAL_STORAGE - Permission for usage of external storage
Example
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:gallery_saver/gallery_saver.dart';
import 'package:image_picker/image_picker.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String firstButtonText = 'Take photo';
  String secondButtonText = 'Record video';
  double textSize = 20;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      body: Container(
        color: Colors.white,
        child: Column(
          children: <Widget>[
            Flexible(
              flex: 1,
              child: Container(
                child: SizedBox.expand(
                  child: RaisedButton(
                    color: Colors.blue,
                    onPressed: _takePhoto,
                    child: Text(firstButtonText,
                        style:
                            TextStyle(fontSize: textSize, color: Colors.white)),
                  ),
                ),
              ),
            ),
            Flexible(
              child: Container(
                  child: SizedBox.expand(
                child: RaisedButton(
                  color: Colors.white,
                  onPressed: _recordVideo,
                  child: Text(secondButtonText,
                      style: TextStyle(
                          fontSize: textSize, color: Colors.blueGrey)),
                ),
              )),
              flex: 1,
            )
          ],
        ),
      ),
    ));
  }

  void _takePhoto() async {
    ImagePicker.pickImage(source: ImageSource.camera)
        .then((File recordedImage) {
      if (recordedImage != null && recordedImage.path != null) {
        setState(() {
          firstButtonText = 'saving in progress...';
        });
        GallerySaver.saveImage(recordedImage.path).then((String path) {
          setState(() {
            firstButtonText = 'image saved!';
          });
        });
      }
    });
  }

  void _recordVideo() async {
    ImagePicker.pickVideo(source: ImageSource.camera)
        .then((File recordedVideo) {
      if (recordedVideo != null && recordedVideo.path != null) {
        setState(() {
          secondButtonText = 'saving in progress...';
        });
        GallerySaver.saveVideo(recordedVideo.path).then((String path) {
          setState(() {
            secondButtonText = 'video saved!';
          });
        });
      }
    });
  }
  void _saveNetworkVideo() async {
    String path =
        'https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4';
    GallerySaver.saveVideo(path).then((bool success) {
      setState(() {
        print('Video is saved');
      });
    });
  }

  void _saveNetworkImage() async {
    String path =
        'https://image.shutterstock.com/image-photo/montreal-canada-july-11-2019-600w-1450023539.jpg';
    GallerySaver.saveImage(path).then((bool success) {
      setState(() {
        print('Image is saved');
      });
    });
  }
}

카테고리

의존성

의존성 목록 3 개

소스 저장소

이 패키지를 사용하는 프로젝트