From ba394e7feaa21d58efba369a1325332068d0c58b Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Tue, 7 Oct 2025 10:38:04 +0200 Subject: [PATCH] BUG: Business QR Code Picture Display --- .../package_tools/mih_business_qr_code.dart | 48 ++----------------- 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart index 4f1b34d9..96592644 100644 --- a/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart +++ b/Frontend/lib/mih_packages/mzansi_profile/business_profile/package_tools/mih_business_qr_code.dart @@ -89,43 +89,6 @@ class _MihBusinessQrCodeState extends State { mimeType: MimeType.png, ); } - // if (kIsWeb) { - // final blob = html.Blob([imageBytes]); - // final url = html.Url.createObjectUrlFromBlob(blob); - // final anchor = html.document.createElement('a') as html.AnchorElement - // ..href = url - // ..style.display = 'none' - // ..download = filename; // Suggested filename for the download - - // html.document.body!.children.add(anchor); - // anchor.click(); // Programmatically click the link to trigger download - - // html.document.body!.children.remove(anchor); - // html.Url.revokeObjectUrl(url); - // } else { - // var permission = await FlDownloader.requestPermission(); - // if (permission == StoragePermissionStatus.granted) { - // try { - // mihLoadingPopUp(); - // KenLogger.success("Downloading from URL: $url"); - // await FlDownloader.download(url); - // Navigator.of(context).pop(); - // } on Exception catch (error) { - // Navigator.of(context).pop(); - // print(error); - // } - // } else { - // print("denied"); - // } - // try { - // final directory = await getDownloadsDirectory(); - // final file = File('${directory?.path}/$filename'); - // await file.writeAsBytes(imageBytes); - // KenLogger.success("File saved at: ${file.path}"); - // } catch (e) { - // KenLogger.error("Error saving file: $e"); - // } - // } } void mihLoadingPopUp() { @@ -139,10 +102,6 @@ class _MihBusinessQrCodeState extends State { Future downloadQrCode() async { if (_isUserSignedIn) { - // final Uri uri = Uri.parse(getQrCodeData(1024)); - // if (!await launchUrl(uri)) { - // throw 'Could not launch $uri'; - // } await screenshotController.capture().then((image) { KenLogger.success("Image Captured: $image"); setState(() { @@ -244,7 +203,8 @@ class _MihBusinessQrCodeState extends State { if (asyncSnapshot.connectionState == ConnectionState.done && asyncSnapshot.hasData) { - if (asyncSnapshot.requireData != "") { + if (asyncSnapshot.requireData != "" || + asyncSnapshot.requireData.isNotEmpty) { return MihCircleAvatar( imageFile: NetworkImage(asyncSnapshot.requireData), width: profilePictureWidth, @@ -263,7 +223,7 @@ class _MihBusinessQrCodeState extends State { return Icon( MihIcons.iDontKnow, size: profilePictureWidth, - color: MihColors.getSecondaryColor( + color: MihColors.getPrimaryColor( MzansiInnovationHub.of(context)!.theme.mode == "Dark"), ); @@ -272,7 +232,7 @@ class _MihBusinessQrCodeState extends State { return Icon( MihIcons.mihRing, size: profilePictureWidth, - color: MihColors.getSecondaryColor( + color: MihColors.getPrimaryColor( MzansiInnovationHub.of(context)!.theme.mode == "Dark"), );