multi_image_picker 2.3.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 95

multi_image_picker

build pub package <a href="https://stackoverflow.com/questions/tagged/flutter?sort=votes"> <img alt="Awesome Flutter" src="https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square" /> </a>

Screenshot iOS 1

Usage

First you need to add the plugin to your project.

iOS

You need to add those strings to your Info.plist file in order the plugin to work:

<key>NSPhotoLibraryUsageDescription</key>
<string>Example usage description</string>
<key>NSCameraUsageDescription</key>
<string>Example usage description</string>

Important The plugin is written in Swift, so your project needs to have Swift support enabled. If you've created the project using flutter create -i swift [projectName] you are all set. If not, you can enable Swift support by opening the project with XCode, then choose File -> New -> File -> Swift File. XCode will ask you if you wish to create Bridging Header, click yes.

The plugin supports Swift Version 4.2. Make sure you have this version set in your Build Settings -> SWIFT_VERSION

Android

You need to request those permissions in AndroidManifest.xml in order the plugin to work:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

For example code usage, please see here

If you wish you can enable the camera in the gallery, so the user can not only chosse photos, but take them as well with the camera.

Enable camera on Android

To do so you need to, create this file in android/app/src/main/res/xml/file_paths_public.xml:

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path
        name="multiimagepicker_files"
        path="Pictures"/>
</paths>

And then add file provider in your android/app/src/main/AndroidManifest.xml, before the </application> closing tag:

  <provider
    android:name="com.vitanov.multiimagepicker.MultiImagePickerFileProvider"
    android:authorities="YOUR_PACKAGE_NAME_HERE.multiimagepicker.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">
      <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/file_paths_public"></meta-data>
  </provider>

Enable camera on iOS

No additional steps needed

That's it. When you invoke the image picker you can then have to set enableCamera to true, as it is disabled by default:

  resultList = await MultiImagePicker.pickImages(
    maxImages: 300,
    enableCamera: true,
  );

Theming and localization

You can customize different parts of the gallery picker. For reference see below the available options for the different platforms:

Customization on Android

Customization on iOS

API

MultiImagePicker

Asset

FAQ

How I can access the images the user has picked?

When you invoke the image picker and the user picks some images, as response you will get List of Asset objects. The Asset class have two handy methods which allows you to access the picked image data - requestThumbnail(width, height), which returns a resized image and requestOriginal() which returns the original hight quality image. Those methods are asynchronious and return the image data as ByteData, so you must be careful when to allocate and release this data if you don't need it in different views. For example implementation see the example folder.

Why the plugin don't return image paths directly?

That's not an easy task when we speak for cross platform compability. For example on Android the ContentResolver returns content URI's, which not always have a file path. On iOS it get's even more complicated - since there is iCloud and not all of your photos are stored physically on the phone, there is no way to return the file path imediately without first downloading the original image from iCloud to the phone.

You can see how one of the core Flutter plugins - the single image_picker, approaches and solves this problem in order to return file paths: it just copies the selected image content to the tmp folder and retuns the file path from there. Now that works ok when you pick a single image.

But since with the multi_image_picker you can pick literally thousands of images on one go, this is not possible task.

Another issue on iOS is that starting form iOS 11 all images taken by the camera as stoed in HEIC format. Unfortunately Flutter still don't have codecs to display HEIC images out of the box in image widget.

The aim of this plugin is to be fast and efficient, currently you can pick thousands of images in matter of miliseconds, and still have access to the selected images data whenever you need them. The plugin takes care of both Android and iOS platform specific cases and issues, and will reliebly return the scaled thumb when you invoke requestThumbnail or the original image data when you invoke requestOriginal. You are then free to use this data as you like - display it in image widget or submit the data to a remote API.

Powered by

License

MIT © Radoslav Vitanov

Change Log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Changed (v2.3.01)

2018-12-18

  • Added takePhotoIcon option to ios customization settings

Changed (v2.3.00)

2018-12-13

BREAKING CHANGE

  • Android - renamed authorities to android:authorities="YOUR_PACKAGE_NAME_HERE.multiimagepicker.fileprovider". Please update your manifest file to avoid errors.

Changed (v2.2.61)

2018-12-13

  • Added custom file provider to avoid collisions with other plugins. See README for example implementation

Changed (v2.2.55)

2018-11-19

Fixed

Changed (v2.2.54)

2018-11-19

Fixed

Changed (v2.2.53)

2018-11-08

Fixed

  • Added new optional parameter quality to requestThumb and requestOriginal methods.

Changed (v2.2.52)

2018-11-07

Fixed

  • Don't rescale the image when decoding it on Android

Changed (v2.2.50)

2018-11-07

Fixed

  • Correctly handle image orientation on Android phones ref

Changed (v2.2.47)

2018-11-06

Changed

  • Increase thumb quality on Android

Changed (v2.2.45)

2018-11-06

Fixed

  • Ask for CAMERA permission on Android, and fix opening of the picker after permission grant.

Changed (v2.2.44)

2018-11-06

Fixed

  • Use correct application id on Android devices when setting up the camera provider

Changed (v2.2.43)

2018-11-02

Fixed

  • requestOriginal now works correctly on Android

Changed (v2.2.42)

2018-11-02

Fixed

  • Use app specific content provider, updated README.md

Changed (v2.2.41)

2018-11-02

