f20eddad55
- latency_probe.dart:并行 TCP 握手实测各节点 per-client RTT(服务端无法代知)。 - nodes_provider:解析 /v1/nodes 的 host/port,后台测延迟回填 Node.ping;智能选择 按实测最小;去掉 8 个伪造演示节点(空列表用中性占位,不再伪造服务器)。 - Node:+host/port/copyWith/pingLabel(未测显示 —);各端 ping 显示改 pingLabel。 - account_screens:PlansScreen 接 /v1/plans(价格 priceLabel + me 标当前档); DevicesScreen 接 /v1/me/devices + 移除 DELETE + last_seen;RedeemScreen 接 /v1/redeem(成功刷新 me,失败显示后端文案)。 - stats_page:周柱接 me.weekly_gb,本月流量/时长接 usage(30),延迟用生效节点实测。 - 顺带补登记早前 log_time.dart 的删除(log.dart 重构遗漏 stage)。 flutter analyze 0 error;115 tests passed;受影响 4 golden 重生成。 本机设备高亮 + 真实 device id 随 P6(device_info_plus)落地。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
78 lines
2.3 KiB
Dart
78 lines
2.3 KiB
Dart
// server_tile.dart — 节点列表行(国家码块 · 名称 · 延迟 · 信号条 · 选中态)
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../l10n/app_text.dart';
|
|
import '../models/node.dart';
|
|
import '../pangolin_theme.dart';
|
|
import 'country_code.dart';
|
|
import 'pangolin_icons.dart';
|
|
|
|
class ServerInfo {
|
|
const ServerInfo({
|
|
required this.code,
|
|
required this.name,
|
|
required this.sub,
|
|
required this.ping,
|
|
this.nodeId = '',
|
|
});
|
|
|
|
final String code, name, sub;
|
|
final int ping;
|
|
|
|
/// 控制面节点 ID,对应 POST /v1/nodes/:nodeId/connect 路径参数。
|
|
/// 留空时降级为使用 [code] 小写值(仅限 mock 联调)。
|
|
final String nodeId;
|
|
|
|
String get effectiveNodeId => nodeId.isEmpty ? code.toLowerCase() : nodeId;
|
|
}
|
|
|
|
class ServerTile extends StatelessWidget {
|
|
const ServerTile({
|
|
super.key,
|
|
required this.node,
|
|
required this.lang,
|
|
this.active = false,
|
|
this.onTap,
|
|
});
|
|
|
|
final Node node;
|
|
final AppLang lang;
|
|
final bool active;
|
|
final VoidCallback? onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final c = context.pangolin;
|
|
return InkWell(
|
|
onTap: onTap,
|
|
child: Container(
|
|
color: active ? c.accentSubtle : Colors.transparent,
|
|
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
|
child: Row(
|
|
children: [
|
|
CountryCode(code: node.code, active: active),
|
|
const SizedBox(width: 13),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(node.localizedName(lang),
|
|
style: PangolinText.sm
|
|
.copyWith(color: c.fg1, fontWeight: FontWeight.w600, fontSize: 15)),
|
|
const SizedBox(height: 2),
|
|
Text(node.localizedSub(lang),
|
|
style: PangolinText.caption.copyWith(color: c.fg3, fontWeight: FontWeight.w400)),
|
|
],
|
|
),
|
|
),
|
|
Text(node.pingLabel, style: PangolinText.mono.copyWith(color: c.fg2, fontSize: 12)),
|
|
const SizedBox(width: 8),
|
|
SignalBars(ping: node.ping),
|
|
if (active) ...[const SizedBox(width: 10), Icon(PangolinIcons.check, size: 18, color: c.accent)],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|