make web version work, add dockerfile

This commit is contained in:
2025-08-04 23:28:58 +02:00
parent fb81499fed
commit d1322d117a
6 changed files with 76 additions and 42 deletions

View File

@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_drawing_board/flutter_drawing_board.dart';
@@ -43,13 +44,21 @@ class _SheetViewerPageState extends State<SheetViewerPage> {
}
Future<bool> loadPdf() async {
var file = await widget.apiClient.getPdfFileCached(widget.sheet.uuid);
if (file == null) {
throw Exception("Failed fetching pdf file");
if (kIsWeb) {
var data = await widget.apiClient.fetchPdfFileData(widget.sheet.uuid);
if (data == null) {
throw Exception("Failed fetching pdf file");
}
document = await PdfDocument.openData(data);
} else {
var file = await widget.apiClient.getPdfFileCached(widget.sheet.uuid);
if (file == null) {
throw Exception("Failed fetching pdf file");
}
document = await PdfDocument.openFile(file.path);
}
document = await PdfDocument.openFile(file.path);
return true;
}