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:
@@ -2,9 +2,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../core/responsive/form_factor.dart';
|
||||
import '../l10n/app_text.dart';
|
||||
import '../pangolin_theme.dart';
|
||||
import '../state/app_providers.dart';
|
||||
import '../state/navigation_provider.dart';
|
||||
import '../widgets/account_screens.dart';
|
||||
import '../widgets/app_top_bar.dart';
|
||||
import '../widgets/pangolin_icons.dart';
|
||||
@@ -24,13 +26,20 @@ class AccountPage extends ConsumerWidget {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final pad = isWide ? 28.0 : 20.0;
|
||||
|
||||
void push(Widget page) =>
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (_) => page));
|
||||
// desktop 在内容区下钻(切 navView);mobile/tablet 全屏 push。
|
||||
final isDesktop = context.formFactor == FormFactor.desktop;
|
||||
void open(NavView v, Widget mobilePage) {
|
||||
if (isDesktop) {
|
||||
ref.read(navViewProvider.notifier).state = v;
|
||||
} else {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (_) => mobilePage));
|
||||
}
|
||||
}
|
||||
|
||||
final body = ListView(
|
||||
padding: EdgeInsets.fromLTRB(pad, isWide ? 6 : 0, pad, 24),
|
||||
children: [
|
||||
_PlanBanner(t: t, isFree: isFree, onUpgrade: () => push(PlansScreen(t: t))),
|
||||
_PlanBanner(t: t, isFree: isFree, onUpgrade: () => open(NavView.plans, PlansScreen(t: t))),
|
||||
const SizedBox(height: 18),
|
||||
// 账户信息
|
||||
_SectionLabel(text: t.accInfoTitle),
|
||||
@@ -42,11 +51,11 @@ class AccountPage extends ConsumerWidget {
|
||||
const SizedBox(height: 16),
|
||||
// 设备 / 兑换 / 联系
|
||||
_Card(children: [
|
||||
_NavRow(icon: PangolinIcons.monitorSmartphone, title: t.myDevices, onTap: () => push(DevicesScreen(t: t))),
|
||||
_NavRow(icon: PangolinIcons.monitorSmartphone, title: t.myDevices, onTap: () => open(NavView.devices, DevicesScreen(t: t))),
|
||||
Divider(height: 1, color: c.border),
|
||||
_NavRow(icon: PangolinIcons.shoppingBag, title: t.redeemEntry, onTap: () => push(RedeemScreen(t: t))),
|
||||
_NavRow(icon: PangolinIcons.shoppingBag, title: t.redeemEntry, onTap: () => open(NavView.redeem, RedeemScreen(t: t))),
|
||||
Divider(height: 1, color: c.border),
|
||||
_NavRow(icon: PangolinIcons.messageCircle, title: t.contactEntry, onTap: () => push(ContactScreen(t: t))),
|
||||
_NavRow(icon: PangolinIcons.messageCircle, title: t.contactEntry, onTap: () => open(NavView.contact, ContactScreen(t: t))),
|
||||
]),
|
||||
const SizedBox(height: 16),
|
||||
// 语言 / 主题 / 协议
|
||||
|
||||
Reference in New Issue
Block a user