photo 0.1.2

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

photo

pub package Hex.pm

image picker, multi picker use flutter as ui

if you want to build custom ui, you just need api to make custom ui. to use photo_manager

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.2

import

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

use

void _pickImage() async {
    List<AssetEntity> imgList = await PhotoPicker.pickImage(
      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 use glide to create image thumb, version is 4.8.0

if you 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

CHANGELOG

[0.1.2] fix bug

fix all path hasVideo property bug

[0.1.1] fix bug and add params

add loadingDelegate

[0.1.0] support video

API incompatibility

ImageXXX rename AssetXXX

[0.0.8] fix bug

DefaultCheckBoxBuilderDelegate params checkColor not valid bug

[0.0.7] fix bug

fix dividerColor not valid bug

[0.0.6] add checkbox delegate

users can use CheckBoxDelegate to custom preview right bottom widget

[0.0.5] add a params

add the sort delegate to help user sort gallery

Optimized LruCache

add a loading refresh indicator in the gallery

[0.0.4] fix #1

fix request other permission will crash bug

depo photo_manager 0.0.3

[0.0.3] add the thumb size to option

add a params for pick image , thumb size

[0.0.2] fix bug

preview sure button bug preview bottom safeArea

[0.0.1] first version

image picker

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:photo/photo.dart';
import 'package:photo_manager/photo_manager.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Pick Image Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'Pick Image Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with LoadingDelegate {
  String currentSelected = "";

  void _pickImage() async {
    List<AssetEntity> imgList = await PhotoPicker.pickImage(
      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]
    );

    if (imgList == null) {
      currentSelected = "not select item";
    } else {
      List<String> r = [];
      for (var e in imgList) {
        var file = await e.file;
        r.add(file.absolute.path);
      }
      currentSelected = r.join("\n\n");
    }
    setState(() {});
  }

  @override
  Widget buildBigImageLoading(
      BuildContext context, AssetEntity entity, Color themeColor) {
    return Center(
      child: Container(
        width: 50.0,
        height: 50.0,
        child: CupertinoActivityIndicator(
          radius: 25.0,
        ),
      ),
    );
  }

  @override
  Widget buildPreviewLoading(
      BuildContext context, AssetEntity entity, Color themeColor) {
    return Center(
      child: Container(
        width: 50.0,
        height: 50.0,
        child: CupertinoActivityIndicator(
          radius: 25.0,
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: Container(
        child: Center(
          child: Text(
            '$currentSelected',
            textAlign: TextAlign.center,
          ),
        ),
      ),
      floatingActionButton: new FloatingActionButton(
        onPressed: _pickImage,
        tooltip: 'pickImage',
        child: new Icon(Icons.add),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  photo: ^0.1.2

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:photo/photo.dart';
  
Version Uploaded Documentation Archive
0.1.2 Oct 17, 2018 Go to the documentation of photo 0.1.2 Download photo 0.1.2 archive
0.1.1 Oct 12, 2018 Go to the documentation of photo 0.1.1 Download photo 0.1.1 archive
0.1.0 Oct 11, 2018 Go to the documentation of photo 0.1.0 Download photo 0.1.0 archive
0.0.8 Oct 11, 2018 Go to the documentation of photo 0.0.8 Download photo 0.0.8 archive
0.0.7 Oct 11, 2018 Go to the documentation of photo 0.0.7 Download photo 0.0.7 archive
0.0.6 Oct 10, 2018 Go to the documentation of photo 0.0.6 Download photo 0.0.6 archive
0.0.5 Oct 9, 2018 Go to the documentation of photo 0.0.5 Download photo 0.0.5 archive
0.0.4 Oct 9, 2018 Go to the documentation of photo 0.0.4 Download photo 0.0.4 archive
0.0.3 Oct 8, 2018 Go to the documentation of photo 0.0.3 Download photo 0.0.3 archive
0.0.2 Oct 2, 2018 Go to the documentation of photo 0.0.2 Download photo 0.0.2 archive

All 11 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
35
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]
68
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4
  • Flutter: 0.9.5

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

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