Skip to content

Commit

Permalink
Merge pull request #382 from aeecleclair/fix/filesaver
Browse files Browse the repository at this point in the history
Fix PH filesaver for web
  • Loading branch information
foucblg authored Jun 7, 2024
2 parents 6e90e22 + b51c0d9 commit 812c8b5
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/ph/ui/pages/past_ph_selection_page/ph_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@ class PhList extends HookConsumerWidget {
dataBuilder: (context, pdf) => PhCard(
ph: ph,
onDownload: () async {
final path = await FileSaver.instance.saveAs(
name: ph.name,
bytes: pdf.last,
ext: "pdf",
mimeType: MimeType.pdf,
); // Not yet possible to save directly the file to Download folder
final path = kIsWeb
? await FileSaver.instance.saveFile(
name: ph.name,
bytes: pdf.last,
ext: "pdf",
mimeType: MimeType.pdf,
)
: await FileSaver.instance.saveAs(
name: ph.name,
bytes: pdf.last,
ext: "pdf",
mimeType: MimeType.pdf,
);
if (path != null) {
displayPhToastWithContext(
TypeMsg.msg,
Expand Down

0 comments on commit 812c8b5

Please sign in to comment.