Showing
2 changed files
with
4 additions
and
5 deletions
@@ -35,9 +35,9 @@ class MyAppState extends State<MyApp> { | @@ -35,9 +35,9 @@ class MyAppState extends State<MyApp> { | ||
35 | } | 35 | } |
36 | 36 | ||
37 | Future<void> _saveAsFile() async { | 37 | Future<void> _saveAsFile() async { |
38 | - Directory appDocDir = await getApplicationDocumentsDirectory(); | ||
39 | - String appDocPath = appDocDir.path; | ||
40 | - File file = File(appDocPath + '/' + 'document.pdf'); | 38 | + final Directory appDocDir = await getApplicationDocumentsDirectory(); |
39 | + final String appDocPath = appDocDir.path; | ||
40 | + final File file = File(appDocPath + '/' + 'document.pdf'); | ||
41 | print('Save as file ${file.path} ...'); | 41 | print('Save as file ${file.path} ...'); |
42 | await file.writeAsBytes((await generateDocument(PdfPageFormat.a4)).save()); | 42 | await file.writeAsBytes((await generateDocument(PdfPageFormat.a4)).save()); |
43 | Navigator.push<dynamic>( | 43 | Navigator.push<dynamic>( |
@@ -75,7 +75,7 @@ class MyAppState extends State<MyApp> { | @@ -75,7 +75,7 @@ class MyAppState extends State<MyApp> { | ||
75 | Printing.layoutPdf(onLayout: (PdfPageFormat format) { | 75 | Printing.layoutPdf(onLayout: (PdfPageFormat format) { |
76 | final pdf.Document document = PdfDoc(); | 76 | final pdf.Document document = PdfDoc(); |
77 | 77 | ||
78 | - final image = PdfImage(document.document, | 78 | + final PdfImage image = PdfImage(document.document, |
79 | image: bytes.buffer.asUint8List(), | 79 | image: bytes.buffer.asUint8List(), |
80 | width: im.width, | 80 | width: im.width, |
81 | height: im.height); | 81 | height: im.height); |
@@ -2,7 +2,6 @@ import 'dart:io'; | @@ -2,7 +2,6 @@ import 'dart:io'; | ||
2 | 2 | ||
3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
4 | import 'package:flutter_full_pdf_viewer/flutter_full_pdf_viewer.dart'; | 4 | import 'package:flutter_full_pdf_viewer/flutter_full_pdf_viewer.dart'; |
5 | -import 'package:flutter_full_pdf_viewer/full_pdf_viewer_plugin.dart'; | ||
6 | import 'package:flutter_full_pdf_viewer/full_pdf_viewer_scaffold.dart'; | 5 | import 'package:flutter_full_pdf_viewer/full_pdf_viewer_scaffold.dart'; |
7 | 6 | ||
8 | class PdfViewer extends StatelessWidget { | 7 | class PdfViewer extends StatelessWidget { |
-
Please register or login to post a comment