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

barras 封面
插件详情v0.2.1

barras

一个简单且可自定义的条形码扫描包,适用于 Android 和 iOS。它在 iOS 上使用 AVCaptureSession,在 Android 上使用 ZXing。

AndroidiOS
近 30 天下载
77
喜欢数
32
Pub 分数
150

安装插件

flutter pub add barras

插件介绍

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

Barras 是一个轻量级、可自定义的条形码扫描包,专为 Android 和 iOS 设计,旨在无缝集成到 Flutter 应用中。它在 iOS 上利用 AVCaptureSession,在 Android 上使用 ZXing,以提供可靠的扫描性能。该包支持多种条形码格式,并提供简单快捷的设置,配置需求极少。适用于需要快速准确地读取条形码或二维码的应用程序,可在各平台上提供原生体验。

适合场景

  • 移动库存管理
  • 零售产品扫描
  • 活动门票验证
  • 资产追踪
  • 通过二维码进行用户身份验证

主要特点

  • 跨平台支持(Android 和 iOS)
  • 使用原生扫描引擎(AVCaptureSession、ZXing)
  • 高度可定制的用户界面
  • 支持多种条形码格式
  • 与 Flutter 的简单集成

适合对象

  • 开发零售或物流应用的开发者
  • 需要快速条形码扫描的应用程序
  • 需要原生性能的项目
  • 初创企业寻求轻量级解决方案
  • Flutter 开发人员针对两个移动平台

使用建议

  • 两个平台都需要相机权限
  • 仅限条形码/二维码扫描
  • 无内置图像处理功能
  • 可能需要额外的样式来定制UI
  • 依赖外部原生库以实现核心功能

原始 README

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

Barras

This document is also available in: English | Português


Barras is a simple and customizable barcode scanning Flutter package for Android and iOS. It uses AVCaptureSession in iOS and ZXing in Android.

Please bear in mind that Barras is experimental, in early development stage.

Getting Started

Requirements

Barras requires camera usage permission, on both iOS and Android. This must be implemented by you, considering any alternatives that you may be already using for user permission requests.

If you are not handling permissions yet, there are good plugins to do it, like permission_handler.

Besides that, Barras depends on the following:

  • Flutter 2.10.5 or higher
  • Android API 26 (Marshmallow) or newer
  • iOS 9.0 or newer
Import and use in your code

Add Barras dependency to the pubspec.yaml file:

dependencies:
  barras: ^0.2.1

Import it in your code:

import 'package:barras/barras.dart';

Simply call the scan method, and we are good to go:

// Open the barcode reading page. Returned data will be null if
// Cancel button is pressed, or if user navigates back
final data = await Barras.scan(context);

Default barcode capture page

You can also customize the appearance of the barcode capture page:

// Open the barcode reading page. Customize the appearance, changing the
// viewfinder color, size and blinking speed. Returned data will be null
// if Cancel button is pressed, or if user navigates back
final data = await Barras.scan(
  context,
  viewfinderHeight: 120,
  viewfinderWidth: 300,
  scrimColor: Color.fromRGBO(128, 0, 0, 0.5),
  borderColor: Colors.red,
  borderRadius: 24,
  borderStrokeWidth: 2,
  buttonColor: Colors.yellow,
  borderFlashDuration: 250,
  cancelButtonText: "取消",
  successBeep: false,
);

Customized barcode capture page

You can check a working example app in the example folder.

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。