feat(client): 账户子页 desktop 内容区下钻(档1)

- desktop 上套餐选择/兑换购买/设备管理改为内容区下钻(侧栏保留、shell 顶栏带
  返回箭头),不再全屏 push 盖住侧栏;mobile/tablet 仍全屏 push
- _SubScaffold 加 embedded 参数(true 只返回内容),PlansScreen/DevicesScreen/
  RedeemScreen 透传;NavView 加 devices + kAccountSubViews 集合
- desktop_shell 渲染子页(embedded) + 顶栏 onBack→account;account_page 按
  formFactor 选下钻(切 navView)或 push
- desktop 整页 golden 补 套餐/兑换/设备 三子页(共 8 页)

测试: flutter test 84 通过(+3 子页 golden), analyze 0 error

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-16 12:36:14 +08:00
parent 4886416e8b
commit fe16f89bc3
8 changed files with 51 additions and 14 deletions
+14 -5
View File
@@ -10,15 +10,18 @@ import 'pangolin_button.dart';
import 'pangolin_icons.dart';
import 'plan_card.dart';
/// 通用:带返回箭头的子页骨架
/// 通用:带返回箭头的子页骨架。embedded=true 时只返回内容(desktop 内容区下钻,
/// 返回/标题由外层 shell 顶栏提供),否则整页 Scaffoldmobile/tablet 全屏 push)。
class _SubScaffold extends StatelessWidget {
const _SubScaffold({required this.title, required this.child, this.onBack});
const _SubScaffold({required this.title, required this.child, this.onBack, this.embedded = false});
final String title;
final Widget child;
final VoidCallback? onBack;
final bool embedded;
@override
Widget build(BuildContext context) {
final c = context.pangolin;
if (embedded) return child;
return Scaffold(
backgroundColor: c.bg,
body: SafeArea(
@@ -42,10 +45,11 @@ class _SubScaffold extends StatelessWidget {
/// ── 套餐选择 ──
class PlansScreen extends StatelessWidget {
const PlansScreen({super.key, required this.t, this.onChoose, this.onBack});
const PlansScreen({super.key, required this.t, this.onChoose, this.onBack, this.embedded = false});
final AppText t;
final ValueChanged<String>? onChoose;
final VoidCallback? onBack;
final bool embedded;
@override
Widget build(BuildContext context) {
@@ -57,6 +61,7 @@ class PlansScreen extends StatelessWidget {
return _SubScaffold(
title: t.choosePlan,
onBack: onBack,
embedded: embedded,
child: ListView(
padding: const EdgeInsets.fromLTRB(20, 14, 20, 24),
children: [
@@ -84,9 +89,10 @@ class DeviceItem {
}
class DevicesScreen extends StatefulWidget {
const DevicesScreen({super.key, required this.t, this.onBack});
const DevicesScreen({super.key, required this.t, this.onBack, this.embedded = false});
final AppText t;
final VoidCallback? onBack;
final bool embedded;
@override
State<DevicesScreen> createState() => _DevicesScreenState();
}
@@ -104,6 +110,7 @@ class _DevicesScreenState extends State<DevicesScreen> {
return _SubScaffold(
title: widget.t.myDevices,
onBack: widget.onBack,
embedded: widget.embedded,
child: ListView(padding: const EdgeInsets.fromLTRB(20, 4, 20, 24), children: [
Text(widget.t.devicesSub, style: PangolinText.caption.copyWith(color: c.fg3, fontWeight: FontWeight.w400)),
const SizedBox(height: 12),
@@ -152,9 +159,10 @@ class _DevicesScreenState extends State<DevicesScreen> {
/// ── 兑换 & 购买 ──
class RedeemScreen extends StatefulWidget {
const RedeemScreen({super.key, required this.t, this.onBack});
const RedeemScreen({super.key, required this.t, this.onBack, this.embedded = false});
final AppText t;
final VoidCallback? onBack;
final bool embedded;
@override
State<RedeemScreen> createState() => _RedeemScreenState();
}
@@ -182,6 +190,7 @@ class _RedeemScreenState extends State<RedeemScreen> {
return _SubScaffold(
title: t.redeemTitle,
onBack: widget.onBack,
embedded: widget.embedded,
child: ListView(padding: const EdgeInsets.fromLTRB(20, 4, 20, 24), children: [
Container(
padding: const EdgeInsets.all(18),