theyakka/qr.flutter

emptyColor

Opened this issue · 4 comments

Hi theyakka, I'm using your lib to generate qrcode, I'm using the QrPainter class to create the qrcode and getting the BufferByte to save it to file.

I have the following problem, if I don't use emptyColor the saved image has a black background.

Code:
image

image

Code:
image
image

however the emptyColor attribute is deprecated, what alternatives do I have to replace the emptyColor attribute while maintaining the same result?

I am grateful in advance for your attention

I would also like to understand what is the alternative. The 'color' property is also deprecated, the suggestion in the code: @Deprecated( 'You should use the background color value of your container widget', ) this.emptyColor,

The problem with this is that I am generating an Image and not a widget, I would like to have a white background on my png image, or a png without the alpha channel. How can I achieve this without emptyColor?

I faced the same issue and I was going to open an issue here but found this one is already opened
@RobotBroer and @jcarvalhogo here both show the issue in a good way, but why not share it again!

Mainly we use QR code to share some links. In a lot of scenarios, we need to share or save the QR code as an image.
the issue happens because the paint canvas in QrPainter() widget is transparent
then it paints the pixels and leaves empty cells transparent

when user try to share qr code like in WhatsApp for example, the user will get blank black screen
which actually black pixels of QR code and black canvas of WhatsApp so the QR code becomes Invisible

let me send the code that is Working:

final image = await QrPainter(
      // ignore: deprecated_member_use
      emptyColor: Colors.white,
      data: await buildQrLink(tableId),
      version: QrVersions.auto,
      gapless: false,
    ).toImage(300);

This image will always show QR code with black pixels and tints with a white background (not a blank black Image)

so I suggest getting emptyColor property back again or giving a more reliable solution of such a situation if there is a solution that needs time to be coded tell me about I will be very happy to participate.

Same issue