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

pretty_qr_code 封面
套件詳情v3.6.0

pretty_qr_code

一個高度可自訂的 Flutter 小工具,可輕鬆呈現 QR 碼。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
23.2萬
喜歡數
587
Pub 分數
140

安裝套件

flutter pub add pretty_qr_code

套件介紹

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

一個高度可自訂的 Flutter 小部件,可輕鬆呈現 QR 碼。它允許開發者透過大小、顏色、形狀和圖示整合等選項來調整 QR 碼的外觀。此套件支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常適合跨平台應用。憑藉乾淨的 API 和內建樣式功能,它無需外部相依性即可簡化 QR 碼產生。非常適合需要品牌化或互動式 QR 碼的應用。

適用情境

  • 產生品牌QR碼
  • 向二維碼添加商標
  • 在網頁和行動應用中嵌入二維碼
  • 建立動態QR碼
  • 在儀表板中顯示二維碼

主要特色

  • 可客製化的顏色和尺寸
  • Logo疊加支援
  • 跨平台相容性
  • 簡單 API
  • 高度可配置的設計
  • 內建錯誤校正

適合對象

  • 行動應用開發者
  • Web 應用程式創建者
  • 注重設計的項目
  • 電子商務和行銷應用
  • 需要使用者產生QR碼的應用程式

使用建議

  • 可能需要對大批次進行效能優化
  • 有限的高級二維碼數據編碼選項
  • 徽標縮放可能會影響可讀性
  • 不適合高容量QR碼生成
  • 依賴於平台特定的渲染功能

原始 README

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

Pretty QR Code

Pub Likes on pub.dev Star on Github License: MIT

A highly customizable Flutter widget that makes it easy to render QR codes. Built on top of the qr package.

Features

  • Live Preview
  • Shapes - The widget provides functionality for rendering various built-in shapes, namely smooth, squares and dots, or you can even create your patterns using the package API.
  • Themes - Allows you easily switch between themes using the material theme extension.
  • Branding - Configure the display of the embedded image and adjust its style to best fit your needs.
  • Exporting - Save the QR сode as an image for sharing, embedding, or anything else.
  • Customization - Customize the appearance by setting the shape color or filling with a gradient.

If you want to say thank you, star us on GitHub or like us on pub.dev.

Usage

First, follow the package installation instructions and add a PrettyQrView widget to your app:

PrettyQrView.data(
  data: 'lorem ipsum dolor sit amet',
  decoration: const PrettyQrDecoration(
    image: PrettyQrDecorationImage(
      image: AssetImage('images/flutter.png'),
    ),
    quietZone: PrettyQrQuietZone.standart,
  ),
)

If you want to pass non-string data or want to specify a QR version, consider using the default PrettyQrView constructor:

@protected
late QrImage qrImage;

@override
void initState() {
  super.initState();

  final qrCode = QrCode(
    8,
    QrErrorCorrectLevel.H,
  )..addData('lorem ipsum dolor sit amet');

  qrImage = QrImage(qrCode);
}

@override
Widget build(BuildContext context) {
  return PrettyQrView(
    qrImage: qrImage,
    decoration: const PrettyQrDecoration(),
  );
}

Note: Do not create QrImage inside the build method; otherwise, you may have an undesired jank in the UI thread.

Combine several styles

To combine multiple styles in a single QR code, you can use PrettyQrCustomShape, as shown in the example below:

PrettyQrView.data(
  data: 'lorem ipsum dolor sit amet',
  decoration: const PrettyQrDecoration(
    shape: PrettyQrShape.custom(
      PrettyQrSquaresSymbol(),
      finderPattern: PrettyQrSmoothSymbol(),
      alignmentPatterns: PrettyQrDotsSymbol(),
    ),
  ),
)

Save the symbol as an image

You can save the QR code as an image using the toImage or toImageAsBytes extension methods that apply to QrImage. Optionally, the configuration parameter may be used to set additional saving options, such as pixel ratio or text direction.

final qrCode = QrCode.fromData(
  data: 'lorem ipsum dolor sit amet',
  errorCorrectLevel: QrErrorCorrectLevel.H,
);

final qrImage = QrImage(qrCode);
final qrImageBytes = await qrImage.toImageAsBytes(
  size: 512,
  format: ImageByteFormat.png,
  decoration: const PrettyQrDecoration(),
);

See the example folder for more code samples of the various possibilities.

Contributing

Contributions are welcomed!

Here is a curated list of how you can help:

  • Fix typos/grammar mistakes
  • Report parts of the documentation that are unclear
  • Report bugs and scenarios that are difficult to implement

Planned for future release(s)

  • Quiet Zone
  • Gradient filling
  • Export as image
  • Error handling API
  • Background color for QR code
  • Timing Patterns and Alignment Patterns
  • Support custom clippers for embedded images (#38)
  • Export as vector image (#42)

所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案