ui细节优化

This commit is contained in:
Developer
2026-04-01 04:45:33 +08:00
parent 6517a78c7e
commit 79f7269319
23 changed files with 3299 additions and 885 deletions

View File

@@ -5,6 +5,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import '../../../constants/app_constants.dart';
import '../../../utils/http/http_client.dart';
import 'user-plan.dart';
import '../components/server_info_dialog.dart';
/// 时间: 2026-03-29
/// 功能: 离线数据管理页面
@@ -504,95 +505,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
}
void _displayServerInfoDialog(Map<String, dynamic> data) {
final server = data['server'] as Map<String, dynamic>?;
final network = data['network'] as Map<String, dynamic>?;
final timestamp = data['timestamp'] as Map<String, dynamic>?;
final load = server?['load'] as Map<String, dynamic>?;
final latency = network?['latency'] as List<dynamic>?;
final serverResponseTime = network?['server_response_time'];
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Row(
children: [
Icon(Icons.cloud, color: AppConstants.primaryColor, size: 20),
const SizedBox(width: 8),
const Text('服务器信息', style: TextStyle(fontSize: 18)),
],
),
content: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const Text(
'广州 server-ls',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
const SizedBox(height: 12),
_buildInfoSection('⏰ 服务器时间', timestamp?['datetime'] ?? '--'),
const SizedBox(height: 12),
_buildInfoSection(
'📊 服务器负载',
'1分钟: ${load?['1min'] ?? '--'} | 5分钟: ${load?['5min'] ?? '--'} | 15分钟: ${load?['15min'] ?? '--'}',
),
const SizedBox(height: 12),
_buildInfoSection(
'⚡ 服务器响应',
'${serverResponseTime ?? '--'} ms',
),
const SizedBox(height: 16),
const Text(
'🌐 网络延迟',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
),
const SizedBox(height: 8),
if (latency != null)
...latency.map<Widget>((item) {
final host = item['host'] as String?;
final ip = item['ip'] as String?;
final lat = item['latency'];
final status = item['status'] as String?;
return Padding(
padding: const EdgeInsets.only(bottom: 4),
child: Text(
'$host ($ip): ${status == 'online' ? '$lat ms' : '离线'}',
style: const TextStyle(
fontSize: 12,
color: Colors.grey,
),
),
);
}).toList(),
],
),
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('关闭'),
),
],
);
},
);
}
Widget _buildInfoSection(String title, String content) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
),
const SizedBox(height: 4),
Text(content, style: const TextStyle(fontSize: 12, color: Colors.grey)),
],
);
ServerInfoDialog.show(context, data: data);
}
@override