💄 Add go to previous path action in path nav in file list

This commit is contained in:
2025-11-15 16:25:24 +08:00
parent 5f2f083d72
commit ea8e7ead2d

View File

@@ -374,13 +374,26 @@ class FileListView extends HookConsumerWidget {
icon: Icon( icon: Icon(
mode.value == FileListMode.unindexed mode.value == FileListMode.unindexed
? Symbols.inventory_2 ? Symbols.inventory_2
: currentPath.value != '/'
? Symbols.arrow_back
: Symbols.folder, : Symbols.folder,
), ),
onPressed: () { onPressed: () {
if (mode.value == FileListMode.unindexed) { if (mode.value == FileListMode.unindexed) {
mode.value = FileListMode.normal; mode.value = FileListMode.normal;
currentPath.value = '/';
} else {
final pathParts =
currentPath.value
.split('/')
.where((part) => part.isNotEmpty)
.toList();
if (pathParts.isNotEmpty) {
pathParts.removeLast();
currentPath.value =
pathParts.isEmpty ? '/' : '/${pathParts.join('/')}';
}
} }
currentPath.value = '/';
}, },
visualDensity: const VisualDensity( visualDensity: const VisualDensity(
horizontal: -4, horizontal: -4,