feat: switch breadcrumb&path with focus node

Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
Kingtous
2022-08-16 11:46:51 +08:00
parent f89777fa92
commit d9c9365520
2 changed files with 297 additions and 175 deletions

View File

@@ -68,6 +68,22 @@ class FileModel extends ChangeNotifier {
return isLocal ? currentLocalDir : currentRemoteDir;
}
String getCurrentShortPath(bool isLocal) {
final currentDir = getCurrentDir(isLocal);
final currentHome = getCurrentHome(isLocal);
if (currentDir.path.startsWith(currentHome)) {
var path = currentDir.path.replaceFirst(currentHome, "");
if (path.length == 0) return "";
if (path[0] == "/" || path[0] == "\\") {
// remove more '/' or '\'
path = path.replaceFirst(path[0], "");
}
return path;
} else {
return currentDir.path.replaceFirst(currentHome, "");
}
}
String get currentHome => _isLocal ? _localOption.home : _remoteOption.home;
String getCurrentHome(bool isLocal) {