feat(client): pay v2 支付渠道 switch + 订单列表/详情端到端

购买/支付(Phase B):
- 新 SegSwitch 段控 widget(镜像 .segswitch 原子)
- 购买页重构:顶部支付渠道 switch(默认 USDT→加密货币 / 人民币→支付宝),套餐价随渠道分币种显示,删底部弹窗选方式;点购买直达支付页
- 支付页加订单信息卡(套餐/渠道/金额按币种)
- models:PayChannel + PayCatalogItem.priceUsdtMicro/priceLabel(ch)/perMonthLabel(ch)

订单(P0,全新):
- payment_api.listOrders() + orders_provider(列表 + 详情 family)
- OrdersScreen 列表→详情(状态 pill / 可复制订单号 / 继续支付·重新购买)
- 导航:NavView.orders + desktop_shell 分支 + account 入口

配套:
- l10n +19 getter(支付渠道 4 + 订单 15)×6 语言,l10n 闸绿
- 图标单源迁移 lucide_icons_flutter + pangolin_icons.dart(codegen)
- 联系渠道订正(Telegram/邮件 support@yanmeiai.com/官网) + 前端去广告&时长
- 测试:购买 switch 分币种 + 订单列表/空态/详情 + 假 API listOrders;golden 重录
- flutter analyze 0 error,flutter test 226 全绿

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
This commit is contained in:
wangjia
2026-07-12 00:07:15 +08:00
parent f6ce5267d5
commit 272eca04ce
66 changed files with 1398 additions and 262 deletions
+8 -10
View File
@@ -253,7 +253,7 @@ class DevicesScreen extends ConsumerWidget {
iconColor: c.fg3,
items: [
AdaptiveMenuItem(
icon: PangolinIcons.edit,
icon: PangolinIcons.pencil,
label: t.devRename,
onSelected: () async {
final newName = await _renameDialog(context, c, d);
@@ -264,7 +264,7 @@ class DevicesScreen extends ConsumerWidget {
),
if (!isLocal) ...[
AdaptiveMenuItem(icon: PangolinIcons.logOut, label: t.devForceLogout, onSelected: () => confirmAction(isClear: false)),
AdaptiveMenuItem(icon: PangolinIcons.trash, label: t.devClearLogin, danger: true, onSelected: () => confirmAction(isClear: true)),
AdaptiveMenuItem(icon: PangolinIcons.trash2, label: t.devClearLogin, danger: true, onSelected: () => confirmAction(isClear: true)),
],
],
);
@@ -374,10 +374,9 @@ class _RedeemScreenState extends ConsumerState<RedeemScreen> {
final c = context.pangolin;
final t = widget.t;
final channels = [
(icon: PangolinIcons.shoppingBag, name: t.chStore, sub: 'shop.pangolin.vpn', accent: true),
(icon: PangolinIcons.send, name: 'Telegram', sub: '@PangolinVPN_bot', accent: false),
(icon: PangolinIcons.messageCircle, name: 'LINE', sub: '@pangolinvpn', accent: false),
(icon: PangolinIcons.mail, name: t.chEmail, sub: 'buy@pangolin.vpn', accent: false),
(icon: PangolinIcons.send, name: 'Telegram', sub: '@pangolin_app', accent: true),
(icon: PangolinIcons.mail, name: t.chEmail, sub: 'support@yanmeiai.com', accent: false),
(icon: PangolinIcons.globe, name: t.contactWebsite, sub: 'pangolin.yanmeiai.com', accent: false),
];
return _SubScaffold(
title: t.redeemTitle,
@@ -459,10 +458,9 @@ class ContactScreen extends StatelessWidget {
Widget build(BuildContext context) {
final c = context.pangolin;
final channels = [
(icon: PangolinIcons.send, name: 'Telegram', sub: '@PangolinVPN_bot', accent: true),
(icon: PangolinIcons.messageCircle, name: 'LINE', sub: '@pangolinvpn', accent: false),
(icon: PangolinIcons.mail, name: t.contactEmail, sub: 'support@pangolin.vpn', accent: false),
(icon: PangolinIcons.shoppingBag, name: t.contactStore, sub: 'shop.pangolin.vpn', accent: false),
(icon: PangolinIcons.send, name: 'Telegram', sub: '@pangolin_app', accent: true),
(icon: PangolinIcons.mail, name: t.contactEmail, sub: 'support@yanmeiai.com', accent: false),
(icon: PangolinIcons.globe, name: t.contactWebsite, sub: 'pangolin.yanmeiai.com', accent: false),
];
return _SubScaffold(
title: t.contactTitle,
+1 -1
View File
@@ -20,7 +20,7 @@ class BottomTabBar extends ConsumerWidget {
final items = <({IconData icon, String label, NavView view})>[
(icon: PangolinIcons.power, label: t.tabConnect, view: NavView.connect),
(icon: PangolinIcons.globe, label: t.tabServers, view: NavView.servers),
(icon: PangolinIcons.barChart, label: t.tabStats, view: NavView.stats),
(icon: PangolinIcons.chartNoAxesColumn, label: t.tabStats, view: NavView.stats),
(icon: PangolinIcons.user, label: t.tabMe, view: NavView.account),
];
return Container(
+12 -28
View File
@@ -24,19 +24,11 @@ class ConnectButton extends StatefulWidget {
required this.secureLabel,
this.elapsed = Duration.zero,
this.size = 208,
this.enabled = true,
this.onDisabledTap,
});
final VpnPhase phase;
final VoidCallback onTap;
/// 是否可点。免费额度耗尽时置 false → 灰化不可连,点击走 onDisabledTap。
final bool enabled;
/// 灰化态被点击的回调(如弹看广告加时/升级)。enabled=false 时生效。
final VoidCallback? onDisabledTap;
/// off 态圆内文字(如「点击连接」/「CONNECT」)。
final String offLabel;
@@ -63,26 +55,18 @@ class _ConnectButtonState extends State<ConnectButton> with SingleTickerProvider
Widget build(BuildContext context) {
final c = context.pangolin;
final s = widget.phase;
// 免费额度耗尽:off 态灰化不可连(锁图标 + 柔和阴影),点击走 onDisabledTap。
final disabled = !widget.enabled && s == VpnPhase.off;
final Color fill = disabled
? c.bgSubtle
: switch (s) {
VpnPhase.off => c.bgSubtle,
VpnPhase.connecting => c.accent,
VpnPhase.on => c.success,
};
final Color fg = disabled
? c.fg3
: (s == VpnPhase.off ? c.accent : PangolinColors.white);
final IconData icon = disabled
? PangolinIcons.lock
: switch (s) {
VpnPhase.off => PangolinIcons.power,
VpnPhase.connecting => PangolinIcons.loader,
VpnPhase.on => PangolinIcons.shieldCheck,
};
final Color fill = switch (s) {
VpnPhase.off => c.bgSubtle,
VpnPhase.connecting => c.accent,
VpnPhase.on => c.success,
};
final Color fg = s == VpnPhase.off ? c.accent : PangolinColors.white;
final IconData icon = switch (s) {
VpnPhase.off => PangolinIcons.power,
VpnPhase.connecting => PangolinIcons.loaderCircle,
VpnPhase.on => PangolinIcons.shieldCheck,
};
// off 用柔和阴影;connecting/on 增加同色光晕环(box-shadow,不动背景计算)。
final List<BoxShadow> glow = s == VpnPhase.off
@@ -100,7 +84,7 @@ class _ConnectButtonState extends State<ConnectButton> with SingleTickerProvider
button: true,
label: widget.offLabel,
child: GestureDetector(
onTap: disabled ? widget.onDisabledTap : widget.onTap,
onTap: widget.onTap,
child: AnimatedContainer(
duration: PangolinMotion.slow,
curve: PangolinMotion.easeOut,
+59 -73
View File
@@ -1,80 +1,66 @@
// pangolin_icons.dart — Lucide 图标映射表
import 'package:flutter/widgets.dart';
import 'package:lucide_icons/lucide_icons.dart';
// GENERATED by design/codegen/gen_flutter_icons.mjs —— 勿手改;图标真源=design/prototype/icons.js
// 重新生成:node design/codegen/gen_flutter_icons.mjs
import 'package:lucide_icons_flutter/lucide_icons.dart';
class PangolinIcons {
PangolinIcons._();
// ── 连接 / 状态 ──
static const power = LucideIcons.power;
static const shieldCheck = LucideIcons.shieldCheck;
static const shield = LucideIcons.shield;
static const loader = LucideIcons.loader;
static const zap = LucideIcons.zap;
static const globe = LucideIcons.globe;
static const clock = LucideIcons.clock;
static const playCircle = LucideIcons.playCircle;
static const wifi = LucideIcons.wifi;
// ── 导航 / 操作 ──
static const settings = LucideIcons.settings;
static const eye = LucideIcons.eye;
static const eyeOff = LucideIcons.eyeOff;
static const user = LucideIcons.user;
static const search = LucideIcons.search;
static const check = LucideIcons.check;
static const checkCircle = LucideIcons.checkCircle;
static const x = LucideIcons.x;
static const chevronRight = LucideIcons.chevronRight;
static const chevronDown = LucideIcons.chevronDown;
static const arrowLeft = LucideIcons.arrowLeft;
static const arrowUp = LucideIcons.arrowUp;
static const arrowDown = LucideIcons.arrowDown;
static const refreshCw = LucideIcons.refreshCw;
static const compass = LucideIcons.compass;
static const barChart = LucideIcons.barChart;
static const mapPin = LucideIcons.mapPin;
// ── 主题 ──
static const moon = LucideIcons.moon;
static const sun = LucideIcons.sun;
// ── 账户 / 套餐 / 兑换 ──
static const crown = LucideIcons.crown;
static const ticket = LucideIcons.ticket;
static const creditCard = LucideIcons.creditCard;
static const shoppingBag = LucideIcons.shoppingBag;
static const mail = LucideIcons.mail;
static const lock = LucideIcons.lock;
static const logOut = LucideIcons.logOut;
static const send = LucideIcons.send;
static const messageCircle= LucideIcons.messageCircle;
static const layoutDashboard = LucideIcons.layoutDashboard;
static const link = LucideIcons.link;
static const ticket = LucideIcons.ticket;
static const users = LucideIcons.users;
static const copy = LucideIcons.copy;
static const refreshCw = LucideIcons.refreshCw;
static const qrCode = LucideIcons.qrCode;
static const download = LucideIcons.download;
static const check = LucideIcons.check;
static const checkCircle = LucideIcons.checkCircle;
static const zap = LucideIcons.zap;
static const clock = LucideIcons.clock;
static const shieldCheck = LucideIcons.shieldCheck;
static const shield = LucideIcons.shield;
static const crown = LucideIcons.crown;
static const creditCard = LucideIcons.creditCard;
static const send = LucideIcons.send;
static const messageCircle = LucideIcons.messageCircle;
static const mail = LucideIcons.mail;
static const shoppingBag = LucideIcons.shoppingBag;
static const logOut = LucideIcons.logOut;
static const externalLink = LucideIcons.externalLink;
// ── 设备 ──
static const laptop = LucideIcons.laptop;
static const smartphone = LucideIcons.smartphone;
static const monitorSmartphone = LucideIcons.smartphone; // 回退
static const gift = LucideIcons.gift;
static const smartphone = LucideIcons.smartphone;
static const lock = LucideIcons.lock;
static const chevronRight = LucideIcons.chevronRight;
static const arrowDown = LucideIcons.arrowDown;
static const settings = LucideIcons.settings;
static const trash2 = LucideIcons.trash2;
static const monitor = LucideIcons.monitor;
static const key = LucideIcons.key;
static const sun = LucideIcons.sun;
static const moon = LucideIcons.moon;
static const alertTriangle = LucideIcons.alertTriangle;
static const x = LucideIcons.x;
static const power = LucideIcons.power;
static const loaderCircle = LucideIcons.loaderCircle;
static const globe = LucideIcons.globe;
static const user = LucideIcons.user;
static const search = LucideIcons.search;
static const chevronDown = LucideIcons.chevronDown;
static const arrowLeft = LucideIcons.arrowLeft;
static const arrowUp = LucideIcons.arrowUp;
static const arrowRight = LucideIcons.arrowRight;
static const compass = LucideIcons.compass;
static const chartNoAxesColumn = LucideIcons.chartNoAxesColumn;
static const home = LucideIcons.home;
static const mapPin = LucideIcons.mapPin;
static const laptop = LucideIcons.laptop;
static const monitorSmartphone = LucideIcons.monitorSmartphone;
static const playCircle = LucideIcons.playCircle;
static const wifi = LucideIcons.wifi;
static const eye = LucideIcons.eye;
static const eyeOff = LucideIcons.eyeOff;
static const moreVertical = LucideIcons.moreVertical;
static const trash = LucideIcons.trash2;
static const alertTriangle= LucideIcons.alertTriangle;
static const edit = LucideIcons.pencil;
// ── 支付 ──
static const copy = LucideIcons.copy;
static IconData? byName(String name) => _byName[name];
static const Map<String, IconData> _byName = {
'power': power, 'shield-check': shieldCheck, 'shield': shield, 'loader-circle': loader,
'zap': zap, 'globe': globe, 'settings': settings, 'user': user, 'search': search,
'check': check, 'check-circle': checkCircle, 'x': x, 'chevron-right': chevronRight,
'chevron-down': chevronDown, 'arrow-left': arrowLeft, 'arrow-up': arrowUp, 'arrow-down': arrowDown,
'refresh-cw': refreshCw, 'compass': compass, 'chart-no-axes-column': barChart, 'chart': barChart,
'map-pin': mapPin, 'moon': moon, 'sun': sun, 'crown': crown, 'ticket': ticket,
'credit-card': creditCard, 'shopping-bag': shoppingBag, 'mail': mail, 'lock': lock,
'log-out': logOut, 'send': send, 'message-circle': messageCircle, 'external-link': externalLink,
'laptop': laptop, 'smartphone': smartphone, 'monitor-smartphone': monitorSmartphone,
'copy': copy,
};
static const pencil = LucideIcons.pencil;
static const terminal = LucideIcons.terminal;
static const menu = LucideIcons.menu;
}
+80
View File
@@ -0,0 +1,80 @@
// seg_switch.dart — 分段开关(镜像 design/prototype atoms .segswitch)。
// 一排等宽选项,每项 leading 图标 + 文字;选中态 surface 底 + 柔和阴影 + fg1,
// 未选 fg2;容器 bg-subtle + border + full 圆角。渠道/币种/主题等二选一场景通用。
import 'package:flutter/material.dart';
import '../pangolin_theme.dart';
/// 单个分段项:图标 + 文案。
typedef SegOption = ({IconData icon, String label});
class SegSwitch extends StatelessWidget {
const SegSwitch({
super.key,
required this.options,
required this.selectedIndex,
required this.onChanged,
});
final List<SegOption> options;
final int selectedIndex;
final ValueChanged<int> onChanged;
@override
Widget build(BuildContext context) {
final c = context.pangolin;
return Container(
// .segswitch:bg-subtle + border + full 圆角 + space-1 内边距/间隙
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: c.bgSubtle,
border: Border.all(color: c.border),
borderRadius: BorderRadius.circular(PangolinRadius.full),
),
child: Row(
children: [
for (var i = 0; i < options.length; i++) ...[
if (i > 0) const SizedBox(width: 4),
Expanded(child: _opt(c, i, options[i])),
],
],
),
);
}
Widget _opt(PangolinScheme c, int i, SegOption o) {
final active = i == selectedIndex;
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: active ? null : () => onChanged(i),
child: AnimatedContainer(
duration: const Duration(milliseconds: 140),
curve: Curves.easeOut,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
// .segswitch-opt.is-active:surface 底 + shadow-sm;未选透明
color: active ? c.surface : Colors.transparent,
borderRadius: BorderRadius.circular(PangolinRadius.full),
boxShadow: active ? PangolinShadow.sm : null,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(o.icon, size: 16, color: active ? c.fg1 : c.fg2),
const SizedBox(width: 8),
Flexible(
child: Text(
o.label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: PangolinText.sm.copyWith(
color: active ? c.fg1 : c.fg2,
fontWeight: FontWeight.w600,
),
),
),
],
),
),
);
}
}