picture_picker 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 60

picture_picker #

ios

1、添加相册相关权限:
  • 项目目录->Info.plist->增加
   <key>NSCameraUsageDescription</key>    
    <string>请允许打开相机拍照</string>
    <key>NSLocationWhenInUseUsageDescription</key>
	<string>我们需要通过您的地理位置信息获取您周边的相关数据</string>
	<key>NSPhotoLibraryAddUsageDescription</key>
	<string>请允许访问相册以选取照片</string>
	<key>NSPhotoLibraryUsageDescription</key>
	<string>请允许访问相册以选取照片</string>
	<key>NSFileProviderDomainUsageDescription</key>
	<string>是否允许此App使用你的相机进行拍照?</string>
2、中文适配:
  • 添加中文 Runner -> Info.plist -> Localizations 点击"+"按钮,选择Chinese(Simplified)

[1.0.0] #

发布正式版

[0.0.5] #

修改注释

[0.0.4] #

格式化代码

[0.0.3] #

格式化代码

[0.0.2] #

修改支持平台展示

[0.0.1] #

create plugin

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:picture_picker/picture_picker.dart';

void main() {
  runApp(MaterialApp(home: MyApp()));
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Picture Picker Plugin example app'),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Center(),
          RaisedButton(
              child: Text('打开相册'),
              onPressed: () {
                print('打开相册');
                openSelect();
              }),
          Container(height: 20),
          RaisedButton(
              child: Text('打开相机'),
              onPressed: () {
                print('打开相机');
                openCamera();
              }),
        ],
      ),
    );
  }

  openSelect() async {
    PicturePickerOptions pickerOptions = PicturePickerOptions();
    pickerOptions.selectionMode = 1;
    var list = await PicturePicker.openSelect(pickerOptions);
    print(list);
  }

  openCamera() async {
    PicturePickerOptions pickerOptions = PicturePickerOptions();
    var list = await PicturePicker.openCamera(pickerOptions);
    print(list);
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  picture_picker: ^1.0.0

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:picture_picker/picture_picker.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
91
Overall:
Weighted score of the above. [more]
60
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.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:picture_picker/picture_picker.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:picture_picker/picture_picker.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:picture_picker/picture_picker.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:picture_picker/picture_picker.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [picture_picker] that is in a package requiring null.

Health suggestions

Format lib/src/AssetMedia.dart.

Run flutter format to format lib/src/AssetMedia.dart.

Format lib/src/PicturePicker.dart.

Run flutter format to format lib/src/PicturePicker.dart.

Format lib/src/PicturePickerOptions.dart.

Run flutter format to format lib/src/PicturePickerOptions.dart.

Maintenance suggestions

The package description is too short. (-9 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8