搜尋套件、儲存庫與 APP 分類

套件詳情v3.0.0

camcode

使用您最喜愛的 JavaScript 庫在 Flutter Web 上進行攝像頭條碼掃描

近 30 天下載
92
喜歡數
45
Pub 分數
60

安裝套件

flutter pub add camcode

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Camcode 是一個 Flutter Web 套件,透過平台通道利用流行的 JavaScript 庫來實現條碼和 QR 碼掃描。專為網路環境設計,可與 Flutter 應用程式無縫整合,使用裝置的相機提供即時掃描功能。該套件抽象了瀏覽器相機存取和 JavaScript 互操作性的複雜性,為開發者提供簡單的 API,無需深入了解網路特定的實作細節即可實作掃描功能。非常適合需要快速、可靠地讀取條碼或 QR 碼的網路應用。

適用情境

  • 基於網絡的庫存管理
  • 線上票務掃描
  • 數位文件驗證
  • 行動網頁結帳系統
  • 快速產品資訊查詢

主要特色

  • 使用原生 JavaScript 條碼庫
  • 即時掃描 Flutter Web
  • 透過 pub add 簡單整合
  • 跨瀏覽器相容性
  • 輕巧且快速

適合對象

  • Flutter Web 開發人員
  • 需要條碼掃描的網頁應用
  • 具有二維碼輸入要求的項目
  • 開發者避免複雜的 JS 互操作
  • 快速掃描功能原型設計

使用建議

  • 僅適用於 Flutter Web
  • 需要瀏覽器攝像頭權限
  • 依賴外部 JavaScript 庫
  • 僅限支援的條碼類型
  • 不支援移動平台

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

camcode

A camera barcode scan library for Flutter Web

Web build status

Getting Started

Add a javascript file for barcode scan

function detectBarcode(dataUrl, callback) {

    // call here your favorite javascript barcode scan library
    // input must be an image dataUrl
    // output must be a single String

    // don't forget to trigger the call back in order to get the result
    callback(barcode);
}

Import javascript files into your index.html

<script src="LINK_TO_MY_AWESOME_JAVASCRIPT_BARCODE_SCAN_LIB"></script>
<script src="js/barcode.js"></script> // the javascript file with the detectBarcode function

Use it

import 'package:camcode/cam_code_scanner.dart';

showDialog(
    context: context,
    builder: (context) => CamCodeScanner(
    width: MediaQuery.of(context).size.width,
    height: MediaQuery.of(context).size.height,
    refreshDelayMillis: 200,
    onBarcodeResult: (barcode) {
        // do whatever you want
    },
    minimalResultCount: 2,
    ),
);

More options

Manually release resources

Sometimes, depending on your camcode usage, you may need to release resources manually.

1- To do so, create first a controller for the scanner

// Create a controller to send instructions to scanner
  final CamCodeScannerController _controller = CamCodeScannerController();

2- Then, add it to the CamCodeScanner

CamCodeScanner(
    width: ...,
    height: ...,
    refreshDelayMillis: ...,
    onBarcodeResult: (barcode) {
        ...
    },
    controller: _controller,
),

3- And finally, just call releaseResources() method when required

ElevatedButton(
    onPressed: () {
        _controller.releaseResources();
    },
    child: Text('Release resources'),
),

Calling this method will close the camera and stop the scanner process

所屬分類

依賴

依賴清單 1 項

  • js^0.6.2

原始碼儲存庫

使用此套件的專案

暫無相關資料。