Fixed report rendering in web

This commit is contained in:
2026-05-14 22:08:15 +08:00
parent e9d1af867a
commit 4b9b0c7a20
+1 -5
View File
@@ -1,4 +1,3 @@
import 'dart:isolate';
import 'dart:typed_data';
import 'dart:ui' as ui;
@@ -72,8 +71,7 @@ class ReportPdfExport {
final generated = AppTime.formatDate(AppTime.now());
final dateLabel = dateRange.label;
// ── Build the PDF on a background isolate so it doesn't freeze the UI ──
return Isolate.run(() {
// ── Build the PDF on the main thread (dart:isolate is not supported on web) ──
return _buildPdfBytes(
chartImages: chartImages,
dateRangeText: dateRangeText,
@@ -83,11 +81,9 @@ class ReportPdfExport {
boldFontData: boldFontData.buffer.asUint8List(),
logoBytes: logoBytes,
);
});
}
/// Pure function that assembles the PDF document from raw data.
/// Designed to run inside [Isolate.run].
static Future<Uint8List> _buildPdfBytes({
required Map<String, Uint8List> chartImages,
required String dateRangeText,