v2.0.0: 模组插件管理、下载引擎(镜像+队列)、SSH终端、UI改版与依赖仓库

This commit is contained in:
ZV Dev committed 2026-10-22 23:28:14 +08:00
1 parent b8f163aa3a
commit 33d137e33c
29 files changed
+3061 -30

No files matched your search

+10 -10
View File
@@ -87,7 +87,7 @@ class ServerCard extends StatelessWidget {
// 卡片底色跟随主题表面色,浮一层极淡的品牌色,避免纯白/纯黑显得生硬。
final Color base = Color.alphaBlend(
scheme.primary.withValues(alpha: online ? 0.06 : 0.02),
scheme.primary.withOpacity(online ? 0.06 : 0.02),
scheme.surface,
);
@@ -102,13 +102,13 @@ class ServerCard extends StatelessWidget {
color: base,
border: Border.all(
color: online
? scheme.primary.withValues(alpha: 0.38)
: scheme.outlineVariant.withValues(alpha: 0.55),
? scheme.primary.withOpacity(0.38)
: scheme.outlineVariant.withOpacity(0.55),
width: online ? 1.4 : 1,
),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: online ? 0.08 : 0.04),
color: Colors.black.withOpacity(online ? 0.08 : 0.04),
blurRadius: online ? 18 : 10,
offset: const Offset(0, 6),
),
@@ -158,9 +158,9 @@ class ServerCard extends StatelessWidget {
Container(
padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 3),
decoration: BoxDecoration(
color: _statusColor.withValues(alpha: 0.13),
color: _statusColor.withOpacity(0.13),
borderRadius: BorderRadius.circular(20),
border: Border.all(color: _statusColor.withValues(alpha: 0.28)),
border: Border.all(color: _statusColor.withOpacity(0.28)),
),
child: Row(
mainAxisSize: MainAxisSize.min,
@@ -177,7 +177,7 @@ class ServerCard extends StatelessWidget {
Text(
'${latencyMs}ms',
style: theme.textTheme.labelSmall?.copyWith(
color: _statusColor.withValues(alpha: 0.75),
color: _statusColor.withOpacity(0.75),
fontFeatures: const [FontFeature.tabularFigures()],
),
),
@@ -393,7 +393,7 @@ class _StatusDotState extends State<_StatusDot>
color: widget.color,
boxShadow: [
BoxShadow(
color: widget.color.withValues(alpha: glow),
color: widget.color.withOpacity(glow),
blurRadius: 10,
spreadRadius: 3,
),
@@ -422,8 +422,8 @@ class _Pill extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bg = emphasized
? color.withValues(alpha: 0.14)
: color.withValues(alpha: 0.08);
? color.withOpacity(0.14)
: color.withOpacity(0.08);
final content = Container(
padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 5),
@@ -17,6 +17,12 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
late TextEditingController _portCtrl;
late TextEditingController _passCtrl;
bool _obscurePassword = true;
// SSH 可选配置(模组管理 / 终端需要)
bool _sshEnabled = false;
bool _obscureSshPassword = true;
late TextEditingController _sshPortCtrl;
late TextEditingController _sshUserCtrl;
late TextEditingController _sshPasswordCtrl;
bool get isEditing => widget.existingServer != null;
@@ -28,6 +34,10 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
_hostCtrl = TextEditingController(text: s?.host ?? '');
_portCtrl = TextEditingController(text: s?.port.toString() ?? '25575');
_passCtrl = TextEditingController(text: s?.password ?? '');
_sshEnabled = s?.sshEnabled ?? false;
_sshPortCtrl = TextEditingController(text: s?.sshPort.toString() ?? '22');
_sshUserCtrl = TextEditingController(text: s?.sshUser ?? '');
_sshPasswordCtrl = TextEditingController(text: s?.sshPassword ?? '');
}
@override
@@ -36,6 +46,9 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
_hostCtrl.dispose();
_portCtrl.dispose();
_passCtrl.dispose();
_sshPortCtrl.dispose();
_sshUserCtrl.dispose();
_sshPasswordCtrl.dispose();
super.dispose();
}
@@ -60,6 +73,10 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
host: _hostCtrl.text.trim(),
port: int.parse(_portCtrl.text.trim()),
password: _passCtrl.text,
sshEnabled: _sshEnabled,
sshPort: int.tryParse(_sshPortCtrl.text.trim()) ?? 22,
sshUser: _sshUserCtrl.text.trim(),
sshPassword: _sshPasswordCtrl.text,
);
Navigator.pop(context, server);
@@ -111,6 +128,51 @@ class _ServerFormDialogState extends State<ServerFormDialog> {
textInputAction: TextInputAction.done,
onFieldSubmitted: (_) => _submit(),
),
const SizedBox(height: 8),
SwitchListTile(
contentPadding: EdgeInsets.zero,
title: const Text('SSH 连接(可选)'),
subtitle: const Text('用于模组插件管理与远程终端'),
value: _sshEnabled,
onChanged: (v) => setState(() => _sshEnabled = v),
),
if (_sshEnabled) ...[
TextFormField(
controller: _sshPortCtrl,
decoration: const InputDecoration(labelText: 'SSH 端口', hintText: '默认 22'),
keyboardType: TextInputType.number,
validator: (v) {
if (!_sshEnabled) return null;
return _validatePort(v);
},
textInputAction: TextInputAction.next,
),
const SizedBox(height: 12),
TextFormField(
controller: _sshUserCtrl,
decoration: const InputDecoration(labelText: 'SSH 用户名', hintText: '例如 root'),
validator: (v) => _sshEnabled ? _validateRequired(v, 'SSH 用户名') : null,
textInputAction: TextInputAction.next,
),
const SizedBox(height: 12),
TextFormField(
controller: _sshPasswordCtrl,
obscureText: _obscureSshPassword,
decoration: InputDecoration(
labelText: 'SSH 密码',
suffixIcon: IconButton(
icon: Icon(_obscureSshPassword
? Icons.visibility_off_outlined
: Icons.visibility_outlined),
onPressed: () =>
setState(() => _obscureSshPassword = !_obscureSshPassword),
),
),
validator: (v) => _sshEnabled ? _validateRequired(v, 'SSH 密码') : null,
textInputAction: TextInputAction.done,
onFieldSubmitted: (_) => _submit(),
),
],
],
),
),
@@ -265,9 +265,9 @@ class _EmptyState extends StatelessWidget {
height: 84,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: scheme.primary.withValues(alpha: 0.08),
color: scheme.primary.withOpacity(0.08),
border: Border.all(
color: scheme.primary.withValues(alpha: 0.18),
color: scheme.primary.withOpacity(0.18),
),
),
child: Icon(Icons.dns_outlined, size: 36, color: scheme.primary),