|
|
|
@ -43,13 +43,30 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
|
|
|
|
|
@override |
|
|
|
|
Widget build(final BuildContext context) => ResultBuilder<List<WebDavFile>>.behaviorSubject( |
|
|
|
|
stream: widget.bloc.files, |
|
|
|
|
builder: (final context, final files) => StreamBuilder<List<String>>( |
|
|
|
|
builder: (final context, final filesSnapshot) => StreamBuilder<List<String>>( |
|
|
|
|
stream: widget.bloc.path, |
|
|
|
|
builder: (final context, final pathSnapshot) => StreamBuilder<List<FilesTask>>( |
|
|
|
|
stream: widget.filesBloc.tasks, |
|
|
|
|
builder: (final context, final tasksSnapshot) => !pathSnapshot.hasData || !tasksSnapshot.hasData |
|
|
|
|
? const SizedBox() |
|
|
|
|
: BackButtonListener( |
|
|
|
|
builder: (final context, final tasksSnapshot) { |
|
|
|
|
if (!pathSnapshot.hasData || !tasksSnapshot.hasData) { |
|
|
|
|
return const SizedBox(); |
|
|
|
|
} |
|
|
|
|
return ValueListenableBuilder( |
|
|
|
|
valueListenable: widget.bloc.options.showHiddenFilesOption, |
|
|
|
|
builder: (final context, final showHiddenFiles, final _) { |
|
|
|
|
final files = filesSnapshot.data?.where((final file) { |
|
|
|
|
var hideFile = false; |
|
|
|
|
if (widget.mode == FilesBrowserMode.selectDirectory && !file.isDirectory) { |
|
|
|
|
hideFile = true; |
|
|
|
|
} |
|
|
|
|
if (!showHiddenFiles && file.isHidden) { |
|
|
|
|
hideFile = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return !hideFile; |
|
|
|
|
}).toList(); |
|
|
|
|
|
|
|
|
|
return BackButtonListener( |
|
|
|
|
onBackButtonPressed: () async { |
|
|
|
|
final path = pathSnapshot.requireData; |
|
|
|
|
if (path.isNotEmpty) { |
|
|
|
@ -65,10 +82,8 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
|
|
|
|
|
presort: const { |
|
|
|
|
(FilesSortProperty.isFolder, SortBoxOrder.ascending), |
|
|
|
|
}, |
|
|
|
|
input: files.data, |
|
|
|
|
builder: (final context, final sorted) => ValueListenableBuilder( |
|
|
|
|
valueListenable: widget.bloc.options.showHiddenFilesOption, |
|
|
|
|
builder: (final context, final showHiddenFiles, final _) { |
|
|
|
|
input: files, |
|
|
|
|
builder: (final context, final sorted) { |
|
|
|
|
final uploadingTasks = tasksSnapshot.requireData |
|
|
|
|
.whereType<FilesUploadTask>() |
|
|
|
|
.where( |
|
|
|
@ -90,10 +105,7 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
|
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
final file = sorted[index - uploadingTasks.length]; |
|
|
|
|
if ((widget.mode != FilesBrowserMode.selectDirectory || file.isDirectory) && |
|
|
|
|
(!file.isHidden || showHiddenFiles)) { |
|
|
|
|
final matchingTask = tasksSnapshot.requireData |
|
|
|
|
.firstWhereOrNull((final task) => _pathMatchesFile(task.path, file.name)); |
|
|
|
|
|
|
|
|
@ -112,12 +124,9 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
|
|
|
|
|
browserBloc: widget.bloc, |
|
|
|
|
details: details, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
}, |
|
|
|
|
isLoading: files.isLoading, |
|
|
|
|
error: files.error, |
|
|
|
|
isLoading: filesSnapshot.isLoading, |
|
|
|
|
error: filesSnapshot.error, |
|
|
|
|
onRefresh: widget.bloc.refresh, |
|
|
|
|
topScrollingChildren: [ |
|
|
|
|
FilesBrowserNavigator( |
|
|
|
@ -128,8 +137,10 @@ class _FilesBrowserViewState extends State<FilesBrowserView> {
|
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|