Last active
December 6, 2019 07:13
-
-
Save tirth-aubergine/53d563ae4f14f3455e0ee7a7f165ed05 to your computer and use it in GitHub Desktop.
Result Screen - Share
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FlatButton( | |
onPressed: () async { | |
String downloadPath = | |
await getApplicationDocumentsDirectoryPath(); | |
if (File('$downloadPath/$name.pdf').existsSync()) { | |
ShareExtend.share( | |
File('$downloadPath/$name.pdf').path, 'file'); | |
} else { | |
Scaffold.of(context).showSnackBar( | |
SnackBar( | |
content: Text('$name.pdf File Not Found'), | |
action: SnackBarAction( | |
label: 'Download', | |
onPressed: () { | |
pdfGenerator(name); | |
Scaffold.of(context).showSnackBar( | |
SnackBar( | |
content: Text('$name.pdf downloaded'), | |
action: SnackBarAction( | |
label: 'View', | |
onPressed: () async { | |
String downloadPath = | |
await getApplicationDocumentsDirectoryPath(); | |
Navigator.pushNamed( | |
context, '/viewer', arguments: { | |
'view': '$downloadPath/$name.pdf' | |
}); | |
}, | |
), | |
), | |
); | |
}, | |
), | |
), | |
); | |
} | |
}, | |
child: Icon(Icons.share), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment