diff --git a/lib/view/page/storage/sftp.dart b/lib/view/page/storage/sftp.dart index 1c0cb79b..af4be49a 100644 --- a/lib/view/page/storage/sftp.dart +++ b/lib/view/page/storage/sftp.dart @@ -88,11 +88,24 @@ class _SftpPageState extends State { ), ], ), - body: _buildFileView(), + body: _buildBody(), bottomNavigationBar: _buildBottom(), ); } + Widget _buildBody() { + return WillPopScope( + onWillPop: () async { + if (_status.path == null || _status.path?.path == '/') { + return true; + } + await _backward(); + return false; + }, + child: _buildFileView(), + ); + } + Widget _buildBottom() { final children = widget.selectPath ? [ @@ -629,6 +642,14 @@ class _SftpPageState extends State { if (fs.isNotEmpty && fs.first.filename == '.') { fs.removeAt(0); } + + /// Issue #96 + /// Due to [WillPopScope] added in this page + /// There is no need to keep '..' folder in listdir + /// So remove it + if (fs.isNotEmpty && fs.first.filename == '..') { + fs.removeAt(0); + } if (mounted) { setState(() { _status.files = fs;