This commit is contained in:
PhyoThandar
2020-06-25 09:06:01 +06:30
parent 7d69f8ee70
commit d894b506bb
6 changed files with 48 additions and 42 deletions

View File

@@ -41,11 +41,11 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
_invoice = widget.invoice;
}
fromAsset('assets/demo.pdf', 'demo.pdf').then((f) {
setState(() {
pdfPath = f.path;
});
});
// fromAsset('assets/demo.pdf', 'demo.pdf').then((f) {
// setState(() {
// pdfPath = f.path;
// });
// });
}
Future<File> fromAsset(String asset, String filename) async {
@@ -62,7 +62,7 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
await file.writeAsBytes(bytes, flush: true);
completer.complete(file);
} catch (e) {
throw Exception('Error parsing asset file!'+ e.toString());
throw Exception('Error parsing asset file! ===> ' + e.toString());
}
return completer.future;
@@ -78,9 +78,10 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
owner
? Navigator.of(context)
.push(BottomUpPageRoute(InvoiceEditor(invoice: _invoice)))
: Navigator.of(context).push(BottomUpPageRoute(PaymentPDFScreen(
path: pdfPath,
)));
: Navigator.pop(context);
// Navigator.of(context).push(BottomUpPageRoute(PaymentPDFScreen(
// path: pdfPath,
// )));
},
child: Row(
children: <Widget>[
@@ -167,7 +168,18 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
return CupertinoActionSheet(
actions: <Widget>[
CupertinoActionSheetAction(
child: Text("Download"),
child: Row(
children: <Widget>[
Icon(Icons.file_download),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
'Download',
style: TextStyle(fontSize: 16, color: Colors.black),
),
),
],
),
onPressed: () {
Navigator.pop(context);
},