mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.
- move out btns from more vert btn (docker, sftp & etc.) - redesigned routes - confirmation before deleting private key
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
extension MideaQueryX on MediaQueryData {
|
extension MideaQueryX on MediaQueryData {
|
||||||
bool get isLarge => size.aspectRatio > 0.87 && size.width > 600;
|
bool get useDoubleColumn => size.width > 639;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,35 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:toolbox/core/analysis.dart';
|
import 'package:toolbox/core/analysis.dart';
|
||||||
|
import 'package:toolbox/data/model/server/private_key_info.dart';
|
||||||
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
|
import 'package:toolbox/view/page/backup.dart';
|
||||||
|
import 'package:toolbox/view/page/docker.dart';
|
||||||
|
import 'package:toolbox/view/page/home.dart';
|
||||||
|
import 'package:toolbox/view/page/ping.dart';
|
||||||
|
import 'package:toolbox/view/page/private_key/edit.dart';
|
||||||
|
import 'package:toolbox/view/page/private_key/list.dart';
|
||||||
|
import 'package:toolbox/view/page/server/detail.dart';
|
||||||
|
import 'package:toolbox/view/page/ssh/term.dart';
|
||||||
|
import 'package:toolbox/view/page/ssh/virt_key_setting.dart';
|
||||||
|
import 'package:toolbox/view/page/storage/local.dart';
|
||||||
|
|
||||||
|
import '../data/model/server/snippet.dart';
|
||||||
|
import '../view/page/convert.dart';
|
||||||
|
import '../view/page/debug.dart';
|
||||||
|
import '../view/page/editor.dart';
|
||||||
|
import '../view/page/full_screen.dart';
|
||||||
|
import '../view/page/pkg.dart';
|
||||||
|
import '../view/page/process.dart';
|
||||||
|
import '../view/page/server/edit.dart';
|
||||||
|
import '../view/page/server/tab.dart';
|
||||||
|
import '../view/page/setting.dart';
|
||||||
|
import '../view/page/snippet/edit.dart';
|
||||||
|
import '../view/page/snippet/list.dart';
|
||||||
|
import '../view/page/storage/sftp.dart';
|
||||||
|
import '../view/page/storage/sftp_mission.dart';
|
||||||
import 'utils/ui.dart';
|
import 'utils/ui.dart';
|
||||||
|
|
||||||
class AppRoute {
|
class AppRoute {
|
||||||
@@ -32,4 +58,127 @@ class AppRoute {
|
|||||||
}
|
}
|
||||||
return go(context);
|
return go(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static AppRoute serverDetail({Key? key, required ServerPrivateInfo spi}) {
|
||||||
|
return AppRoute(ServerDetailPage(key: key, spi: spi), 'server_detail');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute serverTab({Key? key}) {
|
||||||
|
return AppRoute(ServerPage(key: key), 'server_tab');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute serverEdit({Key? key, ServerPrivateInfo? spi}) {
|
||||||
|
return AppRoute(
|
||||||
|
ServerEditPage(spi: spi),
|
||||||
|
'server_${spi == null ? 'add' : 'edit'}',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute keyEdit({Key? key, PrivateKeyInfo? pki}) {
|
||||||
|
return AppRoute(
|
||||||
|
PrivateKeyEditPage(pki: pki),
|
||||||
|
'key_${pki == null ? 'add' : 'edit'}',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute keyList({Key? key}) {
|
||||||
|
return AppRoute(PrivateKeysListPage(key: key), 'key_detail');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute snippetEdit({Key? key, Snippet? snippet}) {
|
||||||
|
return AppRoute(
|
||||||
|
SnippetEditPage(snippet: snippet),
|
||||||
|
'snippet_${snippet == null ? 'add' : 'edit'}',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute snippetList({Key? key}) {
|
||||||
|
return AppRoute(SnippetListPage(key: key), 'snippet_detail');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute ssh({
|
||||||
|
Key? key,
|
||||||
|
required ServerPrivateInfo spi,
|
||||||
|
String? initCmd,
|
||||||
|
}) {
|
||||||
|
return AppRoute(
|
||||||
|
SSHPage(
|
||||||
|
key: key,
|
||||||
|
spi: spi,
|
||||||
|
initCmd: initCmd,
|
||||||
|
),
|
||||||
|
'ssh_term',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute sshVirtKeySetting({Key? key}) {
|
||||||
|
return AppRoute(SSHVirtKeySettingPage(key: key), 'ssh_virt_key_setting');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute localStorage({Key? key}) {
|
||||||
|
return AppRoute(LocalStoragePage(key: key), 'local_storage');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute sftpMission({Key? key}) {
|
||||||
|
return AppRoute(SftpMissionPage(key: key), 'sftp_mission');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute sftp(
|
||||||
|
{Key? key,
|
||||||
|
required ServerPrivateInfo spi,
|
||||||
|
String? initPath,
|
||||||
|
bool isSelect = false}) {
|
||||||
|
return AppRoute(
|
||||||
|
SftpPage(
|
||||||
|
key: key,
|
||||||
|
spi: spi,
|
||||||
|
initPath: initPath,
|
||||||
|
selectPath: isSelect,
|
||||||
|
),
|
||||||
|
'sftp');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute backup({Key? key}) {
|
||||||
|
return AppRoute(BackupPage(key: key), 'backup');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute convert({Key? key}) {
|
||||||
|
return AppRoute(ConvertPage(key: key), 'convert');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute debug({Key? key}) {
|
||||||
|
return AppRoute(DebugPage(key: key), 'debug');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute docker({Key? key, required ServerPrivateInfo spi}) {
|
||||||
|
return AppRoute(DockerManagePage(key: key, spi: spi), 'docker');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute editor({Key? key, required String path}) {
|
||||||
|
return AppRoute(EditorPage(key: key, path: path), 'editor');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute fullscreen({Key? key}) {
|
||||||
|
return AppRoute(FullScreenPage(key: key), 'fullscreen');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute home({Key? key}) {
|
||||||
|
return AppRoute(HomePage(key: key), 'home');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute ping({Key? key}) {
|
||||||
|
return AppRoute(PingPage(key: key), 'ping');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute pkg({Key? key, required ServerPrivateInfo spi}) {
|
||||||
|
return AppRoute(PkgPage(key: key, spi: spi), 'pkg');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute process({Key? key, required ServerPrivateInfo spi}) {
|
||||||
|
return AppRoute(ProcessPage(key: key, spi: spi), 'process');
|
||||||
|
}
|
||||||
|
|
||||||
|
static AppRoute setting({Key? key}) {
|
||||||
|
return AppRoute(SettingPage(key: key), 'setting');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:toolbox/core/extension/navigator.dart';
|
|||||||
import 'package:toolbox/core/utils/misc.dart' hide pathJoin;
|
import 'package:toolbox/core/utils/misc.dart' hide pathJoin;
|
||||||
import 'package:toolbox/data/model/app/update.dart';
|
import 'package:toolbox/data/model/app/update.dart';
|
||||||
import 'package:toolbox/data/res/path.dart';
|
import 'package:toolbox/data/res/path.dart';
|
||||||
|
import 'package:toolbox/data/res/ui.dart';
|
||||||
|
|
||||||
import '../data/provider/app.dart';
|
import '../data/provider/app.dart';
|
||||||
import '../data/res/build_data.dart';
|
import '../data/res/build_data.dart';
|
||||||
@@ -125,7 +126,7 @@ Future<void> _doUpdate(AppUpdate update, BuildContext context, S s) async {
|
|||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => context.pop(true),
|
onPressed: () => context.pop(true),
|
||||||
child: Text(s.ok, style: const TextStyle(color: Colors.red)),
|
child: Text(s.ok, style: textRed),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
|
|
||||||
enum ServerTabMenuType {
|
enum ServerTabMenuType {
|
||||||
|
terminal,
|
||||||
sftp,
|
sftp,
|
||||||
snippet,
|
|
||||||
pkg,
|
|
||||||
docker,
|
docker,
|
||||||
process,
|
process,
|
||||||
edit;
|
pkg,
|
||||||
|
snippet,
|
||||||
|
;
|
||||||
|
|
||||||
IconData get icon {
|
IconData get icon {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
@@ -19,31 +20,12 @@ enum ServerTabMenuType {
|
|||||||
return Icons.system_security_update;
|
return Icons.system_security_update;
|
||||||
case ServerTabMenuType.docker:
|
case ServerTabMenuType.docker:
|
||||||
return Icons.view_agenda;
|
return Icons.view_agenda;
|
||||||
case ServerTabMenuType.edit:
|
|
||||||
return Icons.edit;
|
|
||||||
case ServerTabMenuType.process:
|
case ServerTabMenuType.process:
|
||||||
return Icons.list_alt_outlined;
|
return Icons.list_alt_outlined;
|
||||||
|
case ServerTabMenuType.terminal:
|
||||||
|
return Icons.terminal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String text(S s) {
|
|
||||||
switch (this) {
|
|
||||||
case ServerTabMenuType.sftp:
|
|
||||||
return 'SFTP';
|
|
||||||
case ServerTabMenuType.snippet:
|
|
||||||
return s.snippet;
|
|
||||||
case ServerTabMenuType.pkg:
|
|
||||||
return s.pkg;
|
|
||||||
case ServerTabMenuType.docker:
|
|
||||||
return 'Docker';
|
|
||||||
case ServerTabMenuType.edit:
|
|
||||||
return s.edit;
|
|
||||||
case ServerTabMenuType.process:
|
|
||||||
return s.process;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PopupMenuItem<ServerTabMenuType> build(S s) => _build(this, icon, text(s));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DockerMenuType {
|
enum DockerMenuType {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 477;
|
static const int build = 480;
|
||||||
static const String engine = "3.10.6";
|
static const String engine = "3.10.6";
|
||||||
static const String buildAt = "2023-08-17 21:39:55.328086";
|
static const String buildAt = "2023-08-19 23:10:30.475495";
|
||||||
static const int modifications = 14;
|
static const int modifications = 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
/// Font style
|
/// Font style
|
||||||
|
|
||||||
|
const textSize9Grey = TextStyle(color: Colors.grey, fontSize: 9);
|
||||||
const textSize11 = TextStyle(fontSize: 11);
|
const textSize11 = TextStyle(fontSize: 11);
|
||||||
const textSize12Grey = TextStyle(color: Colors.grey, fontSize: 11);
|
const textSize12Grey = TextStyle(color: Colors.grey, fontSize: 11);
|
||||||
const textSize13 = TextStyle(fontSize: 13);
|
const textSize13 = TextStyle(fontSize: 13);
|
||||||
@@ -12,6 +13,7 @@ const textSize18 = TextStyle(fontSize: 18);
|
|||||||
const textSize27 = TextStyle(fontSize: 27);
|
const textSize27 = TextStyle(fontSize: 27);
|
||||||
|
|
||||||
const grey = TextStyle(color: Colors.grey);
|
const grey = TextStyle(color: Colors.grey);
|
||||||
|
const textRed = TextStyle(color: Colors.red);
|
||||||
|
|
||||||
/// Icon
|
/// Icon
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import '../widget/url_text.dart';
|
|||||||
|
|
||||||
class DockerManagePage extends StatefulWidget {
|
class DockerManagePage extends StatefulWidget {
|
||||||
final ServerPrivateInfo spi;
|
final ServerPrivateInfo spi;
|
||||||
const DockerManagePage(this.spi, {Key? key}) : super(key: key);
|
const DockerManagePage({required this.spi, Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<DockerManagePage> createState() => _DockerManagePageState();
|
State<DockerManagePage> createState() => _DockerManagePageState();
|
||||||
@@ -223,10 +223,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: onSubmitted,
|
onPressed: onSubmitted,
|
||||||
child: Text(
|
child: Text(_s.ok, style: textRed),
|
||||||
_s.ok,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -327,10 +324,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(_s.ok, style: textRed),
|
||||||
_s.ok,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import '../../data/model/server/server.dart';
|
|||||||
import '../../data/model/server/server_private_info.dart';
|
import '../../data/model/server/server_private_info.dart';
|
||||||
import '../../data/model/server/server_status.dart';
|
import '../../data/model/server/server_status.dart';
|
||||||
import '../../data/res/color.dart';
|
import '../../data/res/color.dart';
|
||||||
import 'server/detail.dart';
|
|
||||||
import 'server/edit.dart';
|
import 'server/edit.dart';
|
||||||
import 'setting.dart';
|
import 'setting.dart';
|
||||||
|
|
||||||
@@ -163,10 +162,7 @@ class _FullScreenPageState extends State<FullScreenPage> with AfterLayoutMixin {
|
|||||||
final rootDisk = findRootDisk(ss.disk);
|
final rootDisk = findRootDisk(ss.disk);
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => AppRoute(
|
onTap: () => AppRoute.serverDetail(spi: spi).go(context),
|
||||||
ServerDetailPage(spi.id),
|
|
||||||
'server detail page',
|
|
||||||
).go(context),
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import '../widget/custom_appbar.dart';
|
|||||||
import '../widget/round_rect_card.dart';
|
import '../widget/round_rect_card.dart';
|
||||||
import '../widget/two_line_text.dart';
|
import '../widget/two_line_text.dart';
|
||||||
|
|
||||||
class PkgManagePage extends StatefulWidget {
|
class PkgPage extends StatefulWidget {
|
||||||
const PkgManagePage(this.spi, {Key? key}) : super(key: key);
|
const PkgPage({Key? key, required this.spi}) : super(key: key);
|
||||||
|
|
||||||
final ServerPrivateInfo spi;
|
final ServerPrivateInfo spi;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ class PkgManagePage extends StatefulWidget {
|
|||||||
_PkgManagePageState createState() => _PkgManagePageState();
|
_PkgManagePageState createState() => _PkgManagePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PkgManagePageState extends State<PkgManagePage>
|
class _PkgManagePageState extends State<PkgPage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
final _scrollController = ScrollController();
|
final _scrollController = ScrollController();
|
||||||
@@ -122,10 +122,7 @@ class _PkgManagePageState extends State<PkgManagePage>
|
|||||||
child: Text(_s.cancel)),
|
child: Text(_s.cancel)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => onSubmitted(),
|
onPressed: () => onSubmitted(),
|
||||||
child: Text(
|
child: Text(_s.ok, style: textRed),
|
||||||
_s.ok,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -79,20 +79,35 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
PreferredSizeWidget _buildAppBar() {
|
PreferredSizeWidget _buildAppBar() {
|
||||||
final actions = widget.pki == null
|
final actions = [
|
||||||
? null
|
IconButton(
|
||||||
: [
|
tooltip: _s.delete,
|
||||||
IconButton(
|
onPressed: () {
|
||||||
tooltip: _s.delete,
|
showRoundDialog(
|
||||||
|
context: context,
|
||||||
|
title: Text(_s.attention),
|
||||||
|
child: Text(_s.sureDelete(widget.pki!.id)),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_provider.delete(widget.pki!);
|
_provider.delete(widget.pki!);
|
||||||
context.pop();
|
context.pop();
|
||||||
|
context.pop();
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.delete))
|
child: Text(
|
||||||
];
|
_s.ok,
|
||||||
|
style: textRed,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.delete),
|
||||||
|
)
|
||||||
|
];
|
||||||
return CustomAppBar(
|
return CustomAppBar(
|
||||||
title: Text(_s.edit, style: textSize18),
|
title: Text(_s.edit, style: textSize18),
|
||||||
actions: actions,
|
actions: widget.pki == null ? null : actions,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:toolbox/core/extension/navigator.dart';
|
||||||
import 'package:toolbox/core/extension/order.dart';
|
import 'package:toolbox/core/extension/order.dart';
|
||||||
import 'package:toolbox/data/model/server/cpu.dart';
|
import 'package:toolbox/data/model/server/cpu.dart';
|
||||||
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
|
|
||||||
import '../../../core/extension/numx.dart';
|
import '../../../core/extension/numx.dart';
|
||||||
|
import '../../../core/route.dart';
|
||||||
import '../../../data/model/server/net_speed.dart';
|
import '../../../data/model/server/net_speed.dart';
|
||||||
import '../../../data/model/server/server.dart';
|
import '../../../data/model/server/server.dart';
|
||||||
import '../../../data/model/server/server_status.dart';
|
import '../../../data/model/server/server_status.dart';
|
||||||
@@ -18,9 +21,9 @@ import '../../widget/custom_appbar.dart';
|
|||||||
import '../../widget/round_rect_card.dart';
|
import '../../widget/round_rect_card.dart';
|
||||||
|
|
||||||
class ServerDetailPage extends StatefulWidget {
|
class ServerDetailPage extends StatefulWidget {
|
||||||
const ServerDetailPage(this.id, {Key? key}) : super(key: key);
|
const ServerDetailPage({Key? key, required this.spi}) : super(key: key);
|
||||||
|
|
||||||
final String id;
|
final ServerPrivateInfo spi;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ServerDetailPageState createState() => _ServerDetailPageState();
|
_ServerDetailPageState createState() => _ServerDetailPageState();
|
||||||
@@ -62,7 +65,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<ServerProvider>(builder: (_, provider, __) {
|
return Consumer<ServerProvider>(builder: (_, provider, __) {
|
||||||
final s = provider.servers[widget.id];
|
final s = provider.servers[widget.spi.id];
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
@@ -78,6 +81,17 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: CustomAppBar(
|
appBar: CustomAppBar(
|
||||||
title: Text(si.spi.name, style: textSize18),
|
title: Text(si.spi.name, style: textSize18),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.edit),
|
||||||
|
onPressed: () async {
|
||||||
|
final delete = await AppRoute.serverEdit(spi: si.spi).go(context);
|
||||||
|
if (delete == true) {
|
||||||
|
context.pop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: ReorderableListView.builder(
|
body: ReorderableListView.builder(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
|
|||||||
@@ -100,17 +100,10 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
_serverProvider.delServer(widget.spi!.id);
|
_serverProvider.delServer(widget.spi!.id);
|
||||||
context.pop();
|
context.pop();
|
||||||
context.pop();
|
context.pop(true);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(_s.ok, style: textRed),
|
||||||
_s.ok,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
TextButton(
|
|
||||||
onPressed: () => context.pop(),
|
|
||||||
child: Text(_s.cancel),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -30,13 +30,8 @@ import '../../../data/model/app/menu.dart';
|
|||||||
import '../../../data/res/ui.dart';
|
import '../../../data/res/ui.dart';
|
||||||
import '../../../data/store/setting.dart';
|
import '../../../data/store/setting.dart';
|
||||||
import '../../../locator.dart';
|
import '../../../locator.dart';
|
||||||
import '../../widget/popup_menu.dart';
|
|
||||||
import '../../widget/round_rect_card.dart';
|
import '../../widget/round_rect_card.dart';
|
||||||
import '../docker.dart';
|
|
||||||
import '../pkg.dart';
|
|
||||||
import '../storage/sftp.dart';
|
|
||||||
import '../ssh/term.dart';
|
import '../ssh/term.dart';
|
||||||
import 'detail.dart';
|
|
||||||
import 'edit.dart';
|
import 'edit.dart';
|
||||||
|
|
||||||
class ServerPage extends StatefulWidget {
|
class ServerPage extends StatefulWidget {
|
||||||
@@ -49,13 +44,12 @@ class ServerPage extends StatefulWidget {
|
|||||||
class _ServerPageState extends State<ServerPage>
|
class _ServerPageState extends State<ServerPage>
|
||||||
with AutomaticKeepAliveClientMixin, AfterLayoutMixin {
|
with AutomaticKeepAliveClientMixin, AfterLayoutMixin {
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late ThemeData _theme;
|
|
||||||
late ServerProvider _serverProvider;
|
late ServerProvider _serverProvider;
|
||||||
late SettingStore _settingStore;
|
late SettingStore _settingStore;
|
||||||
late S _s;
|
late S _s;
|
||||||
|
|
||||||
String? _tag;
|
String? _tag;
|
||||||
bool _buildGrid = false;
|
bool _useDoubleColumn = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -68,8 +62,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_buildGrid = _media.isLarge;
|
_useDoubleColumn = _media.useDoubleColumn;
|
||||||
_theme = Theme.of(context);
|
|
||||||
_s = S.of(context)!;
|
_s = S.of(context)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,10 +99,10 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
final filtered = _filterServers(pro);
|
final filtered = _filterServers(pro);
|
||||||
if (_buildGrid) {
|
if (_useDoubleColumn) {
|
||||||
return _buildBodyMedium(pro);
|
return _buildBodyMedium(pro);
|
||||||
}
|
}
|
||||||
return _buildBodySmall(pro, filtered);
|
return _buildBodySmall(provider: pro, filtered: filtered);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
@@ -128,10 +121,13 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
_tag == null || (pro.servers[e]?.spi.tags?.contains(_tag) ?? false))
|
_tag == null || (pro.servers[e]?.spi.tags?.contains(_tag) ?? false))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
Widget _buildBodySmall(ServerProvider pro, List<String> filtered) {
|
Widget _buildBodySmall(
|
||||||
|
{required ServerProvider provider,
|
||||||
|
required List<String> filtered,
|
||||||
|
EdgeInsets? padding = const EdgeInsets.fromLTRB(7, 10, 7, 7)}) {
|
||||||
return ReorderableListView.builder(
|
return ReorderableListView.builder(
|
||||||
header: TagSwitcher(
|
header: TagSwitcher(
|
||||||
tags: pro.tags,
|
tags: provider.tags,
|
||||||
width: _media.size.width,
|
width: _media.size.width,
|
||||||
onTagChanged: (p0) => setState(() {
|
onTagChanged: (p0) => setState(() {
|
||||||
_tag = p0;
|
_tag = p0;
|
||||||
@@ -140,9 +136,9 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
all: _s.all,
|
all: _s.all,
|
||||||
),
|
),
|
||||||
footer: const SizedBox(height: 77),
|
footer: const SizedBox(height: 77),
|
||||||
padding: const EdgeInsets.fromLTRB(7, 10, 7, 7),
|
padding: padding,
|
||||||
onReorder: (oldIndex, newIndex) => setState(() {
|
onReorder: (oldIndex, newIndex) => setState(() {
|
||||||
pro.serverOrder.moveByItem(
|
provider.serverOrder.moveByItem(
|
||||||
filtered,
|
filtered,
|
||||||
oldIndex,
|
oldIndex,
|
||||||
newIndex,
|
newIndex,
|
||||||
@@ -153,7 +149,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
itemBuilder: (_, index) => ReorderableDelayedDragStartListener(
|
itemBuilder: (_, index) => ReorderableDelayedDragStartListener(
|
||||||
key: ValueKey('$_tag${filtered[index]}'),
|
key: ValueKey('$_tag${filtered[index]}'),
|
||||||
index: index,
|
index: index,
|
||||||
child: _buildEachServerCard(pro.servers[filtered[index]]),
|
child: _buildEachServerCard(provider.servers[filtered[index]]),
|
||||||
),
|
),
|
||||||
itemCount: filtered.length,
|
itemCount: filtered.length,
|
||||||
);
|
);
|
||||||
@@ -166,10 +162,18 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildBodySmall(pro, left),
|
child: _buildBodySmall(
|
||||||
|
provider: pro,
|
||||||
|
filtered: left,
|
||||||
|
padding: const EdgeInsets.fromLTRB(7, 10, 0, 7),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildBodySmall(pro, right),
|
child: _buildBodySmall(
|
||||||
|
provider: pro,
|
||||||
|
filtered: right,
|
||||||
|
padding: const EdgeInsets.fromLTRB(0, 10, 7, 7),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -184,10 +188,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
key: Key(si.spi.id + (_tag ?? '')),
|
key: Key(si.spi.id + (_tag ?? '')),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (si.state.canViewDetails) {
|
if (si.state.canViewDetails) {
|
||||||
AppRoute(
|
AppRoute.serverDetail(spi: si.spi).go(context);
|
||||||
ServerDetailPage(si.spi.id),
|
|
||||||
'server detail page',
|
|
||||||
).go(context);
|
|
||||||
} else if (si.status.failedInfo != null) {
|
} else if (si.status.failedInfo != null) {
|
||||||
_showFailReason(si.status);
|
_showFailReason(si.status);
|
||||||
}
|
}
|
||||||
@@ -208,26 +209,36 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
) {
|
) {
|
||||||
final rootDisk = findRootDisk(ss.disk);
|
final rootDisk = findRootDisk(ss.disk);
|
||||||
late final List<Widget> children;
|
late final List<Widget> children;
|
||||||
var height = 23.0;
|
double? height;
|
||||||
if (cs != ServerState.finished) {
|
if (cs != ServerState.finished) {
|
||||||
|
height = 23.0;
|
||||||
children = [
|
children = [
|
||||||
_buildServerCardTitle(ss, cs, spi),
|
_buildServerCardTitle(ss, cs, spi),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
height = 137;
|
|
||||||
children = [
|
children = [
|
||||||
_buildServerCardTitle(ss, cs, spi),
|
_buildServerCardTitle(ss, cs, spi),
|
||||||
Row(
|
height13,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
Padding(
|
||||||
children: [
|
padding: const EdgeInsets.symmetric(horizontal: 13),
|
||||||
_buildPercentCircle(ss.cpu.usedPercent()),
|
child: Row(
|
||||||
_buildPercentCircle(ss.mem.usedPercent * 100),
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
_buildNet(ss),
|
children: [
|
||||||
_buildIOData(
|
_buildPercentCircle(ss.cpu.usedPercent()),
|
||||||
'Total:\n${rootDisk?.size}', 'Used:\n${rootDisk?.usedPercent}%')
|
_buildPercentCircle(ss.mem.usedPercent * 100),
|
||||||
],
|
_buildNet(ss),
|
||||||
|
_buildIOData(
|
||||||
|
'Total:\n${rootDisk?.size}',
|
||||||
|
'Used:\n${rootDisk?.usedPercent}%',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height13,
|
||||||
|
SizedBox(
|
||||||
|
height: 29,
|
||||||
|
child: _buildMoreBtn(spi),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 3),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +248,8 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
height: height,
|
height: height,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: children,
|
children: children,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -267,14 +279,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
_buildTopRightText(ss, cs),
|
||||||
children: [
|
|
||||||
_buildTopRightText(ss, cs),
|
|
||||||
width13,
|
|
||||||
_buildSSHBtn(spi),
|
|
||||||
_buildMoreBtn(spi),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -320,81 +325,81 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSSHBtn(ServerPrivateInfo spi) {
|
void _onTapMoreBtns(ServerTabMenuType value, ServerPrivateInfo spi) async {
|
||||||
return GestureDetector(
|
switch (value) {
|
||||||
child: const Icon(Icons.terminal, size: 21),
|
case ServerTabMenuType.pkg:
|
||||||
onTap: () => gotoSSH(spi),
|
AppRoute.pkg(spi: spi).checkClientAndGo(
|
||||||
);
|
context: context,
|
||||||
|
s: _s,
|
||||||
|
id: spi.id,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case ServerTabMenuType.sftp:
|
||||||
|
AppRoute.sftp(spi: spi).checkClientAndGo(
|
||||||
|
context: context,
|
||||||
|
s: _s,
|
||||||
|
id: spi.id,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case ServerTabMenuType.snippet:
|
||||||
|
final provider = locator<SnippetProvider>();
|
||||||
|
final snippets = await showDialog<List<Snippet>>(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => TagPicker<Snippet>(
|
||||||
|
items: provider.snippets,
|
||||||
|
containsTag: (t, tag) => t.tags?.contains(tag) ?? false,
|
||||||
|
tags: provider.tags.toSet(),
|
||||||
|
name: (t) => t.name,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (snippets == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final result = await _serverProvider.runSnippets(spi.id, snippets);
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
showRoundDialog(
|
||||||
|
context: context,
|
||||||
|
title: Text(_s.result),
|
||||||
|
child: Text(result),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => copy2Clipboard(result),
|
||||||
|
child: Text(_s.copy),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ServerTabMenuType.docker:
|
||||||
|
AppRoute.docker(spi: spi).checkClientAndGo(
|
||||||
|
context: context,
|
||||||
|
s: _s,
|
||||||
|
id: spi.id,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case ServerTabMenuType.process:
|
||||||
|
AppRoute(ProcessPage(spi: spi), 'process page').checkClientAndGo(
|
||||||
|
context: context,
|
||||||
|
s: _s,
|
||||||
|
id: spi.id,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case ServerTabMenuType.terminal:
|
||||||
|
gotoSSH(spi);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
||||||
return PopupMenu(
|
return Row(
|
||||||
items: ServerTabMenuType.values.map((e) => e.build(_s)).toList(),
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
children: ServerTabMenuType.values
|
||||||
onSelected: (ServerTabMenuType value) async {
|
.map((e) => IconButton(
|
||||||
switch (value) {
|
onPressed: () => _onTapMoreBtns(e, spi),
|
||||||
case ServerTabMenuType.pkg:
|
padding: EdgeInsets.zero,
|
||||||
AppRoute(PkgManagePage(spi), 'pkg manage').checkClientAndGo(
|
icon: Icon(e.icon, size: 15),
|
||||||
context: context,
|
))
|
||||||
s: _s,
|
.toList(),
|
||||||
id: spi.id,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case ServerTabMenuType.sftp:
|
|
||||||
AppRoute(SftpPage(spi), 'SFTP').checkClientAndGo(
|
|
||||||
context: context,
|
|
||||||
s: _s,
|
|
||||||
id: spi.id,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case ServerTabMenuType.snippet:
|
|
||||||
final provider = locator<SnippetProvider>();
|
|
||||||
final snippets = await showDialog<List<Snippet>>(
|
|
||||||
context: context,
|
|
||||||
builder: (_) => TagPicker<Snippet>(
|
|
||||||
items: provider.snippets,
|
|
||||||
containsTag: (t, tag) => t.tags?.contains(tag) ?? false,
|
|
||||||
tags: provider.tags.toSet(),
|
|
||||||
name: (t) => t.name,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (snippets == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final result = await _serverProvider.runSnippets(spi.id, snippets);
|
|
||||||
if (result != null && result.isNotEmpty) {
|
|
||||||
showRoundDialog(
|
|
||||||
context: context,
|
|
||||||
title: Text(_s.result),
|
|
||||||
child: Text(result),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => copy2Clipboard(result),
|
|
||||||
child: Text(_s.copy),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ServerTabMenuType.edit:
|
|
||||||
AppRoute(ServerEditPage(spi: spi), 'Edit server info').go(context);
|
|
||||||
break;
|
|
||||||
case ServerTabMenuType.docker:
|
|
||||||
AppRoute(DockerManagePage(spi), 'Docker manage').checkClientAndGo(
|
|
||||||
context: context,
|
|
||||||
s: _s,
|
|
||||||
id: spi.id,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case ServerTabMenuType.process:
|
|
||||||
AppRoute(ProcessPage(spi: spi), 'process page').checkClientAndGo(
|
|
||||||
context: context,
|
|
||||||
s: _s,
|
|
||||||
id: spi.id,
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,15 +416,6 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildExplainText(String text) {
|
|
||||||
return Text(
|
|
||||||
text,
|
|
||||||
style: const TextStyle(fontSize: 12),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String _getTopRightStr(
|
String _getTopRightStr(
|
||||||
ServerState cs,
|
ServerState cs,
|
||||||
double? temp,
|
double? temp,
|
||||||
@@ -453,53 +449,51 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIOData(String up, String down) {
|
Widget _buildIOData(String up, String down) {
|
||||||
final statusTextStyle = TextStyle(
|
|
||||||
fontSize: 9, color: _theme.textTheme.bodyLarge!.color!.withAlpha(177));
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 5),
|
const SizedBox(height: 5),
|
||||||
Text(
|
Text(
|
||||||
up,
|
up,
|
||||||
style: statusTextStyle,
|
style: textSize9Grey,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 3),
|
const SizedBox(height: 3),
|
||||||
Text(
|
Text(
|
||||||
down,
|
down,
|
||||||
style: statusTextStyle,
|
style: textSize9Grey,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPercentCircle(double percent) {
|
Widget _buildPercentCircle(double percent) {
|
||||||
if (percent <= 0) percent = 0.01;
|
if (percent <= 0) percent = 0.01;
|
||||||
if (percent >= 100) percent = 99.9;
|
if (percent >= 100) percent = 99.9;
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: CircleChart(
|
child: CircleChart(
|
||||||
progressColor: primaryColor,
|
progressColor: primaryColor,
|
||||||
progressNumber: percent,
|
progressNumber: percent,
|
||||||
maxNumber: 100,
|
maxNumber: 100,
|
||||||
width: 53,
|
width: 53,
|
||||||
height: 53,
|
height: 53,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned.fill(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'${percent.toStringAsFixed(1)}%',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(fontSize: 11),
|
||||||
|
textScaleFactor: 1.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned.fill(
|
),
|
||||||
child: Center(
|
],
|
||||||
child: Text(
|
|
||||||
'${percent.toStringAsFixed(1)}%',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: const TextStyle(fontSize: 11),
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import '../../../data/res/color.dart';
|
|||||||
import '../../../data/res/terminal.dart';
|
import '../../../data/res/terminal.dart';
|
||||||
import '../../../data/store/setting.dart';
|
import '../../../data/store/setting.dart';
|
||||||
import '../../../locator.dart';
|
import '../../../locator.dart';
|
||||||
import '../storage/sftp.dart';
|
|
||||||
|
|
||||||
const echoPWD = 'echo \$PWD';
|
const echoPWD = 'echo \$PWD';
|
||||||
|
|
||||||
@@ -275,8 +274,7 @@ class _SSHPageState extends State<SSHPage> {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final page = SftpPage(widget.spi, initPath: initPath);
|
AppRoute.sftp(spi: widget.spi, initPath: initPath).go(context);
|
||||||
AppRoute(page, 'SSH SFTP').go(context);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import 'package:toolbox/data/provider/sftp.dart';
|
|||||||
import 'package:toolbox/data/res/misc.dart';
|
import 'package:toolbox/data/res/misc.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/page/editor.dart';
|
import 'package:toolbox/view/page/editor.dart';
|
||||||
import 'package:toolbox/view/page/storage/sftp.dart';
|
|
||||||
import 'package:toolbox/view/widget/input_field.dart';
|
import 'package:toolbox/view/widget/input_field.dart';
|
||||||
import 'package:toolbox/view/widget/picker.dart';
|
import 'package:toolbox/view/widget/picker.dart';
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
@@ -312,12 +311,9 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
|||||||
if (spi == null) {
|
if (spi == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final remotePath = await AppRoute(
|
final remotePath = await AppRoute.sftp(
|
||||||
SftpPage(
|
spi: spi,
|
||||||
spi,
|
isSelect: true,
|
||||||
selectPath: true,
|
|
||||||
),
|
|
||||||
'SFTP page (select)',
|
|
||||||
).go<String>(context);
|
).go<String>(context);
|
||||||
if (remotePath == null) {
|
if (remotePath == null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ class SftpPage extends StatefulWidget {
|
|||||||
final String? initPath;
|
final String? initPath;
|
||||||
final bool selectPath;
|
final bool selectPath;
|
||||||
|
|
||||||
const SftpPage(
|
const SftpPage({
|
||||||
this.spi, {
|
|
||||||
Key? key,
|
Key? key,
|
||||||
|
required this.spi,
|
||||||
|
required this.selectPath,
|
||||||
this.initPath,
|
this.initPath,
|
||||||
this.selectPath = false,
|
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -479,10 +479,7 @@ class _SftpPageState extends State<SftpPage> {
|
|||||||
}
|
}
|
||||||
_listDir();
|
_listDir();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(_s.delete, style: textRed),
|
||||||
_s.delete,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -523,10 +520,7 @@ class _SftpPageState extends State<SftpPage> {
|
|||||||
context.pop();
|
context.pop();
|
||||||
_listDir();
|
_listDir();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(_s.ok, style: textRed),
|
||||||
_s.ok,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -569,10 +563,7 @@ class _SftpPageState extends State<SftpPage> {
|
|||||||
context.pop();
|
context.pop();
|
||||||
_listDir();
|
_listDir();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(_s.ok, style: textRed),
|
||||||
_s.ok,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -610,10 +601,7 @@ class _SftpPageState extends State<SftpPage> {
|
|||||||
context.pop();
|
context.pop();
|
||||||
_listDir();
|
_listDir();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(_s.rename, style: textRed),
|
||||||
_s.rename,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user