Changed

  • Commented out example file provider as it gets included in production bundle. If you want to test the example just uncomment it in the android manifest.

Changed (v2.2.40)

2018-11-02

Added

  • Added new picker option enableCamera which allows the user to take pictures directly from the gallery. For more info how to enable this please see README.md

Changed (v2.2.30)

2018-10-28

Fixed

  • iOS 12 and Swift 4.2 language fixes
  • Important: In your XCode build setting you must set Swift Version to 4.2

Changed (v2.2.10)

2018-09-19

Changed

  • Update Image picker library to support Swift 4.2 and XCode 10
  • Remove obsolette file path in the asset class

Changed (v2.1.26)

2018-09-10

Fixed

  • Fixed path not passed to the Asset class #7

Changed (v2.1.25)

2018-09-07

Added

  • Add Real file path and allow to refresh image gallery #6 (thanks CircleCurve)

Changed (v2.1.23)

2018-08-31

Added

  • Improved the docs

Changed (v2.1.22)

2018-08-28

Added

  • Add originalWidth, originalHeight, isPortrait and isLandscape getters for the Asset class

Changed (v2.1.21)

2018-08-24

Added

  • Add release(), releaseOriginal() and releaseThumb() methods to help clean up the image data when it is no longer needed

Changed (v2.1.02)

2018-08-20

Fix

  • Fix null pointer exception on Android when finishing from another activity (thanks to xia-weiyang)

Changed (v2.1.01)

2018-08-16

Change

  • Add getters to Asset class

Changed (v2.1.00)

2018-08-16

BREAKING CHANGE

  • Asset's requestThumbnail and requestOriginal methods now will return Future<ByteData>. Removed the method callbacks.

Changed (v2.0.04)

2018-08-16

Fixed

  • Correctly crop the thumb on iOS

Changed (v2.0.03)

2018-08-16

Added

  • Allow network access to download images present only in iCloud

Changed (v2.0.02)

2018-08-16

Fixed

  • Improve thumbs quality on iOS to always deliver best of it

Changed (v2.0.01)

2018-08-16

Fixed

  • Fix picking original image on Android was not triggering properly the callback

Changed (v2.0.0)

2018-08-15

BREAKING CHANGE

  • The plugin have been redesigned to be more responsive and flexible.
  • pickImages method will no longer return List<File>, instead it will return List<Asset>
  • You can then request asset thumbnails or the original image, which will load asyncrhoniously without blocking the main UI thred. For more info see the examples directory.

Added

  • Asset class, with methods requestThumbnail(int width, int height, callback) and requestOriginal(callback)

Changed (v1.0.53)

2018-08-13

Fixed

  • Fix crash on iOS when picking a lot of images.

Changed (v1.0.52)

2018-08-12

Fixed

  • Picking images on iOS now will properly handle PHAssets

Changed (v1.0.51)

2018-08-07

Changed

  • Fix a crash on Android caused by closing and reopening the gallery

Changed (v1.0.5)

2018-08-07

Add

  • Support iOS and Android customizations

Changed (v1.0.4)

2018-08-06

Changed

  • iOS: Add missing super.init() call in the class constructor

Changed (v1.0.3)

2018-08-05

Changed

  • Changed sdk: ">=2.0.0-dev.28.0 <3.0.0"

Changed (v1.0.2)

2018-08-05

Added

  • Add Support for Dart 2 in pubspec.yaml file

Changed (v1.0.1)

2018-08-05

Added

  • Initial release with basic support for iOS and Android

example/README.md

multi_image_picker_example

Demonstrates how to use the multi_image_picker plugin.

Getting Started

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  multi_image_picker: ^2.3.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:multi_image_picker/multi_image_picker.dart';
  
Version Uploaded Documentation Archive
2.3.1 Dec 18, 2018 Go to the documentation of multi_image_picker 2.3.1 Download multi_image_picker 2.3.1 archive
2.3.0 Dec 13, 2018 Go to the documentation of multi_image_picker 2.3.0 Download multi_image_picker 2.3.0 archive
2.2.61 Dec 13, 2018 Go to the documentation of multi_image_picker 2.2.61 Download multi_image_picker 2.2.61 archive
2.2.55 Nov 19, 2018 Go to the documentation of multi_image_picker 2.2.55 Download multi_image_picker 2.2.55 archive
2.2.54 Nov 19, 2018 Go to the documentation of multi_image_picker 2.2.54 Download multi_image_picker 2.2.54 archive
2.2.53 Nov 8, 2018 Go to the documentation of multi_image_picker 2.2.53 Download multi_image_picker 2.2.53 archive
2.2.52 Nov 7, 2018 Go to the documentation of multi_image_picker 2.2.52 Download multi_image_picker 2.2.52 archive
2.2.51 Nov 7, 2018 Go to the documentation of multi_image_picker 2.2.51 Download multi_image_picker 2.2.51 archive
2.2.50 Nov 7, 2018 Go to the documentation of multi_image_picker 2.2.50 Download multi_image_picker 2.2.50 archive
2.2.47 Nov 6, 2018 Go to the documentation of multi_image_picker 2.2.47 Download multi_image_picker 2.2.47 archive

All 41 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
90
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
95
Learn more about scoring.

We analyzed this package on Dec 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
meta ^1.1.5 1.1.6
Transitive dependencies
collection 1.14.11
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test