Printing not being loaded fix

This commit is contained in:
Marc Rejohn Castillano 2026-02-24 21:55:03 +08:00
parent 354b27aad1
commit 892fbee456
3 changed files with 15 additions and 43 deletions

View File

@ -757,6 +757,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.20.2" version: "0.20.2"
js:
dependency: transitive
description:
name: js
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
json_annotation: json_annotation:
dependency: transitive dependency: transitive
description: description:
@ -1089,10 +1097,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: printing name: printing
sha256: "482cd5a5196008f984bb43ed0e47cbfdca7373490b62f3b27b3299275bf22a93" sha256: "1c99cab90ebcc1fff65831d264627d5b529359d563e53f33ab9b8117f2d280bc"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.14.2" version: "5.12.0"
proj4dart: proj4dart:
dependency: transitive dependency: transitive
description: description:

View File

@ -24,7 +24,7 @@ dependencies:
flutter_quill: ^11.5.0 flutter_quill: ^11.5.0
file_picker: ^10.3.10 file_picker: ^10.3.10
pdf: ^3.11.3 pdf: ^3.11.3
printing: ^5.14.2 printing: 5.12.0
flutter_keyboard_visibility: ^5.4.1 flutter_keyboard_visibility: ^5.4.1
awesome_snackbar_content: ^0.1.8 awesome_snackbar_content: ^0.1.8
permission_handler: ^12.0.1 permission_handler: ^12.0.1

View File

@ -1,64 +1,28 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.
The path provided below has to start and end with a slash "/" in order for
it to work correctly.
For more details:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`.
-->
<base href="$FLUTTER_BASE_HREF"> <base href="$FLUTTER_BASE_HREF">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible"> <meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project."> <meta name="description" content="A new Flutter project.">
<!-- iOS meta tags & icons -->
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="tasq"> <meta name="apple-mobile-web-app-title" content="tasq">
<link rel="apple-touch-icon" href="icons/Icon-192.png"> <link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/> <link rel="icon" type="image/png" href="favicon.png"/>
<title>tasq</title> <title>tasq</title>
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
<!-- PDF.js and printing support for Flutter Web (required by `printing` package) -->
<!-- Use a pdfjs-dist version compatible with the printing package (API/Worker versions must match) -->
<script src="https://unpkg.com/pdfjs-dist@3.2.146/build/pdf.min.js"></script>
<script src="https://unpkg.com/pdfjs-dist@3.2.146/build/pdf.worker.min.js"></script>
<script> <script>
// Load printing.js only if the file exists to avoid 404/MIME errors in strict browsers. var dartPdfJsVersion = "3.2.146";
(function() { var dartPdfJsBaseUrl = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.2.146/";
var localPath = 'packages/printing/printing.js';
try {
fetch(localPath, { method: 'HEAD' }).then(function(resp) {
var contentType = resp.headers.get('content-type') || '';
if (resp.ok && contentType.indexOf('javascript') !== -1) {
var s = document.createElement('script');
s.src = localPath;
document.head.appendChild(s);
} else {
console.warn('printing.js not found locally; skipping load to avoid 404/MIME errors.');
}
}).catch(function() {
console.warn('Error checking for printing.js; skipping script load.');
});
} catch (e) {
console.warn('Exception while attempting to load printing.js', e);
}
})();
</script> </script>
</head> </head>
<body> <body>
<script src="flutter_bootstrap.js" async></script> <script src="flutter_bootstrap.js" async></script>
</body> </body>
</html> </html>