Skip to content

Latest commit

 

History

History
59 lines (36 loc) · 1.78 KB

README.md

File metadata and controls

59 lines (36 loc) · 1.78 KB

[toc]

!!!Documents in Chinese only!!!

qr_reader_plugin

A new Flutter plugin for reading QR Code.

Getting Started

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

功能

扫描二维码

可以配合camera插件使用。

调用scanByCameraStream可以识别camera插件的ImageStream信号,其中Android为YUV信号,iOS为RGBA信号。

如果扫描成功,返回String类型的扫描结果;没有扫描到时,返回null。

为了防止因为OOM导致crash,扫描间隔为100ms。

识别相册中的二维码

可以配合image_picker插件使用。

调用scanByImageFile可以扫描照片中的二维码,输入参数filePath为照片文件路径,可以通过image_picker插件获取。

example说明

plugin本身不需要额外申请权限,但是例子代码中使用camera需要配合添加配置:

Android

Andorid使用照相机camera插件,需要修改AndroidManifest.xml配置文件(位置android/app/src/main/AndroidManifest.xml),追加以下配置:

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

iOS

iOS使用照相机camera和照片选取image_picker插件,需要修改Info.plist配置文件(位置ios/Runner/Info.plist),追加以下配置:

	<key>NSCameraUsageDescription</key>
    <string>扫描二维码</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>识别相册中的二维码</string>