💄 File list loading indicator

This commit is contained in:
2025-11-17 23:10:13 +08:00
parent 256024fb46
commit b233f9a410

View File

@@ -62,6 +62,14 @@ class FileListView extends HookConsumerWidget {
if (usage == null) return const SizedBox.shrink();
final isRefreshing = ref.watch(
mode.value == FileListMode.normal
? cloudFileListNotifierProvider.select((value) => value.isLoading)
: unindexedFileListNotifierProvider.select(
(value) => value.isLoading,
),
);
final bodyWidget = switch (mode.value) {
FileListMode.unindexed => PagingHelperSliverView(
provider: unindexedFileListNotifierProvider,
@@ -141,7 +149,10 @@ class FileListView extends HookConsumerWidget {
child: DropdownButton2<SnFilePool>(
value: selectedPool.value,
items: unindexedItems,
onChanged: (value) {
onChanged:
isRefreshing
? null
: (value) {
selectedPool.value = value;
unindexedNotifier.setPool(value?.id);
},
@@ -284,9 +295,7 @@ class FileListView extends HookConsumerWidget {
child: Column(
children: [
const Gap(8),
SizedBox(
height: 64,
child: Card(
Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Row(
@@ -299,7 +308,10 @@ class FileListView extends HookConsumerWidget {
? Symbols.arrow_back
: Symbols.folder,
),
onPressed: () {
onPressed:
isRefreshing
? null
: () {
if (mode.value == FileListMode.unindexed) {
mode.value = FileListMode.normal;
currentPath.value = '/';
@@ -324,7 +336,12 @@ class FileListView extends HookConsumerWidget {
),
),
const Gap(8),
Expanded(child: pathContent),
Expanded(
child: AbsorbPointer(
absorbing: isRefreshing,
child: pathContent,
),
),
IconButton(
icon: Icon(
viewMode.value == FileListViewMode.list
@@ -350,10 +367,8 @@ class FileListView extends HookConsumerWidget {
IconButton(
icon: const Icon(Symbols.create_new_folder),
onPressed:
() => onShowCreateDirectory(
ref.context,
currentPath,
),
() =>
onShowCreateDirectory(ref.context, currentPath),
tooltip: 'Create Directory',
visualDensity: const VisualDensity(
horizontal: -4,
@@ -393,7 +408,10 @@ class FileListView extends HookConsumerWidget {
),
),
).padding(horizontal: 8),
),
if (isRefreshing)
const LinearProgressIndicator(
minHeight: 4,
).padding(horizontal: 16, top: 6, bottom: 4),
const Gap(8),
if (mode.value == FileListMode.normal && currentPath.value == '/')
_buildUnindexedFilesEntry(ref).padding(bottom: 12),