gal 1.3.4 copy "gal: ^1.3.4" to clipboard
gal: ^1.3.4 copied to clipboard

Gal is a Flutter plugin for handle native gallary apps. Easily open or save media files to native gallery apps.

Gal🖼️ #

pub points CI License pub package

Hi👋 Gal is very easy to use Flutter Plugin for handle native gallery apps, iOS ios photo and Android amdroid photo.

If you love this pub, Please leave a like👍 and star⭐️.

example

Features #

  • Open gallery
  • Save video
  • Save image
  • Handle pemission
  • Handle errors

Get started #

Add dependency #

You can use the command to add gal as a dependency with the latest stable version:

$ flutter pub add gal

iOS #

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

Android (API <29) #

Add the following key to your AndroidManifest file, located in <project root>/android/app/src/main/AndroidManifest.xml:

Usage #

Save from local #

//Save Image
await Gal.putImage('$filePath');

//Save Video
await Gal.putVideo('$filePath');

Dawnload from Internet #

$ flutter pub add dio
//Dawnload Image
final imagePath = '${Directory.systemTemp.path}/image.jpg';
await Dio().download('$url',imagePath);
await Gal.putImage(imagePath);

//Dawnload Video
final videoPath = '${Directory.systemTemp.path}/video.mp4';
await Dio().download('$url',videoPath);
await Gal.putVideo(videoPath);

Handle Permission #

//Check permission
await Gal.hasAccess();

//Request access
await Gal.requestAccess();

Example #

Here is a minimal example. A best practice and more detailed one and can be found in the example folder.

import 'package:flutter/material.dart';
import 'package:gal/gal.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              FilledButton.icon(
                onPressed: () async => Gal.open(),
                label: const Text('Open Gallery'),
                icon: const Icon(Icons.open_in_new),
              ),
              FilledButton.icon(
                onPressed: () async => Gal.putVideo('TODO: Change this text to video path'),
                label: const Text('Save Video'),
                icon: const Icon(Icons.video_file),
              ),
              FilledButton.icon(
                onPressed: () async => Gal.putImage('TODO: Change this text to image path'),
                label: const Text('Save Image'),
                icon: const Icon(Icons.image),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Best Practice #

Please see this page in project wiki.

Contributing #

Welcome💚 Feel free to create issue or PR. Basically, please follows Effective Dart.

293
likes
0
pub points
98%
popularity

Publisher

verified publishermidoridesign.studio

Gal is a Flutter plugin for handle native gallary apps. Easily open or save media files to native gallery apps.

Homepage
Repository (GitHub)
View/report issues

Topics

#gallery #video #image #photos #util

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on gal