mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
Unify svg and png rendering (#3288)
* Improve token image display with mask and background * Enhance token image bg and remove wierd halo effect that was showing, also add token bg to disclaimer and picker * Add token bg to more locations and give another shot at halo * fix: halo around token images * add token background to non-transparent images only * another shot at bg based on transparency * refactor: enhance token image widget shape handling and add filter quality option to cake image widget * fix: another shot * refactor: update token image shape handling for svg, no need to clip * fix: bnb wallet image not displaying on receive token display * Remove svg path and render all through token image widget
This commit is contained in:
@@ -24,41 +24,26 @@ class QrImage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final imagePath = embeddedImagePath ?? 'assets/images/qr-cake.png';
|
||||
final isSvg = imagePath.endsWith('.svg');
|
||||
final qrSize = size ?? 100.0;
|
||||
final logoSize = qrSize * 0.30;
|
||||
|
||||
if (isSvg) {
|
||||
final qrSize = size ?? 100.0;
|
||||
final logoSize = qrSize * 0.30;
|
||||
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
qr.QrImageView(
|
||||
data: data,
|
||||
errorCorrectionLevel: errorCorrectionLevel,
|
||||
version: version ?? qr.QrVersions.auto,
|
||||
size: qrSize,
|
||||
foregroundColor: foregroundColor,
|
||||
backgroundColor: backgroundColor,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
),
|
||||
TokenImageWidget(
|
||||
imageUrl: imagePath,
|
||||
size: logoSize * 0.8,
|
||||
),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return qr.QrImageView(
|
||||
data: data,
|
||||
errorCorrectionLevel: errorCorrectionLevel,
|
||||
version: version ?? qr.QrVersions.auto,
|
||||
size: size,
|
||||
foregroundColor: foregroundColor,
|
||||
backgroundColor: backgroundColor,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
embeddedImage: AssetImage(imagePath),
|
||||
);
|
||||
}
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
qr.QrImageView(
|
||||
data: data,
|
||||
errorCorrectionLevel: errorCorrectionLevel,
|
||||
version: version ?? qr.QrVersions.auto,
|
||||
size: qrSize,
|
||||
foregroundColor: foregroundColor,
|
||||
backgroundColor: backgroundColor,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
),
|
||||
TokenImageWidget(
|
||||
imageUrl: imagePath,
|
||||
size: logoSize * 0.8,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user