Files
pangolin/client/lib/widgets/plan_card.dart
T
wangjia 526e7f2f33 feat(tsk_iRa5iBC4v7Tu): Flutter 客户端工程搭建(演示态)
基于 design/flutter/ 起步包在 client/ 下建立 Flutter 工程:

- pubspec.yaml:flutter_svg / lucide_icons / google_fonts 依赖;
  SVG 资产注册;字体由 google_fonts 运行时加载,无需本地 ttf
- lib/pangolin_theme.dart:完整设计令牌(色阶 / 间距 / 圆角 /
  动效 / 文字阶),PangolinText 改用 GoogleFonts getter,
  PangolinTheme.light / .dark 开箱即用
- lib/main.dart:runApp + 明暗主题 + 登录 → 引导 → 主框架 RootFlow
- lib/widgets/:全套组件雏形
    pangolin_icons    Lucide 图标映射
    pangolin_button   胶囊按钮四态
    country_code      国家码块 + 信号条
    status_pill       色点胶囊
    connect_button    核心连接键三态(off/connecting/on + 动画)
    server_tile       服务器列表行
    plan_card         套餐卡(专业版渐变高亮)
    auth_screen       登录 / 注册(邮箱验证码 + 设密码)
    onboarding_screen 首次引导 PageView(3 屏可滑动 + 进度点)
    home_shell        底部 4 Tab(连接/节点/统计/账户 + 状态机)
    account_screens   套餐选择 / 设备管理 / 兑换 / 联系我们
    pangolin_logo     PangolinMark / BrandLockup / AppIcon(SVG)
- assets/:logo-mark / logo-mark-white / logo-wordmark / app-icon(SVG)
- android/:Kotlin 主 Activity + Manifest + Gradle 配置
- ios/:Runner.xcodeproj + xcscheme + Podfile + AppDelegate + storyboard

运行方式(cd client/):
  flutter pub get && flutter run

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 02:15:42 +08:00

111 lines
4.2 KiB
Dart

// plan_card.dart — 套餐卡(免费 / 专业渐变高亮 / 团队)
import 'package:flutter/material.dart';
import '../pangolin_theme.dart';
import 'pangolin_icons.dart';
class PlanCard extends StatelessWidget {
const PlanCard({
super.key,
required this.name,
required this.price,
required this.period,
required this.features,
required this.ctaLabel,
this.featured = false,
this.isCurrent = false,
this.popularLabel,
this.onPressed,
});
final String name, price, period, ctaLabel;
final List<String> features;
final bool featured, isCurrent;
final String? popularLabel;
final VoidCallback? onPressed;
@override
Widget build(BuildContext context) {
final c = context.pangolin;
final onCard = featured ? PangolinColors.white : c.fg1;
final subColor = featured ? PangolinColors.white.withOpacity(0.92) : c.fg2;
final card = Container(
padding: const EdgeInsets.fromLTRB(20, 22, 20, 20),
decoration: BoxDecoration(
gradient: featured
? const LinearGradient(begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [PangolinColors.clay600, PangolinColors.clay800])
: null,
color: featured ? null : c.surface,
border: featured ? null : Border.all(color: c.border),
borderRadius: BorderRadius.circular(PangolinRadius.xl),
boxShadow: featured ? PangolinShadow.md : PangolinShadow.sm,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(name, style: PangolinText.sm.copyWith(color: featured ? PangolinColors.white.withOpacity(0.85) : c.fg2, fontWeight: FontWeight.w600)),
const SizedBox(height: 6),
Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Text(price, style: PangolinText.display.copyWith(color: onCard, fontSize: 30)),
Text(period, style: PangolinText.caption.copyWith(color: subColor, fontSize: 13)),
],
),
const SizedBox(height: 16),
...features.map((f) => Padding(
padding: const EdgeInsets.only(bottom: 9),
child: Row(children: [
Icon(PangolinIcons.check, size: 15, color: featured ? PangolinColors.white : c.success),
const SizedBox(width: 9),
Expanded(child: Text(f, style: PangolinText.sm.copyWith(color: subColor, fontSize: 13))),
]),
)),
const SizedBox(height: 8),
SizedBox(
width: double.infinity,
child: Material(
color: featured ? PangolinColors.white : (isCurrent ? Colors.transparent : c.accent),
shape: StadiumBorder(side: isCurrent ? BorderSide(color: c.borderStrong, width: 1.5) : BorderSide.none),
clipBehavior: Clip.antiAlias,
child: InkWell(
onTap: isCurrent ? null : onPressed,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12),
child: Center(
child: Text(ctaLabel,
style: PangolinText.sm.copyWith(
fontWeight: FontWeight.w700,
fontSize: 14,
color: featured ? PangolinColors.clay700 : (isCurrent ? c.fg2 : PangolinColors.white),
)),
),
),
),
),
),
],
),
);
if (popularLabel == null) return card;
return Stack(clipBehavior: Clip.none, children: [
card,
Positioned(
top: -10,
left: 0,
right: 0,
child: Center(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 11, vertical: 3),
decoration: BoxDecoration(color: PangolinColors.white, borderRadius: BorderRadius.circular(PangolinRadius.full), boxShadow: PangolinShadow.sm),
child: Text(popularLabel!, style: PangolinText.caption.copyWith(color: PangolinColors.clay700, fontWeight: FontWeight.w700, fontSize: 11)),
),
),
),
]);
}
}