搜尋套件、儲存庫與 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,以提供可靠的掃描效能。此套件支援多種條碼格式,並提供簡單直接的設定,所需設定極少。適用於需要快速且精確讀取條碼或 QR 碼的應用程式,可在各平台提供原生體驗。

適用情境

  • 移動庫存管理
  • 零售產品掃描
  • 活動門票驗證
  • 資產追蹤
  • 透過QR碼進行使用者驗證

主要特色

  • 跨平台支援(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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。