mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-01-13 20:44:32 +01:00
feat(local file page): Display server names for server folders (#996)
* feat(local file page): Display server names for server folders In the local file list, server folders will display their corresponding server names, enhancing the user experience. * fix(storage page): Use ref.read instead of ref.watch to fetch the server list Avoid unnecessary watch operations during construction, reducing potential performance overhead
This commit is contained in:
@@ -140,11 +140,23 @@ class _LocalFilePageState extends ConsumerState<LocalFilePage> with AutomaticKee
|
||||
required FileStat stat,
|
||||
required bool isDir,
|
||||
}) {
|
||||
final isServerFolder = isDir && file.parent.path == Paths.file;
|
||||
String? serverName;
|
||||
if (isServerFolder) {
|
||||
final servers = ref.read(serversProvider).servers;
|
||||
final server = servers[fileName];
|
||||
if (server != null) {
|
||||
serverName = server.name;
|
||||
}
|
||||
}
|
||||
|
||||
return CardX(
|
||||
child: ListTile(
|
||||
leading: isDir ? const Icon(Icons.folder_open) : const Icon(Icons.insert_drive_file),
|
||||
title: Text(fileName),
|
||||
subtitle: isDir ? null : Text(stat.size.bytes2Str, style: UIs.textGrey),
|
||||
title: Text(serverName ?? fileName),
|
||||
subtitle: isDir
|
||||
? (serverName != null ? Text(fileName, style: UIs.textGrey) : null)
|
||||
: Text(stat.size.bytes2Str, style: UIs.textGrey),
|
||||
trailing: Text(stat.modified.ymdhms(), style: UIs.textGrey),
|
||||
onLongPress: () {
|
||||
if (isDir) {
|
||||
|
||||
Reference in New Issue
Block a user