new: open sftp with last viewed path
This commit is contained in:
@@ -647,6 +647,12 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
_status.files = fs;
|
||||
});
|
||||
context.pop();
|
||||
|
||||
// Only update history when success
|
||||
if (Stores.setting.sftpOpenLastPath.fetch()) {
|
||||
Stores.history.sftpLastPath.put(widget.spi.id, listPath);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -679,7 +685,14 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
|
||||
@override
|
||||
FutureOr<void> afterFirstLayout(BuildContext context) {
|
||||
_status.path = AbsolutePath(widget.initPath ?? '/');
|
||||
var initPath = '/';
|
||||
if (Stores.setting.sftpOpenLastPath.fetch()) {
|
||||
final history = Stores.history.sftpLastPath.fetch(widget.spi.id);
|
||||
if (history != null) {
|
||||
initPath = history;
|
||||
}
|
||||
}
|
||||
_status.path = AbsolutePath(widget.initPath ?? initPath);
|
||||
_listDir();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user