BUG: Business QR Code Picture Display

This commit is contained in:
2025-10-07 10:38:04 +02:00
parent 04c92804b8
commit ba394e7fea

View File

@@ -89,43 +89,6 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
mimeType: MimeType.png, 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() { void mihLoadingPopUp() {
@@ -139,10 +102,6 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
Future<void> downloadQrCode() async { Future<void> downloadQrCode() async {
if (_isUserSignedIn) { if (_isUserSignedIn) {
// final Uri uri = Uri.parse(getQrCodeData(1024));
// if (!await launchUrl(uri)) {
// throw 'Could not launch $uri';
// }
await screenshotController.capture().then((image) { await screenshotController.capture().then((image) {
KenLogger.success("Image Captured: $image"); KenLogger.success("Image Captured: $image");
setState(() { setState(() {
@@ -244,7 +203,8 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
if (asyncSnapshot.connectionState == if (asyncSnapshot.connectionState ==
ConnectionState.done && ConnectionState.done &&
asyncSnapshot.hasData) { asyncSnapshot.hasData) {
if (asyncSnapshot.requireData != "") { if (asyncSnapshot.requireData != "" ||
asyncSnapshot.requireData.isNotEmpty) {
return MihCircleAvatar( return MihCircleAvatar(
imageFile: NetworkImage(asyncSnapshot.requireData), imageFile: NetworkImage(asyncSnapshot.requireData),
width: profilePictureWidth, width: profilePictureWidth,
@@ -263,7 +223,7 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
return Icon( return Icon(
MihIcons.iDontKnow, MihIcons.iDontKnow,
size: profilePictureWidth, size: profilePictureWidth,
color: MihColors.getSecondaryColor( color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"), "Dark"),
); );
@@ -272,7 +232,7 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
return Icon( return Icon(
MihIcons.mihRing, MihIcons.mihRing,
size: profilePictureWidth, size: profilePictureWidth,
color: MihColors.getSecondaryColor( color: MihColors.getPrimaryColor(
MzansiInnovationHub.of(context)!.theme.mode == MzansiInnovationHub.of(context)!.theme.mode ==
"Dark"), "Dark"),
); );