barcode_widget
Barcode Widget for flutter.
This widget uses pub:barcode to generate any supported Barcodes.
Live example with Flutter Web
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(),
),
],
)