QrPainter class

A CustomPainter object that you can use to paint a QR code.

Inheritance

Constructors

QrPainter({required String data, required int version, int errorCorrectionLevel = QrErrorCorrectLevel.L, bool gapless = false, Image? embeddedImage, QrEmbeddedImageStyle? embeddedImageStyle, QrEyeStyle eyeStyle = const QrEyeStyle(eyeShape: QrEyeShape.square, color: Color(0xFF000000)), QrDataModuleStyle dataModuleStyle = const QrDataModuleStyle(dataModuleShape: QrDataModuleShape.square, color: Color(0xFF000000)), @Deprecated('use colors in eyeStyle and dataModuleStyle instead') Color? color = _qrDefaultColor, @Deprecated('You should use the background color value of your container widget') Color? emptyColor})
Create a new QRPainter with passed options (or defaults).
QrPainter.withQr({required QrCode qr, bool gapless = false, Image? embeddedImage, QrEmbeddedImageStyle? embeddedImageStyle, QrEyeStyle eyeStyle = const QrEyeStyle(eyeShape: QrEyeShape.square, color: Color(0xFF000000)), QrDataModuleStyle dataModuleStyle = const QrDataModuleStyle(dataModuleShape: QrDataModuleShape.square, color: Color(0xFF000000)), @Deprecated('use colors in eyeStyle and dataModuleStyle instead') Color? color = _qrDefaultColor, @Deprecated('You should use the background color value of your container widget') Color? emptyColor})
Create a new QrPainter with a pre-validated/created QrCode object. This constructor is useful when you have a custom validation / error handling flow or for when you need to pre-validate the QR data.

Properties

color Color?
The color of the squares.
final
dataModuleStyle QrDataModuleStyle
Styling option for QR data module.
final
embeddedImage Image?
The image data to embed (as an overlay) in the QR code. The image will be added to the center of the QR code.
final
embeddedImageStyle QrEmbeddedImageStyle?
Styling options for the image overlay.
final
emptyColor Color?
The color of the non-squares (background).
final
errorCorrectionLevel int
The error correction level of the QR code.
final
eyeStyle QrEyeStyle
Styling option for QR Eye ball and frame.
final
gapless bool
If set to false, the painter will leave a 1px gap between each of the squares.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsBuilder SemanticsBuilderCallback?
Returns a function that builds semantic information for the picture drawn by this painter.
no setterinherited
version int
The QR code version.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be notified when it is time to repaint.
inherited
hitTest(Offset position) bool?
Called whenever a hit test is being performed on an object that is using this custom paint delegate.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(Canvas canvas, Size size) → void
Called whenever the object needs to paint. The given Canvas has its coordinate space configured such that the origin is at the top left of the box. The area of the box is the size of the size argument.
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies when it is time to repaint.
inherited
shouldRebuildSemantics(covariant CustomPainter oldDelegate) bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
inherited
shouldRepaint(covariant CustomPainter oldPainter) bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
override
toImage(double size) Future<Image>
Returns the raw QR code ui.Image object.
toImageData(double size, {ImageByteFormat format = ui.ImageByteFormat.png}) Future<ByteData?>
Returns the raw QR code image byte data.
toPicture(double size) Picture
Returns a ui.Picture object containing the QR code data.
toString() String
A string representation of this object.
inherited

Operators

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