How to show QR code to pay in Flutter App ?, e.g By using UPI id or some another data?

382 Views Asked by At

In My Flutter App I will take UPI details and I will save to database and by using those details I want to create QR code which will scan by users to pay the amount, how i can achieve this ?

I am trying to show QR code in admin app, and by scanning that QR users can pay

1

There are 1 best solutions below

0
Zahra On

You can show QrCode using this package, then create a BarcodeWidget and set barcode:Barcode.qrCode

Here is an example of a widget with decoration that shows a nice QrCode:

 ConstrainedBox(
              constraints: const BoxConstraints.expand(width: 300, height: 300),
              child: BarcodeWidget(
                // this should be white or really light color
                backgroundColor: Colors.white,
                padding: const EdgeInsets.all(8),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(8),
                  boxShadow: const [
                    BoxShadow(
                        offset: Offset(5, 5),
                        blurRadius: 4,
                        spreadRadius: 10,
                        color: Colors.white10),
                    BoxShadow(
                        offset: Offset(-5, -5),
                        blurRadius: 4,
                        spreadRadius: 10,
                        color: Colors.white10),
                  ],
                ),
                // The bars color
                // should be black or really dark color
                color: Colors.black,
                barcode: Barcode.qrCode(
                  errorCorrectLevel: BarcodeQRCorrectionLevel.medium,
                ),
                data: url,
              ),
            )