make sftpworker upload/download action handle single file
This commit is contained in:
parent
33ade0479f
commit
075003f1ad
3 changed files with 77 additions and 89 deletions
|
@ -123,17 +123,19 @@ class OperationButtons extends StatelessWidget {
|
|||
onPressed: () async {
|
||||
final downloadsDir = await getDownloadsDirectory();
|
||||
if (downloadsDir == null) return;
|
||||
try {
|
||||
await for (final progress in sftpWorker.downloadFiles(dirEntries, path, downloadsDir.path)) {
|
||||
setDownloadProgress(progress);
|
||||
for (final dirEntry in dirEntries) {
|
||||
try {
|
||||
await for (final progress in sftpWorker.downloadFile(dirEntry, path, downloadsDir.path)) {
|
||||
setDownloadProgress(progress);
|
||||
}
|
||||
}
|
||||
setDownloadProgress(null);
|
||||
}
|
||||
catch (e) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(buildErrorSnackBar(context, e.toString()));
|
||||
catch (e) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(buildErrorSnackBar(context, e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
setDownloadProgress(null);
|
||||
},
|
||||
icon: Icon(Icons.download)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue