This commit is contained in:
lollipopkit
2023-08-05 21:19:19 +08:00
parent 7431de094f
commit 7f35ddfe30

View File

@@ -88,11 +88,24 @@ class _SftpPageState extends State<SftpPage> {
),
],
),
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<SftpPage> {
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;