new & fix

- new: switch of sftp `rm -rf` dir
- fix: sftp upload
- fix: sftp uploading progress
- opt.: editor will save content if is editing file
This commit is contained in:
lollipopkit
2023-08-27 00:10:01 +08:00
parent 65de4a8ca5
commit 7abadfb5a6
18 changed files with 129 additions and 74 deletions

View File

@@ -76,7 +76,18 @@ class _EditorPageState extends State<EditorPage> with AfterLayoutMixin {
body: _buildBody(),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.done),
onPressed: () {
onPressed: () async {
// If path is not null, then it's a file editor
// save the text and return true to pop the page
if (widget.path != null) {
showLoadingDialog(context);
await File(widget.path!).writeAsString(_controller.text);
context.pop();
context.pop(true);
return;
}
// else it's a text editor
// return the text to the previous page
context.pop(_controller.text);
},
),