Skip to content

A fork of the official image_picker flutter plugin that adds the functionality to pick multiple images.

License

Notifications You must be signed in to change notification settings

ja2375/multi_media_picker

Repository files navigation

multi_media_picker

A fork of the official image_picker plugin that adds the functionality to pick multiple images.

NOTE: On iOS only one image can be picked as of now. Android is fully supported.

Installation

In your pubspec.yaml file within your Flutter Project:

dependencies:
  multi_media_picker: <lastest version>

iOS

NOT FULLY SUPPORTED YET

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.
  • NSCameraUsageDescription - describe why your app needs access to the camera. This is called Privacy - Camera Usage Description in the visual editor.
  • NSMicrophoneUsageDescription - describe why your app needs access to the microphone, if you intend to record videos. This is called Privacy - Microphone Usage Description in the visual editor.

Android

No configuration required - the plugin should work out of the box.

Example

import 'package:multi_media_picker/multi_media_picker.dart';

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  List<File> _images;

  Future getImage() async {
    var images = await MultiMediaPicker.pickImages(sources: ImageSource.camera);

    setState(() {
      _images = images;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Image Picker Example'),
      ),
      body: Center(
        child: _images == null
            ? Text('No image selected.')
            : Image.file(_images[0]),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: getImage,
        tooltip: 'Pick Image',
        child: Icon(Icons.add_a_photo),
      ),
    );
  }
}

About

A fork of the official image_picker flutter plugin that adds the functionality to pick multiple images.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published