搜索分类、插件与代码仓

simple_barcode_scanner 封面
插件详情v0.6.1

simple_barcode_scanner

simple_barcode_scanner 可让您在移动设备、网页和 Windows 上扫描条形码和二维码。

AndroidiOSWebWindows
近 30 天下载
1万
喜欢数
217
Pub 分数
150

安装插件

flutter pub add simple_barcode_scanner

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个轻量级的 Flutter 包,可在 Android、iOS、Web 和 Windows 平台上扫描条形码和二维码。它提供了一个简单的接口,可轻松将扫描功能集成到应用中,无需复杂的设置。该包以简洁性为核心设计,利用原生相机访问,并支持实时扫描,配置极少。非常适合需要快速可靠读取代码的应用程序。

适合场景

  • 库存管理
  • 支付处理
  • 票务验证
  • 用户身份验证
  • 产品信息查询

主要特点

  • 跨平台支持
  • 简单 API 集成
  • 实时扫描
  • 轻量级依赖
  • 基于摄像头的检测

适合对象

  • 移动应用开发者
  • Web 应用程序创建者
  • 桌面应用程序集成商
  • 零售和物流应用
  • 事件票务系统

使用建议

  • 需要移动设备上的相机权限
  • 有限的自定义选项
  • 不支持离线模式
  • 取决于设备摄像头质量
  • 可能需要平台特定的配置

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

✊ We stand in solidarity with the Tibetan people in their struggle for freedom and cultural preservation. Learn more at Free Tibet.

simple_barcode_scanner

simple_barcode_scanner that let you scan barcode and qr code in mobile,web and windows.

Demo

Android IOS
drawing drawing
Window Web
drawing drawing

Credit

  • This plugin is built upon the flutter_barcode_scanner for Android and iOS. Since the original plugin is no longer actively maintained, I have forked the repository and implemented additional features on top of it. Special thanks to Amol Gangadhare for his work.

Features

  • Scan barcode in mobile devices using flutter_barcode_scanner
  • Scan barcode in web/window using html5-qrcode package

Installation and configuration

Getting started

simple_barcode_scanner: ^0.3.1

Import the library:

import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';

Usage

  1. To scan barcode
   ElevatedButton(
              onPressed: () async {

String? res = await SimpleBarcodeScanner.scanBarcode(
                  context,
                  barcodeAppBar: const BarcodeAppBar(
                    appBarTitle: 'Test',
                    centerTitle: false,
                    enableBackButton: true,
                    backButtonIcon: Icon(Icons.arrow_back_ios),
                  ),
                  isShowFlashIcon: true,
                  delayMillis: 2000,
                  cameraFace: CameraFace.front,
                );
                setState(() {
                  result = res as String;
                });
              },
              child: const Text('Open Scanner'),
            )
  1. To stream barcode
   ElevatedButton(
              onPressed: () async {

                SimpleBarcodeScanner.streamBarcode(
                  context,
                  barcodeAppBar: const BarcodeAppBar(
                    appBarTitle: 'Test',
                    centerTitle: false,
                    enableBackButton: true,
                    backButtonIcon: Icon(Icons.arrow_back_ios),
                  ),
                  isShowFlashIcon: true,
                  delayMillis: 2000,
                ).listen((event) {
                  print("Stream Barcode Result: $event");
                });
              },
              child: const Text('Open Scanner'),
            )
  1. To Scan with widget(Android Only)
   SizedBox(
                width: 200,
                height: 200,
                child: SimpleBarcodeScanner(
                  scaleHeight: 200,
                  scaleWidth: 400,
                  onScanned: (code) {
                    setState(() {
                      result = code;
                    });
                  },
                  continuous: true,
                  onBarcodeViewCreated: (BarcodeViewController controller) {
                    this.controller = controller;
                  },
                )),

Todo

  • Flash and switch camera are only available in mobile devices
  • Enhancement

Note

Feel free to fork and send pull request.

  • iOS support may be delayed as I currently do not have access to an iOS device for testing. Contributions and testing help from the community are welcome!
  • If you have any questions, feedback or ideas,You can create an issue. If you enjoy this project, I'd appreciate your 🌟 on GitHub.

You can also buy me a cup of coffee

publish

dart pub publish --dry-run
dart pub publish

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目