fix(client): 联系/购买渠道卡点击外部打开(修空 onTap)+ 桌面账户子导航复现测试

- channel_launch: @→t.me / 邮箱→mailto / 域名→https,外部打开
- 联系页(桌面)/联系&兑换子页(移动)渠道卡接上 onTap
- account_desktop_nav_test: 证明桌面设置/兑换/联系/订单导航正常(231 全绿)

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 06:54:18 +08:00
parent b30f472d90
commit c3d32a476e
5 changed files with 141 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
// channel_launch.dart — 联系/购买渠道点击:按 handle(sub)推导 URL 并外部打开。
// @xxx → https://t.me/xxx (Telegram)
// a@b.com → mailto:a@b.com
// x.yanmei... → https://x.yanmei...
import 'package:url_launcher/url_launcher.dart';
String channelUrl(String sub) {
if (sub.startsWith('@')) return 'https://t.me/${sub.substring(1)}';
if (sub.contains('@')) return 'mailto:$sub';
return 'https://$sub';
}
/// 点击渠道卡:外部打开对应 URL。失败静默(不炸 UI)。
Future<void> launchChannel(String sub) async {
final uri = Uri.parse(channelUrl(sub));
try {
if (await canLaunchUrl(uri)) {
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
} catch (_) {}
}