QrBarGenOpts class

Configuration options for generating QR codes and barcodes with customizable styling.

This class encapsulates all parameters needed to generate and style various types of barcodes and QR codes. It provides a unified configuration interface that works across all supported code formats, with special styling options for QR codes.

The configuration options include:

  • Basic properties like data content, code type, and size
  • Color customization for foreground and background
  • Advanced styling for QR codes through the qrStyle property
  • Style-specific parameters for effects like gradients, frames, and shadows

Example usage:

// Basic QR code
final options = QrBarGenOpts(
  data: 'https://flutter.dev',
  type: QrBarType.qr,
);

// Gradient-styled QR code with custom colors
final gradientOptions = QrBarGenOpts(
  data: 'https://flutter.dev',
  type: QrBarType.qr,
  qrStyle: QrStyle.gradient,
  fg: Colors.purple,
  secondaryColor: Colors.blue,
);

// EAN-13 barcode for a product
final barcodeOptions = QrBarGenOpts(
  data: '5901234123457',
  type: QrBarType.ean13,
  size: 250.0,
);

Note that QR-specific styling parameters (like qrStyle, logo, etc.) have no effect when used with linear barcode types like EAN-13 or Code 128.

Constructors

QrBarGenOpts({required String data, required QrBarType type, double size = 200.0, Color bg = Colors.white, Color fg = Colors.black, QrStyle qrStyle = QrStyle.standard, Color? secondaryColor, Color? tertiaryColor, Color? frameColor, double frameWidth = 10.0, Color? shadowColor, Offset shadowOffset = const Offset(2.0, 2.0), double shadowBlurRadius = 3.0})
Creates a new set of generation options for use with QR/barcode widgets.
const

Properties

bg Color
Background color of the generated code.
final
data String
The data (text, URL, number, etc.) to encode into the code.
final
fg Color
Foreground color of the code (the code lines/pixels).
final
frameColor Color?
Optional frame color for the framed style.
final
frameWidth double
Optional frame width for the framed style.
final
hashCode int
The hash code for this object.
no setterinherited
Optional logo image to place in the center of QR codes.
final
qrStyle QrStyle
Style option for QR codes (ignored for other barcode types).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secondaryColor Color?
Optional secondary color for multi-color QR styles.
final
shadowBlurRadius double
Optional shadow blur radius for the shadow style.
final
shadowColor Color?
Optional shadow color for the shadow style.
final
shadowOffset Offset
Optional shadow offset for the shadow style.
final
size double
The overall size (width/height) of the generated widget.
final
tertiaryColor Color?
Optional tertiary color for styles that use multiple colors.
final
type QrBarType
The type of code to generate (QR, Code128, EAN13, etc.).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited