Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emptyColor #210

Open
jcarvalhogo opened this issue Sep 24, 2023 · 4 comments
Open

emptyColor #210

jcarvalhogo opened this issue Sep 24, 2023 · 4 comments

Comments

@jcarvalhogo
Copy link

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

@DuffyHomer
Copy link

DuffyHomer commented Sep 24, 2023 via email

@RobotBroer
Copy link

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?

@2Math0
Copy link

2Math0 commented Oct 12, 2023

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.

@denysbohatyrov
Copy link

Same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants