|
|
@ -66,112 +66,116 @@ class _FilesBrowserViewState extends State<FilesBrowserView> { |
|
|
|
(FilesSortProperty.isFolder, SortBoxOrder.ascending), |
|
|
|
(FilesSortProperty.isFolder, SortBoxOrder.ascending), |
|
|
|
}, |
|
|
|
}, |
|
|
|
input: files.data, |
|
|
|
input: files.data, |
|
|
|
builder: (final context, final sorted) => NeonListView<Widget>( |
|
|
|
builder: (final context, final sorted) => ValueListenableBuilder( |
|
|
|
scrollKey: 'files-${pathSnapshot.requireData.join('/')}', |
|
|
|
valueListenable: widget.bloc.options.showHiddenFilesOption, |
|
|
|
withFloatingActionButton: true, |
|
|
|
builder: (final context, final showHiddenFiles, final _) => NeonListView<Widget>( |
|
|
|
items: [ |
|
|
|
scrollKey: 'files-${pathSnapshot.requireData.join('/')}', |
|
|
|
for (final uploadTask in tasksSnapshot.requireData.whereType<FilesUploadTask>().where( |
|
|
|
withFloatingActionButton: true, |
|
|
|
(final task) => |
|
|
|
items: [ |
|
|
|
sorted.where((final file) => _pathMatchesFile(task.path, file.name)).isEmpty, |
|
|
|
for (final uploadTask in tasksSnapshot.requireData.whereType<FilesUploadTask>().where( |
|
|
|
)) ...[ |
|
|
|
(final task) => |
|
|
|
FileListTile( |
|
|
|
sorted.where((final file) => _pathMatchesFile(task.path, file.name)).isEmpty, |
|
|
|
bloc: widget.filesBloc, |
|
|
|
)) ...[ |
|
|
|
browserBloc: widget.bloc, |
|
|
|
FileListTile( |
|
|
|
details: FileDetails.fromUploadTask( |
|
|
|
bloc: widget.filesBloc, |
|
|
|
task: uploadTask, |
|
|
|
browserBloc: widget.bloc, |
|
|
|
|
|
|
|
details: FileDetails.fromUploadTask( |
|
|
|
|
|
|
|
task: uploadTask, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
mode: widget.mode, |
|
|
|
), |
|
|
|
), |
|
|
|
mode: widget.mode, |
|
|
|
], |
|
|
|
), |
|
|
|
for (final file in sorted) ...[ |
|
|
|
], |
|
|
|
if ((widget.mode != FilesBrowserMode.selectDirectory || file.isDirectory) && |
|
|
|
for (final file in sorted) ...[ |
|
|
|
(!file.isHidden || showHiddenFiles)) ...[ |
|
|
|
if (widget.mode != FilesBrowserMode.selectDirectory || file.isDirectory) ...[ |
|
|
|
Builder( |
|
|
|
Builder( |
|
|
|
builder: (final context) { |
|
|
|
builder: (final context) { |
|
|
|
final matchingTask = tasksSnapshot.requireData |
|
|
|
final matchingTask = tasksSnapshot.requireData |
|
|
|
.firstWhereOrNull((final task) => _pathMatchesFile(task.path, file.name)); |
|
|
|
.firstWhereOrNull((final task) => _pathMatchesFile(task.path, file.name)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final details = matchingTask != null |
|
|
|
final details = matchingTask != null |
|
|
|
? FileDetails.fromTask( |
|
|
|
? FileDetails.fromTask( |
|
|
|
task: matchingTask, |
|
|
|
task: matchingTask, |
|
|
|
file: file, |
|
|
|
file: file, |
|
|
|
) |
|
|
|
) |
|
|
|
: FileDetails.fromWebDav( |
|
|
|
: FileDetails.fromWebDav( |
|
|
|
file: file, |
|
|
|
file: file, |
|
|
|
path: widget.bloc.path.value, |
|
|
|
path: widget.bloc.path.value, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return FileListTile( |
|
|
|
return FileListTile( |
|
|
|
bloc: widget.filesBloc, |
|
|
|
bloc: widget.filesBloc, |
|
|
|
browserBloc: widget.bloc, |
|
|
|
browserBloc: widget.bloc, |
|
|
|
details: details, |
|
|
|
details: details, |
|
|
|
mode: widget.mode, |
|
|
|
mode: widget.mode, |
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
isLoading: files.isLoading, |
|
|
|
isLoading: files.isLoading, |
|
|
|
error: files.error, |
|
|
|
error: files.error, |
|
|
|
onRefresh: widget.bloc.refresh, |
|
|
|
onRefresh: widget.bloc.refresh, |
|
|
|
builder: (final context, final widget) => widget, |
|
|
|
builder: (final context, final widget) => widget, |
|
|
|
topScrollingChildren: [ |
|
|
|
topScrollingChildren: [ |
|
|
|
Align( |
|
|
|
Align( |
|
|
|
alignment: Alignment.topLeft, |
|
|
|
alignment: Alignment.topLeft, |
|
|
|
child: Container( |
|
|
|
child: Container( |
|
|
|
margin: const EdgeInsets.symmetric( |
|
|
|
margin: const EdgeInsets.symmetric( |
|
|
|
horizontal: 10, |
|
|
|
horizontal: 10, |
|
|
|
), |
|
|
|
), |
|
|
|
child: Wrap( |
|
|
|
child: Wrap( |
|
|
|
crossAxisAlignment: WrapCrossAlignment.center, |
|
|
|
crossAxisAlignment: WrapCrossAlignment.center, |
|
|
|
children: <Widget>[ |
|
|
|
children: <Widget>[ |
|
|
|
IconButton( |
|
|
|
IconButton( |
|
|
|
padding: EdgeInsets.zero, |
|
|
|
padding: EdgeInsets.zero, |
|
|
|
visualDensity: const VisualDensity( |
|
|
|
visualDensity: const VisualDensity( |
|
|
|
horizontal: VisualDensity.minimumDensity, |
|
|
|
horizontal: VisualDensity.minimumDensity, |
|
|
|
vertical: VisualDensity.minimumDensity, |
|
|
|
vertical: VisualDensity.minimumDensity, |
|
|
|
), |
|
|
|
), |
|
|
|
tooltip: AppLocalizations.of(context).goToPath(''), |
|
|
|
tooltip: AppLocalizations.of(context).goToPath(''), |
|
|
|
icon: const Icon( |
|
|
|
icon: const Icon( |
|
|
|
Icons.house, |
|
|
|
Icons.house, |
|
|
|
size: 30, |
|
|
|
size: 30, |
|
|
|
), |
|
|
|
), |
|
|
|
onPressed: () { |
|
|
|
onPressed: () { |
|
|
|
widget.bloc.setPath([]); |
|
|
|
widget.bloc.setPath([]); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
for (var i = 0; i < pathSnapshot.requireData.length; i++) ...[ |
|
|
|
|
|
|
|
Builder( |
|
|
|
|
|
|
|
builder: (final context) { |
|
|
|
|
|
|
|
final path = pathSnapshot.requireData.sublist(0, i + 1); |
|
|
|
|
|
|
|
return Tooltip( |
|
|
|
|
|
|
|
message: AppLocalizations.of(context).goToPath(path.join('/')), |
|
|
|
|
|
|
|
excludeFromSemantics: true, |
|
|
|
|
|
|
|
child: TextButton( |
|
|
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
|
|
widget.bloc.setPath(path); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
child: Text( |
|
|
|
|
|
|
|
pathSnapshot.requireData[i], |
|
|
|
|
|
|
|
semanticsLabel: AppLocalizations.of(context).goToPath(path.join('/')), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
for (var i = 0; i < pathSnapshot.requireData.length; i++) ...[ |
|
|
|
] |
|
|
|
Builder( |
|
|
|
.intersperse( |
|
|
|
builder: (final context) { |
|
|
|
const Icon( |
|
|
|
final path = pathSnapshot.requireData.sublist(0, i + 1); |
|
|
|
Icons.keyboard_arrow_right, |
|
|
|
return Tooltip( |
|
|
|
size: 30, |
|
|
|
message: AppLocalizations.of(context).goToPath(path.join('/')), |
|
|
|
|
|
|
|
excludeFromSemantics: true, |
|
|
|
|
|
|
|
child: TextButton( |
|
|
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
|
|
widget.bloc.setPath(path); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
child: Text( |
|
|
|
|
|
|
|
pathSnapshot.requireData[i], |
|
|
|
|
|
|
|
semanticsLabel: AppLocalizations.of(context).goToPath(path.join('/')), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
.toList(), |
|
|
|
] |
|
|
|
|
|
|
|
.intersperse( |
|
|
|
|
|
|
|
const Icon( |
|
|
|
|
|
|
|
Icons.keyboard_arrow_right, |
|
|
|
|
|
|
|
size: 30, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
.toList(), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|