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

QrPainter.withQr cannot set background color #172

Open
SeriousMonk opened this issue Mar 29, 2022 · 1 comment
Open

QrPainter.withQr cannot set background color #172

SeriousMonk opened this issue Mar 29, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@SeriousMonk
Copy link

Hi,

I am trying to use QrPainter.withQr() to allow users to download an image of the qrcode from my app.
Currently there seems to be no way to change the background color withing QrPainter.withQr(). This makes a qr code like the following impossible to see since it's black on black.

 QrPainter.withQr(
      qr: qrCode,
      color: Colors.black,
      gapless: true,
      embeddedImage: await _getUiImage('assets/logos/EgoMenuLogo_white_on_orange_with_text_small.png'),
      embeddedImageStyle: QrEmbeddedImageStyle(
        size: Size(228, 228)
      ),
      eyeStyle: QrEyeStyle(
        eyeShape: QrEyeShape.circle,
        color: Colors.black,
      ),
      dataModuleStyle: QrDataModuleStyle(
        dataModuleShape: QrDataModuleShape.circle,
        color: Colors.black
      )
    );

I think I read in another issue that this feature might be already on its way in qr_flutter 5.0.0; if so do you have an ETA for the release?

Thank you very much

@SeriousMonk SeriousMonk added the enhancement New feature or request label Mar 29, 2022
@SeriousMonk
Copy link
Author

I temporarily fixed this by creating my copy of QrPainter and adding

final backgroundPaint = Paint()..color = Color(0xFFFFFFFF)..style = PaintingStyle.fill;
canvas.drawRect(Rect.fromLTWH(0, 0, size.width, size.height), backgroundPaint);

at the beginning of the paint(Canvas canvas, Size size) method

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

No branches or pull requests

1 participant