搜索插件、代码仓与 APP 分类

GitHub 代码仓PiotrFLEURY/camcode

camcode

一个 Flutter 网络摄像头条形码扫描库

camcode 项目封面
星标
11
复刻
11
最近推送(UTC)
2023年9月9日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

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

Piotr FLEURY GitHub avatar
GitHub 作者

Piotr FLEURY ↗

XPEHOFrance
语言DartRubyHTMLKotlinSwiftJavaScriptObjective-C

此仓库发布的插件

使用的依赖

依赖清单 6 项

  • flutter{"sdk":"flutter"}
  • flutter_web_plugins{"sdk":"flutter"}
  • js^0.6.2
  • flutter_test开发依赖{"sdk":"flutter"}
  • every_test开发依赖^1.0.0
  • pedantic开发依赖^1.9.0

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