在我的 Flutter 应用程序中,我将获取 UPI 详细信息,并将其保存到数据库,通过使用这些详细信息,我想创建二维码,用户将扫描该二维码来支付金额,我如何实现这一目标?
我正在尝试在管理应用程序中显示二维码,并通过扫描二维码用户可以付款
您可以使用此包显示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,
),
)