Skip to content

Latest commit

 

History

History
253 lines (135 loc) · 5.21 KB

README_EN.md

File metadata and controls

253 lines (135 loc) · 5.21 KB

ai_barcode

totem


English Document 中文文档

ai_barcode: Support Android、iOS and web recognition of 'one-dimensional barcode' and 'two-dimensional barcode'

pub package

Highlights: `` ai_barcode: Support Scanner embedded in flutter pages to meet changing business needs ''

Effect

iOS-Scanner Android-Scanner
ios android
:- :-
iOS-Creator Android-Creator
ios android
:- :-
Web-Creator
web
:-
Web-Scanner
web
:-

ai_barcode inproject practical application flutter sample

Download Android apk ios ipa obtained by running the project Blog web site

1.Installing

Use this package as a library

1. Depend on it

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

pub package


dependencies:

  ai_barcode: ^version

Or depending on

dependencies:

  # barcode plugin.
  ai_barcode:
    git:
      url: https://github.com/pdliuw/ai_barcode.git

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:ai_barcode/ai_barcode.dart';


2.Usage

The use of 'Camera' requires dynamic application permission, dynamic permission recommendation:permission_handler

Configure permissions

Android permission configuration:


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

iOS permission configuration:


    <key>NSCameraUsageDescription</key>
    <string>Can we access your camera in order to scan barcodes?</string>


iOS supports PlatformView configuration:

	
    <key>io.flutter.embedded_views_preview</key>
    <true/>
    

1.Where '1D barcode, 2D barcode' is used:

Brief example

                //cameraWidth: the width of the camera; 
                //the height of the cameraHeight camera;
                //which can be dynamically adjusted according to the actual business

                Container(
                  color: Colors.black26,
                  width: cameraWidth,
                  height: cameraHeight,
                  child: PlatformAiBarcodeScannerWidget(
                    platformScannerController: _scannerController,
                  ),
                ),

Complete example

Full example, click here

2.Call / apply

*1、Turn on the camera device


          _scannerController.startCamera();

*2、Open Preview / Recognize 'Barcode'


          _scannerController.startCameraPreview();

*3、Close Preview / Recognize 'Barcode'


      _scannerController.stopCameraPreview();

*4、Turn off camera equipment


      _scannerController.stopCamera();

*5、Turn on the flashlight


      _scannerController.openFlash();

*5、Flashlight off


      _scannerController.closeFlash();

*5、Toggle flashlight


      _scannerController.toggleFlash();

Seeing it here is overwhelming?Click to see project examples

WEB permissions / security

Access of camera stream is prohibited on unsecured network (http) except for localhost usages. You can add whiltelist by opening chrome://flags and search for unsafely-treat-insecure-origin-as-secure

Thanksgiving

iOS-Barcode/QRCode Scanner/Creator Android-Barcode/QRCode Scanner/Creator Web、MacOS-QrCode Creator
Built on: MTBBarcodeScanner Built on: zxing Built on: qr_flutter
:- :- :-

TODO

  • Support: Camera image can be frozen after successfully scanning barcode on iOS

LICENSE

BSD 3-Clause License

Copyright (c) 2020, pdliuw
All rights reserved.