mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
fix: builtin editor (#503)
This commit is contained in:
@@ -296,10 +296,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
final subtitle =
|
||||
val.isEmpty ? null : Text(val.keys.join(','), style: UIs.textGrey);
|
||||
return ListTile(
|
||||
leading: const Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(HeroIcons.variable),
|
||||
),
|
||||
leading: const Icon(HeroIcons.variable),
|
||||
subtitle: subtitle,
|
||||
title: Text(l10n.envVars),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||
@@ -388,10 +385,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(MingCute.certificate_line),
|
||||
),
|
||||
leading: const Icon(MingCute.certificate_line),
|
||||
title: Text('PVE ${l10n.ignoreCert}'),
|
||||
subtitle: Text(l10n.pveIgnoreCertTip, style: UIs.text12Grey),
|
||||
trailing: ListenableBuilder(
|
||||
@@ -414,7 +408,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
_customCmds.listenVal(
|
||||
(vals) {
|
||||
return ListTile(
|
||||
leading: const Icon(BoxIcons.bxs_file_json).paddingOnly(left: 10),
|
||||
leading: const Icon(BoxIcons.bxs_file_json),
|
||||
title: const Text('JSON'),
|
||||
subtitle: vals.isEmpty
|
||||
? null
|
||||
@@ -432,10 +426,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
},
|
||||
).cardx,
|
||||
ListTile(
|
||||
leading: const Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(MingCute.doc_line),
|
||||
),
|
||||
leading: const Icon(MingCute.doc_line),
|
||||
title: Text(l10n.doc),
|
||||
trailing: const Icon(Icons.open_in_new, size: 17),
|
||||
onTap: () => l10n.customCmdDocUrl.launch(),
|
||||
@@ -448,10 +439,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
const Text('Wake On LAN', style: UIs.text13Grey),
|
||||
UIs.height7,
|
||||
ListTile(
|
||||
leading: const Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(BoxIcons.bxs_help_circle),
|
||||
),
|
||||
leading: const Icon(BoxIcons.bxs_help_circle),
|
||||
title: Text(l10n.about),
|
||||
subtitle: Text(l10n.wolTip, style: UIs.text12Grey),
|
||||
).cardx,
|
||||
@@ -513,19 +501,13 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
.toList();
|
||||
children.add(ListTile(
|
||||
title: Text(l10n.clear),
|
||||
trailing: const Padding(
|
||||
padding: EdgeInsets.only(right: 13),
|
||||
child: Icon(Icons.clear),
|
||||
),
|
||||
trailing: const Icon(Icons.clear),
|
||||
onTap: () => _jumpServer.value = null,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 17),
|
||||
));
|
||||
return CardX(
|
||||
child: ExpandTile(
|
||||
leading: const Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Icon(Icons.map),
|
||||
),
|
||||
leading: const Icon(Icons.map),
|
||||
initiallyExpanded: _jumpServer.value != null,
|
||||
title: Text(l10n.jumpServer),
|
||||
children: children,
|
||||
|
||||
@@ -114,8 +114,12 @@ class _IOSSettingsPageState extends State<IOSSettingsPage> {
|
||||
final result = await AppRoutes.kvEditor(data: urls).go(context);
|
||||
if (result == null || result is! Map<String, String>) return;
|
||||
|
||||
await context.showLoadingDialog(fn: () async {
|
||||
final suc = await context.showLoadingDialog(fn: () async {
|
||||
await wc.updateApplicationContext({'urls': result});
|
||||
return true;
|
||||
});
|
||||
if (suc == true) {
|
||||
context.showSnackBar(l10n.success);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
import 'package:server_box/data/model/server/server_private_info.dart';
|
||||
import 'package:server_box/data/model/sftp/req.dart';
|
||||
import 'package:server_box/data/model/sftp/worker.dart';
|
||||
import 'package:server_box/data/res/misc.dart';
|
||||
import 'package:server_box/data/res/provider.dart';
|
||||
import 'package:server_box/view/widget/omit_start_text.dart';
|
||||
|
||||
@@ -11,16 +11,16 @@ import 'package:server_box/core/utils/comparator.dart';
|
||||
import 'package:server_box/data/model/server/server_private_info.dart';
|
||||
import 'package:server_box/data/model/sftp/absolute_path.dart';
|
||||
import 'package:server_box/data/model/sftp/browser_status.dart';
|
||||
import 'package:server_box/data/model/sftp/req.dart';
|
||||
import 'package:server_box/data/model/sftp/worker.dart';
|
||||
import 'package:server_box/data/res/misc.dart';
|
||||
import 'package:server_box/data/res/provider.dart';
|
||||
import 'package:server_box/data/res/store.dart';
|
||||
import 'package:server_box/view/widget/omit_start_text.dart';
|
||||
|
||||
import 'package:icons_plus/icons_plus.dart';
|
||||
import 'package:server_box/view/widget/two_line_text.dart';
|
||||
import 'package:server_box/view/widget/unix_perm.dart';
|
||||
|
||||
import 'package:icons_plus/icons_plus.dart';
|
||||
|
||||
class SftpPage extends StatefulWidget {
|
||||
final ServerPrivateInfo spi;
|
||||
final String? initPath;
|
||||
@@ -401,16 +401,10 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
|
||||
final permStr = newPerm.perm;
|
||||
if (ok == true && permStr != perm.perm) {
|
||||
await context.showLoadingDialog(
|
||||
fn: () async {
|
||||
await _client!.run('chmod $permStr "${_getRemotePath(file)}"');
|
||||
await _listDir();
|
||||
},
|
||||
onErr: (e, s) {
|
||||
context.showErrDialog(e: e, s: s, operation: l10n.permission);
|
||||
return false;
|
||||
},
|
||||
);
|
||||
await context.showLoadingDialog(fn: () async {
|
||||
await _client!.run('chmod $permStr "${_getRemotePath(file)}"');
|
||||
await _listDir();
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -758,15 +752,22 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
|
||||
context.showRoundDialog(
|
||||
title: l10n.error,
|
||||
child: Text('Unsupport file: ${name.filename}'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(l10n.ok),
|
||||
),
|
||||
],
|
||||
actions: Btns.oks(onTap: () => context.pop()),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final confirm = await context.showRoundDialog(
|
||||
title: l10n.attention,
|
||||
child: SimpleMarkdown(data: '```sh\n$cmd\n```'),
|
||||
actions: Btns.okCancels(
|
||||
onTapOk: () => context.pop(true),
|
||||
onTapCancel: () => context.pop(false),
|
||||
red: true,
|
||||
),
|
||||
);
|
||||
if (confirm != true) return;
|
||||
|
||||
final suc = await context.showLoadingDialog(
|
||||
fn: () => _client?.run(cmd) ?? Future.value(false),
|
||||
);
|
||||
|
||||
@@ -3,11 +3,10 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
import 'package:server_box/core/route.dart';
|
||||
import 'package:server_box/data/model/sftp/worker.dart';
|
||||
import 'package:server_box/data/provider/sftp.dart';
|
||||
import 'package:server_box/data/res/provider.dart';
|
||||
|
||||
import '../../../data/model/sftp/req.dart';
|
||||
import '../../../data/provider/sftp.dart';
|
||||
|
||||
class SftpMissionPage extends StatefulWidget {
|
||||
const SftpMissionPage({super.key});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user