Showing
1 changed file
with
5 additions
and
2 deletions
| @@ -371,7 +371,7 @@ class _PdfPreviewState extends State<PdfPreview> { | @@ -371,7 +371,7 @@ class _PdfPreviewState extends State<PdfPreview> { | ||
| 371 | Future<void> _print() async { | 371 | Future<void> _print() async { |
| 372 | final result = await Printing.layoutPdf( | 372 | final result = await Printing.layoutPdf( |
| 373 | onLayout: widget.build, | 373 | onLayout: widget.build, |
| 374 | - name: widget.pdfFileName, | 374 | + name: widget.pdfFileName ?? 'Document', |
| 375 | format: pageFormat, | 375 | format: pageFormat, |
| 376 | ); | 376 | ); |
| 377 | 377 | ||
| @@ -392,7 +392,10 @@ class _PdfPreviewState extends State<PdfPreview> { | @@ -392,7 +392,10 @@ class _PdfPreviewState extends State<PdfPreview> { | ||
| 392 | 392 | ||
| 393 | final bytes = await widget.build(pageFormat); | 393 | final bytes = await widget.build(pageFormat); |
| 394 | final result = await Printing.sharePdf( | 394 | final result = await Printing.sharePdf( |
| 395 | - bytes: bytes, bounds: bounds, filename: widget.pdfFileName); | 395 | + bytes: bytes, |
| 396 | + bounds: bounds, | ||
| 397 | + filename: widget.pdfFileName ?? 'document.pdf', | ||
| 398 | + ); | ||
| 396 | 399 | ||
| 397 | if (result && widget.onShared != null) { | 400 | if (result && widget.onShared != null) { |
| 398 | widget.onShared(context); | 401 | widget.onShared(context); |
-
Please register or login to post a comment