barcode_widget 2.0.4 copy "barcode_widget: ^2.0.4" to clipboard
barcode_widget: ^2.0.4 copied to clipboard

Barcode generation widget for Flutter with support for standard barcodes.

barcode_widget #

Barcode Widget for flutter.

Buy Me A Coffee

This widget uses pub:barcode to generate any supported Barcodes.

Barcode Demo

Live example with Flutter Web #

https://davbfr.github.io/dart_barcode/

Getting Started #

In your flutter project add the dependency:

dependencies:
  ...
  barcode_widget:

For help getting started with Flutter, view the online documentation.

Usage example #

Import barcode_widget.dart

import 'package:barcode_widget/barcode_widget.dart';

Use the widget directly

BarcodeWidget(
  barcode: Barcode.code128(),
  data: 'Hello Flutter',
);

To display an custom error message if the barcode is not valid, use:

BarcodeWidget(
  barcode: Barcode.ean13(),
  data: 'Hello',
  errorBuilder: (context, error) => Center(child: Text(error)),
);

Many layout options are available like: width, height, margin, padding, colors, etc.

To add a logo on top of a QrCode, use Flutter's composing abilities while increasing the error recovery density:

Stack(
  alignment: Alignment.center,
  children: [
    BarcodeWidget(
      barcode: Barcode.qrCode(
        errorCorrectLevel: BarcodeQRCorrectionLevel.high,
      ),
      data: 'https://pub.dev/packages/barcode_widget',
      width: 200,
      height: 200,
    ),
    Container(
      color: Colors.white,
      width: 60,
      height: 60,
      child: const FlutterLogo(),
    ),
  ],
)
315
likes
160
pub points
99%
popularity

Publisher

verified publishernfet.net

Barcode generation widget for Flutter with support for standard barcodes.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

barcode, flutter

More

Packages that depend on barcode_widget