mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
opt.: sftp rename
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 575;
|
||||
static const int build = 577;
|
||||
static const String engine = "3.13.5";
|
||||
static const String buildAt = "2023-09-24 15:59:57";
|
||||
static const int modifications = 13;
|
||||
static const int script = 18;
|
||||
static const String buildAt = "2023-09-25 18:52:38";
|
||||
static const int modifications = 3;
|
||||
static const int script = 19;
|
||||
}
|
||||
|
||||
@@ -100,23 +100,6 @@ class _EditorPageState extends State<EditorPage> {
|
||||
backgroundColor: _codeTheme['root']?.backgroundColor,
|
||||
appBar: _buildAppBar(),
|
||||
body: _buildBody(),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.done),
|
||||
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) {
|
||||
context.showLoadingDialog();
|
||||
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);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -130,6 +113,7 @@ class _EditorPageState extends State<EditorPage> {
|
||||
actions: [
|
||||
PopupMenuButton<String>(
|
||||
icon: const Icon(Icons.language),
|
||||
tooltip: l10n.language,
|
||||
onSelected: (value) {
|
||||
_controller.language = Highlights.all[value];
|
||||
_langCode = value;
|
||||
@@ -143,6 +127,24 @@ class _EditorPageState extends State<EditorPage> {
|
||||
);
|
||||
}).toList();
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.save),
|
||||
tooltip: l10n.save,
|
||||
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) {
|
||||
context.showLoadingDialog();
|
||||
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);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
@@ -366,7 +366,7 @@ class _HomePageState extends State<HomePage>
|
||||
text: text,
|
||||
langCode: 'json',
|
||||
title: l10n.setting,
|
||||
).go(context);
|
||||
).go<String>(context);
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
|
||||
text: text,
|
||||
langCode: 'json',
|
||||
title: 'Watch app',
|
||||
).go(context);
|
||||
).go<String>(context);
|
||||
if (result == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -245,10 +245,8 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
}
|
||||
final result = await AppRoute.editor(
|
||||
path: file.absolute.path,
|
||||
).go<String>(context);
|
||||
final f = File(file.absolute.path);
|
||||
if (result != null) {
|
||||
f.writeAsString(result);
|
||||
).go<bool>(context);
|
||||
if (result == true) {
|
||||
context.showSnackBar(l10n.saved);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
|
||||
void _rename(SftpName file) {
|
||||
context.pop();
|
||||
final textController = TextEditingController();
|
||||
final textController = TextEditingController(text: file.filename);
|
||||
context.showRoundDialog(
|
||||
title: Text(l10n.rename),
|
||||
child: Input(
|
||||
|
||||
@@ -49,4 +49,4 @@ class OmitStartText extends StatelessWidget {
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user