Image picker flutter - ImagePicker

Overview

image_picker_flutter pub package

功能介绍

  • 该插件目前支持IOS(8-13)、Android(16-29)
  • 支持单选、多选
  • 提供拍照、视频录制功能
  • 支持多种图片格式PNG、JPG、GIF等,Flutter不支持的图片格式通过IOS、Android原生方法提供支持
  • 支持多种视频格式,视频预览图通过IOS、Android原生方法提供支持
  • 所用资源都提供File的绝对路径
  • 不支持原图预览
  • 不支持视频播放
  • 不支持IOS、Android动态权限、需要使用之前自行权限获取,建议使用permission_handler
  • ...

Demo动图(有那么点不清晰)

image

使用说明

Android 必须添加Kotlin依赖

Ios 必须是Swift创建的项目

dependencies in flutter


dependencies:
  image_picker_flutter: ^1.4.4
  

iOS 权限


<key>NSPhotoLibraryUsageDescription</key>
<string>使用图片</string>
<key>NSCameraUsageDescription</key>
<string>照相</string>
<key>NSMicrophoneUsageDescription</key>
<string>录音</string>

Android 权限


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

Demo 应用

Android APP

IOS APP 因发布原因暂不提供、可以下载代码编译安装

API 介绍

  • ImagePicker
    • (单选)singlePicker
    • (多选)mulPicker
    • (拍照)takePicture
    • (视频录制)takeVideo

序言

- Flutter越做越强大!!!
- image_picker_flutter功能越来越完善!!!
- 开源加油!!!
You might also like...

A Customizable Progressive Time Picker for Flutter.

A Customizable Progressive Time Picker for Flutter.

progressive_time_picker A Customizable Progressive Time Picker for Flutter. This plugin allow us to customize time picker based on our requirements fo

Nov 21, 2022

Flutter cupertino style date picker.

Flutter cupertino style date picker.

Flutter Cupertino Date Picker [pub packages] | 中文说明 Flutter cupertino date picker. Usage 1. Depend Add this to you package's pubspec.yaml file: depend

Dec 26, 2022

Flutter cupertino style date picker.

Flutter cupertino style date picker.

Flutter Cupertino Date Picker [pub packages] | 中文说明 Flutter cupertino date picker. Usage 1. Depend Add this to you package's pubspec.yaml file: depend

Dec 26, 2022

A highly customizable Flutter color picker.

A highly customizable Flutter color picker.

FlexColorPicker FlexColorPicker is a customizable color picker for Flutter. The ColorPicker can show six different types of color pickers, three of wh

Dec 14, 2022

A HSV color picker for your flutter app. RGB HSV Wheel Hue Saturation Values.

A HSV color picker for your flutter app. RGB HSV Wheel Hue Saturation Values.

flutter_hsvcolor_picker A HSV color picker for your flutter app. RGB HSV Wheel Hue Saturation Values. Getting Started Installation https://pub.dev/pac

Dec 8, 2022

Imagepickerweb - A picker with which you can pick images and videos from your Flutter web app

Imagepickerweb - A picker with which you can pick images and videos from your Flutter web app

ImagePickerWeb This Web-Plugin allows Flutter Web to pick images (as File, Widget or Uint8List) and videos (as File or Uint8List). Many thanks goes to

Sep 26, 2022

A Flutter widget to set time with spinner instead of material time picker

A Flutter widget to set time with spinner instead of material time picker

flutter_time_picker_spinner Time Picker widget with spinner instead of a material time picker. 12H format 24H format 24H format with second Custom sty

Aug 8, 2022

A highly customizable Flutter color picker.

A highly customizable Flutter color picker.

FlexColorPicker FlexColorPicker is a customizable color picker for Flutter. The ColorPicker can show six different types of color pickers, three of wh

Dec 14, 2022

Native Color Picker for Flutter

native_color_picker A native color picker for Flutter. Online Demo: https://rodydavis.github.io/native_color_picker/ Currently only supports web! Gett

