如何在 Flutter App 中显示二维码进行支付?,例如通过使用 UPI id 或其他数据?

问题描述 投票:0回答:1

在我的 Flutter 应用程序中,我将获取 UPI 详细信息,并将其保存到数据库,通过使用这些详细信息,我想创建二维码,用户将扫描该二维码来支付金额,我如何实现这一目标?

我正在尝试在管理应用程序中显示二维码,并通过扫描二维码用户可以付款

flutter payment-gateway upi
1个回答
0
投票

您可以使用此包显示QrCode,然后创建一个

BarcodeWidget
并设置
barcode:Barcode.qrCode

这是一个带装饰的小部件示例,显示了漂亮的 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,
              ),
            )
© www.soinside.com 2019 - 2024. All rights reserved.