💄 Optimize file list again

This commit is contained in:
2025-11-18 00:20:10 +08:00
parent c2b18ce10b
commit 0303ef4a93
4 changed files with 140 additions and 76 deletions

View File

@@ -11,12 +11,18 @@ part 'file_list.g.dart';
class CloudFileListNotifier extends _$CloudFileListNotifier
with CursorPagingNotifierMixin<FileListItem> {
String _currentPath = '/';
String? _poolId;
void setPath(String path) {
_currentPath = path;
ref.invalidateSelf();
}
void setPool(String? poolId) {
_poolId = poolId;
ref.invalidateSelf();
}
@override
Future<CursorPagingData<FileListItem>> build() => fetch(cursor: null);
@@ -26,9 +32,15 @@ class CloudFileListNotifier extends _$CloudFileListNotifier
}) async {
final client = ref.read(apiClientProvider);
final queryParameters = <String, String>{'path': _currentPath};
if (_poolId != null) {
queryParameters['pool'] = _poolId!;
}
final response = await client.get(
'/drive/index/browse',
queryParameters: {'path': _currentPath},
queryParameters: queryParameters,
);
final List<String> folders =