Dec 13, 2022
Comments
  • compile error

    compile error

    Error output from Xcode build:
    ↳
        2019-12-20 11:10:00.925 xcodebuild[76861:12042906] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fc944b0dcc0), qiujie的 iPhone, iPhone, 13.1.3 (17A878), 7ce3d4082b95f0e10f4f00320e9623e44fd2e463> == Underlying device preparation errors ==
        2019-12-20 11:10:00.925 xcodebuild[76861:12042906] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fc944b0dcc0), qiujie的 iPhone, iPhone, 13.1.3 (17A878), 7ce3d4082b95f0e10f4f00320e9623e44fd2e463> -- Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.
        Domain: com.apple.platform.iphoneos
        Code: 5
        Failure Reason: allowsSecureServices: 1. isConnected: 0. Platform: <DVTPlatform:0x7fc942c3ef20:'com.apple.platform.iphoneos':<DVTFilePath:0x7fc942c3eea0:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform'>>. DTDKDeviceIdentifierIsIDID: 0
        --
        2019-12-20 11:10:00.925 xcodebuild[76861:12042906] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fc944b0dcc0), qiujie的 iPhone, iPhone, 13.1.3 (17A878), 7ce3d4082b95f0e10f4f00320e9623e44fd2e463> == END: Underlying device preparation errors ==
        2019-12-20 11:10:01.487 xcodebuild[76861:12042906] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fc944b0dcc0), qiujie的 iPhone, iPhone, 13.1.3 (17A878), 7ce3d4082b95f0e10f4f00320e9623e44fd2e463> == Underlying device preparation errors ==
        2019-12-20 11:10:01.487 xcodebuild[76861:12042906] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fc944b0dcc0), qiujie的 iPhone, iPhone, 13.1.3 (17A878), 7ce3d4082b95f0e10f4f00320e9623e44fd2e463> -- Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.
        Domain: com.apple.platform.iphoneos
        Code: 5
        Failure Reason: allowsSecureServices: 1. isConnected: 0. Platform: <DVTPlatform:0x7fc942c3ef20:'com.apple.platform.iphoneos':<DVTFilePath:0x7fc942c3eea0:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform'>>. DTDKDeviceIdentifierIsIDID: 0
        --
        2019-12-20 11:10:01.488 xcodebuild[76861:12042906] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fc944b0dcc0), qiujie的 iPhone, iPhone, 13.1.3 (17A878), 7ce3d4082b95f0e10f4f00320e9623e44fd2e463> == END: Underlying device preparation errors ==
        ** BUILD FAILED **
    
    
    Xcode's output:
    ↳
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:262:17: warning: instance method 'imagePickerController(_:didFinishPickingMediaWithInfo:)' nearly matches optional requirement 'imagePickerController(_:didFinishPickingMediaWithInfo:)' of protocol 'UIImagePickerControllerDelegate'
            public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
                        ^
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:262:17: note: candidate has non-matching type '(UIImagePickerController, [UIImagePickerController.InfoKey : Any]) -> ()' (aka '(UIImagePickerController, Dictionary<NSString, Any>) -> ()')
            public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
                        ^
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:262:17: note: move 'imagePickerController(_:didFinishPickingMediaWithInfo:)' to an extension to silence this warning
            public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
                        ^
        UIKit.UIImagePickerControllerDelegate:8:19: note: requirement 'imagePickerController(_:didFinishPickingMediaWithInfo:)' declared here
            optional func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])
                          ^
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:236:35: error: 'jpegData(compressionQuality:)' has been renamed to 'UIImageJPEGRepresentation(_:_:)'
                            data = image?.jpegData(compressionQuality: 100) ?? nil
                                          ^~~~~~~~
                                          UIImageJPEGRepresentation
        UIKit.UIImage:60:17: note: 'jpegData(compressionQuality:)' was introduced in Swift 4.2
            public func jpegData(compressionQuality: CGFloat) -> Data?
                        ^
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:263:42: warning: cast from 'Slice<Dictionary<UIImagePickerController.InfoKey, Any>>' (aka 'Slice<Dictionary<NSString, Any>>') to unrelated type 'String' always fails
                let mediaType = info[.mediaType] as! String;
                                ~~~~~~~~~~~~~~~~ ^   ~~~~~~
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:263:29: error: ambiguous reference to member 'subscript'
                let mediaType = info[.mediaType] as! String;
                                ~~~~^~~~~~~~~~~~
        Swift.Dictionary<τ_0_0, τ_0_1>:8:23: note: found this candidate
            @inlinable public subscript(position: Dictionary<Key, Value>.Index) -> [Key : Value].Element { get }
                              ^
        Swift.Dictionary<τ_0_0, τ_0_1>:2:23: note: found this candidate
            @inlinable public subscript(key: Key) -> Value? { get set }
                              ^
        Swift.Dictionary<τ_0_0, τ_0_1>:2:23: note: found this candidate
            @inlinable public subscript(key: Key, default defaultValue: @autoclosure () -> Value) -> Value { get set }
                              ^
        Swift.Collection:2:23: note: found this candidate
            @inlinable public subscript(bounds: Range<Self.Index>) -> Slice<Self> { get }
                              ^
        Swift.Collection:2:23: note: found this candidate
            @inlinable public subscript<R>(r: R) -> Self.SubSequence where R : RangeExpression, Self.Index == R.Bound { get }
                              ^
        Swift.Collection:3:23: note: found this candidate
            @inlinable public subscript(x: (UnboundedRange_) -> ()) -> Self.SubSequence { get }
                              ^
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:265:56: warning: cast from 'Slice<Dictionary<UIImagePickerController.InfoKey, Any>>' (aka 'Slice<Dictionary<NSString, Any>>') to unrelated type 'UIImage' always fails
                    let image:UIImage?  = info[.originalImage] as? UIImage;
                                          ~~~~~~~~~~~~~~~~~~~~ ^   ~~~~~~~
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:265:56: warning: cast from 'Slice<Dictionary<UIImagePickerController.InfoKey, Any>>' (aka 'Slice<Dictionary<NSString, Any>>') to unrelated type 'UIImage' always fails
                    let image:UIImage?  = info[.originalImage] as? UIImage;
                                          ~~~~~~~~~~~~~~~~~~~~ ^   ~~~~~~~
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:265:56: error: 'UIImage?' is not convertible to 'UIImage'
                    let image:UIImage?  = info[.originalImage] as? UIImage;
                                          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:274:51: warning: cast from 'Slice<Dictionary<UIImagePickerController.InfoKey, Any>>' (aka 'Slice<Dictionary<NSString, Any>>') to unrelated type 'NSURL' always fails
                    let videoUrl:NSURL? = info[.mediaURL] as? NSURL;
                                          ~~~~~~~~~~~~~~~ ^   ~~~~~
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:274:51: warning: cast from 'Slice<Dictionary<UIImagePickerController.InfoKey, Any>>' (aka 'Slice<Dictionary<NSString, Any>>') to unrelated type 'NSURL' always fails
                    let videoUrl:NSURL? = info[.mediaURL] as? NSURL;
                                          ~~~~~~~~~~~~~~~ ^   ~~~~~
        /Users/tian/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.4.2/ios/Classes/SwiftImagePickerFlutterPlugin.swift:274:51: error: 'NSURL?' is not convertible to 'NSURL'
                    let videoUrl:NSURL? = info[.mediaURL] as? NSURL;
    
    opened by badboy-tian 4
  • ios 编译找不到这个文件啊

    ios 编译找不到这个文件啊

    /Users/hjc1/.pub-cache/hosted/pub.flutter-io.cn/image_picker_flutter-1.3.1/ios/Classes/ImagePickerFlutterPlugin.m:2:9: fatal error: 'image_picker_flutter/image_picker_flutter-Swift.h' file not found #import <image_picker_flutter/image_picker_flutter-Swift.h>

    opened by hjc22 2
  • err v2

    err v2

    AndroidManifest.xml uses android:name="io.flutter.app.FlutterApplication" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

    Build failed due to use of deprecated Android v1 embedding.

    opened by zoranmil 0
  • Can you improve screen loading time for image selection?

    Can you improve screen loading time for image selection?

    Your library is awesome, it's very nice and complete

    However there is a small problem here: For devices with a large number of images, the load time of screen image selection is very large.

    opened by hungbu 1
