2025-06-17 00:32:11 +02:00
|
|
|
import 'package:cake_wallet/wallet_type_utils.dart';
|
2020-01-04 21:31:52 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2023-01-30 20:03:47 +02:00
|
|
|
import 'package:qr_flutter/qr_flutter.dart' as qr;
|
2020-01-04 21:31:52 +02:00
|
|
|
|
|
|
|
class QrImage extends StatelessWidget {
|
|
|
|
QrImage({
|
2023-01-30 20:03:47 +02:00
|
|
|
required this.data,
|
2023-11-23 16:51:22 +02:00
|
|
|
this.foregroundColor = Colors.black,
|
|
|
|
this.backgroundColor = Colors.white,
|
2020-01-04 21:31:52 +02:00
|
|
|
this.size = 100.0,
|
2023-03-24 17:26:42 +02:00
|
|
|
this.version,
|
2025-06-17 00:32:11 +02:00
|
|
|
this.errorCorrectionLevel = qr.QrErrorCorrectLevel.H,
|
2023-01-30 20:03:47 +02:00
|
|
|
});
|
2020-01-04 21:31:52 +02:00
|
|
|
|
|
|
|
final double size;
|
2023-11-23 16:51:22 +02:00
|
|
|
final Color foregroundColor;
|
|
|
|
final Color backgroundColor;
|
2023-01-30 20:03:47 +02:00
|
|
|
final String data;
|
2023-03-24 17:26:42 +02:00
|
|
|
final int? version;
|
2023-01-30 20:03:47 +02:00
|
|
|
final int errorCorrectionLevel;
|
2020-01-04 21:31:52 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-05-08 23:30:14 +03:00
|
|
|
return qr.QrImageView(
|
2023-01-30 20:03:47 +02:00
|
|
|
data: data,
|
|
|
|
errorCorrectionLevel: errorCorrectionLevel,
|
2024-10-04 23:00:36 +03:00
|
|
|
version: version ?? qr.QrVersions.auto,
|
2023-01-30 20:03:47 +02:00
|
|
|
size: size,
|
2023-11-23 16:51:22 +02:00
|
|
|
foregroundColor: foregroundColor,
|
|
|
|
backgroundColor: backgroundColor,
|
2023-05-10 16:58:31 +03:00
|
|
|
padding: const EdgeInsets.all(8.0),
|
2025-06-17 00:32:11 +02:00
|
|
|
embeddedImage: AssetImage('assets/images/qr-cake.png'),
|
2020-01-04 21:31:52 +02:00
|
|
|
);
|
|
|
|
}
|
2023-01-30 20:03:47 +02:00
|
|
|
}
|