photo_picker 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 30

ImagePickerController #

Feature #

ItemiOSAndroid
photo picker✔️
camera✔️
multi-select✔️
multi-select limit✔️
thumbnail(300*300)✔️
compression✔️

Usage #

1. Import packages
import 'package:path_provider/path_provider.dart';
import 'package:photo_picker/photo_picker.dart';
2. Get cache path
// in state
Directory _tempDirectory;
// in async init function
_tempDirectory = await getTemporaryDirectory();
3. Call
// on pressed
PhotoPicker.camera({"edit": false}).then((onValue) {
    setState(() {
        _photos.addAll(onValue);
    });
});

PhotoPicker.pickPhoto({"limit": 8, 
                       "cameraRollFirst": true, 
                       "mode": "fit"}).then((onValue) {
                setState(() {
                  _photos.addAll(onValue);
                });
});

0.0.1 #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:photo_picker/photo_picker.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List _photos = [];
  Directory _tempDirectory;

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    List photos = [];
    _tempDirectory = await getTemporaryDirectory();
    if (!mounted) return;

    setState(() {
      _photos = photos;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      appBar: AppBar(
        title: const Text('Plugin example app'),
      ),
      body: GridView.count(
          crossAxisCount: 4,
          children: _photos.map((m) {
            return Padding(
              child: Image.file(File(_tempDirectory.path + '/' + m['t']),
                  fit: BoxFit.cover, width: 40, height: 40),
              padding: EdgeInsets.all(10),
            );
          }).toList()),
      floatingActionButton:
          Column(mainAxisAlignment: MainAxisAlignment.end, children: [
        Padding(
          padding: const EdgeInsets.only(top: 16.0),
          child: FloatingActionButton(
            onPressed: () {
              PhotoPicker.camera({"edit": false}).then((onValue) {
                setState(() {
                  _photos.addAll(onValue);
                });
              });
            },
            tooltip: '拍照',
            child: Icon(Icons.photo_camera),
          ),
        ),
        Padding(
          padding: const EdgeInsets.only(top: 16.0),
          child: FloatingActionButton(
            onPressed: () {
              PhotoPicker.pickPhoto({
                "limit": 8,
                "cameraRollFirst": true,
                "mode": "fit",
              }).then((onValue) {
                setState(() {
                  _photos.addAll(onValue);
                });
              });
            },
            tooltip: '相册',
            child: Icon(Icons.photo_album),
          ),
        ),
      ]),
    ));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  photo_picker: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:photo_picker/photo_picker.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
30
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:photo_picker/photo_picker.dart]

Package does not support Flutter platform macos

Because of import path [package:photo_picker/photo_picker.dart]

Package does not support Flutter platform web

Because of import path [package:photo_picker/photo_picker.dart]

Package does not support Flutter platform windows

Because of import path [package:photo_picker/photo_picker.dart]

Package not compatible with SDK dart

because of import path [photo_picker]

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/ForkPanda/ImagePickerController was unreachable.

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (path_provider).

Package is getting outdated. (-60.82 points)

The package was last published 83 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
path_provider ^0.4.1 0.4.1 1.6.11
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8