Releases(1.4.2)
Owner
郑泰捐
android 程序猿
郑泰捐
A flutter date time picker inspired by flutter-cupertino-date-picker

Flutter Datetime Picker (Pub) flutter_datetime_picker A flutter date time picker inspired by flutter-cupertino-date-picker you can choose date / time

null 0 Nov 30, 2021
Color picker for Flutter, based on the Google Docs color picker.

Material ColorPicker Color picker for Flutter, based on the Google Docs color picker. Getting Started You can embed into your material app or use it o

Razvan Lung 103 Oct 30, 2022
Nepali date picker - Material Style Date Picker with Bikram Sambat(Nepali) Calendar Support

Nepali Date Picker + Calendar Material and Cupertino Styled Date Picker, Date Range Picker and Calendar with Bikram Sambat(Nepali) Support. Nepali Dat

Sarbagya Dhaubanjar 35 Jan 3, 2023
Flutter simple image crop - A simple and easy to use flutter plugin to crop image on iOS and Android

Image Zoom and Cropping plugin for Flutter A simple and easy used flutter plugin to crop image on iOS and Android. Installation Add simple_image_crop

null 97 Dec 14, 2021
Flutter Image add drag sort, Image add drag sort, support click event, delete, add, long press drag sort.

flutter_image_add_drag_sort Flutter Image add drag sort, Image add drag sort, support click event, delete, add, long press drag sort, support video fi

null 5 Jun 23, 2020
Dart library for decoding/encoding image formats, and image processing.

image Overview A Dart library providing the ability to load, save and manipulate images in a variety of different file formats. The library is written

Brendan Duncan 907 Dec 27, 2022
Album Image is based in photo_manager package and has the same concept as image_picker but with a more attractive interface to choose an image or video from the device gallery, whether it is Android or iOS

Album Image is based in photo_manager package and has the same concept as image_picker but with a more attractive interface to choose an image or vide

Phuong Vu 2 Oct 13, 2022
null 0 Feb 2, 2022
Sample Flutter Drawing App which allows the user to draw onto the canvas along with color picker and brush thickness slider.

DrawApp Sample Flutter Drawing App which allows the user to draw onto the canvas along with color picker and brush thickness slider. All code free to

Jake Gough 226 Nov 3, 2022