CakeWallet/lib/src/screens/receive/widgets/qr_image.dart

36 lines
977 B
Dart
Raw Normal View History

import 'package:cake_wallet/wallet_type_utils.dart';
2020-01-04 21:31:52 +02:00
import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart' as qr;
2020-01-04 21:31:52 +02:00
class QrImage extends StatelessWidget {
QrImage({
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,
this.version,
this.errorCorrectionLevel = qr.QrErrorCorrectLevel.H,
});
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;
final String data;
final int? version;
final int errorCorrectionLevel;
2020-01-04 21:31:52 +02:00
@override
Widget build(BuildContext context) {
return qr.QrImageView(
data: data,
errorCorrectionLevel: errorCorrectionLevel,
version: version ?? qr.QrVersions.auto,
size: size,
2023-11-23 16:51:22 +02:00
foregroundColor: foregroundColor,
backgroundColor: backgroundColor,
padding: const EdgeInsets.all(8.0),
embeddedImage: AssetImage('assets/images/qr-cake.png'),
2020-01-04 21:31:52 +02:00
);
}
}