|
|
@ -68,21 +68,13 @@ class _FilesBrowserViewState extends State<FilesBrowserView> { |
|
|
|
(final task) => |
|
|
|
(final task) => |
|
|
|
sorted.where((final file) => _pathMatchesFile(task.path, file.name)).isEmpty, |
|
|
|
sorted.where((final file) => _pathMatchesFile(task.path, file.name)).isEmpty, |
|
|
|
)) ...[ |
|
|
|
)) ...[ |
|
|
|
StreamBuilder<double>( |
|
|
|
FileListTile( |
|
|
|
stream: uploadTask.progress, |
|
|
|
context: context, |
|
|
|
builder: (final context, final uploadTaskProgressSnapshot) => |
|
|
|
details: FileDetails.fromUploadTask( |
|
|
|
!uploadTaskProgressSnapshot.hasData |
|
|
|
task: uploadTask, |
|
|
|
? const SizedBox() |
|
|
|
), |
|
|
|
: FileListTile( |
|
|
|
enableFileActions: widget.enableFileActions, |
|
|
|
context: context, |
|
|
|
onPickFile: widget.onPickFile, |
|
|
|
details: FileDetails.fromUploadTask( |
|
|
|
|
|
|
|
task: uploadTask, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
uploadProgress: uploadTaskProgressSnapshot.data, |
|
|
|
|
|
|
|
downloadProgress: null, |
|
|
|
|
|
|
|
enableFileActions: widget.enableFileActions, |
|
|
|
|
|
|
|
onPickFile: widget.onPickFile, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
if (sorted != null) ...[ |
|
|
|
if (sorted != null) ...[ |
|
|
@ -91,39 +83,32 @@ class _FilesBrowserViewState extends State<FilesBrowserView> { |
|
|
|
Builder( |
|
|
|
Builder( |
|
|
|
builder: (final context) { |
|
|
|
builder: (final context) { |
|
|
|
final matchingUploadTasks = uploadTasksSnapshot.requireData |
|
|
|
final matchingUploadTasks = uploadTasksSnapshot.requireData |
|
|
|
.where((final task) => _pathMatchesFile(task.path, file.name)); |
|
|
|
.firstWhereOrNull((final task) => _pathMatchesFile(task.path, file.name)); |
|
|
|
final matchingDownloadTasks = downloadTasksSnapshot.requireData |
|
|
|
final matchingDownloadTasks = downloadTasksSnapshot.requireData |
|
|
|
.where((final task) => _pathMatchesFile(task.path, file.name)); |
|
|
|
.firstWhereOrNull((final task) => _pathMatchesFile(task.path, file.name)); |
|
|
|
|
|
|
|
|
|
|
|
return StreamBuilder<double?>( |
|
|
|
final FileDetails details; |
|
|
|
stream: |
|
|
|
if (matchingDownloadTasks != null) { |
|
|
|
matchingUploadTasks.isNotEmpty ? matchingUploadTasks.first.progress : null, |
|
|
|
details = FileDetails.fromDownloadTask( |
|
|
|
builder: (final context, final uploadTaskProgressSnapshot) => |
|
|
|
task: matchingDownloadTasks, |
|
|
|
StreamBuilder<double?>( |
|
|
|
file: file, |
|
|
|
stream: matchingDownloadTasks.isNotEmpty |
|
|
|
); |
|
|
|
? matchingDownloadTasks.first.progress |
|
|
|
} else if (matchingUploadTasks != null) { |
|
|
|
: null, |
|
|
|
details = FileDetails.fromUploadTask( |
|
|
|
builder: (final context, final downloadTaskProgressSnapshot) { |
|
|
|
task: matchingUploadTasks, |
|
|
|
final path = widget.bloc.path.value; |
|
|
|
); |
|
|
|
final details = matchingUploadTasks.isEmpty |
|
|
|
} else { |
|
|
|
? FileDetails.fromWebDav( |
|
|
|
details = FileDetails.fromWebDav( |
|
|
|
file: file, |
|
|
|
file: file, |
|
|
|
path: path, |
|
|
|
path: widget.bloc.path.value, |
|
|
|
) |
|
|
|
); |
|
|
|
: FileDetails.fromUploadTask( |
|
|
|
} |
|
|
|
task: matchingUploadTasks.first, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return FileListTile( |
|
|
|
return FileListTile( |
|
|
|
context: context, |
|
|
|
context: context, |
|
|
|
details: details, |
|
|
|
details: details, |
|
|
|
uploadProgress: uploadTaskProgressSnapshot.data, |
|
|
|
enableFileActions: widget.enableFileActions, |
|
|
|
downloadProgress: downloadTaskProgressSnapshot.data, |
|
|
|
onPickFile: widget.onPickFile, |
|
|
|
enableFileActions: widget.enableFileActions, |
|
|
|
|
|
|
|
onPickFile: widget.onPickFile, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|