暫無描述
CaiJingLong 7a844b2091
Merge branch 'master' into fix-number
6 年之前
.vscode update duration badge and example 6 年之前
example update duration badge and example 6 年之前
lib format code 6 年之前
test remove test ref 6 年之前
.gitignore 未被纳入管理的文件 6 年之前
CHANGELOG.md update photo_manager version 6 年之前
LICENSE Update LICENSE 6 年之前
README.md Merge branch 'master' into fix-number 6 年之前
pubspec.lock update photo_manager version 6 年之前
pubspec.yaml update photo_manager version 6 年之前

README.md

photo

pub package GitHub GitHub stars

image picker, multi picker

support ios icloud

support video

use flutter as ui

if you want to build custom ui, you just need api to make custom ui. to use photo_manager or fork the library to custom ui.

screenshot

image

API incompatibility

API incompatibility

because support video, so the ImagePathEntity and ImageEntity rename to AssetPathEntity and AssetEntity.

so PhotoPicker.pickImage return type will change to List<AssetEntity>

install

dependencies:
  photo: ^0.1.8

import

import 'package:photo/photo.dart';
import 'package:photo_manager/photo_manager.dart';

use

void _pickImage() async {
    List<AssetEntity> imgList = await PhotoPicker.pickAsset(
      context: context,
      // BuildContext requied

      /// The following are optional parameters.
      themeColor: Colors.green,
      // the title color and bottom color
      padding: 1.0,
      // item padding
      dividerColor: Colors.grey,
      // divider color
      disableColor: Colors.grey.shade300,
      // the check box disable color
      itemRadio: 0.88,
      // the content item radio
      maxSelected: 8,
      // max picker image count
      provider: I18nProvider.chinese,
      // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider()
      rowCount: 5,
      // item row count
      textColor: Colors.white,
      // text color
      thumbSize: 150,
      // preview thumb size , default is 64
      sortDelegate: SortDelegate.common,
      // default is common ,or you make custom delegate to sort your gallery
      checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate(
        activeColor: Colors.white,
        unselectedColor: Colors.white,
      ), // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox

      loadingDelegate:
          this, // if you want to build custom loading widget,extends LoadingDelegate [see example/lib/main.dart]
    );

whole example

you can see github main.dart

about android

glide

Android native use glide to create image thumb bytes, version is 4.8.0.

If your other android library use the library, and version is not same, then you need edit your android project’s build.gradle.

rootProject.allprojects {

    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.github.bumptech.glide'
                        && details.requested.name.contains('glide')) {
                    details.useVersion "4.8.0"
                }
            }
        }
    }

}

if you use the proguard

see the github

about ios

Because the album is a privacy privilege, you need user permission to access it. You must to modify the Info.plist file in Runner project.

like next

<key>NSPhotoLibraryUsageDescription</key>
<string>App need your agree, can visit your album</string>

xcode like image in xcode

build error

if you build error like include of non-modular header inside framework module, see #10 or so

thanks

Part of the Android code comes from debuggerx01.

donate

If my code helps you, and you’re willing to buy me a cup of coffee.

you can use paypal

or scan my alipay