refactor(client): SubScaffold 六合一(视觉零变化)+ tablet 注释订正 + 平板通知铃入口(#20)
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
// sub_scaffold.dart — 通用「返回箭头 + 标题」子页脚手架(六处收敛,视觉零变化)。
|
||||
//
|
||||
// 收敛自 account_screens.dart/orders_page.dart 的私有 `_SubScaffold`,以及
|
||||
// purchase_page.dart/payment_page.dart/invite_page.dart/notifications_page.dart
|
||||
// 里结构相同的内联等价实现。逐像素沿用原实现(同 padding/字号/图标),纯收敛非重设计。
|
||||
//
|
||||
// embedded=true 时只返回内容(desktop 内容区下钻,返回/标题由外层 shell 顶栏提供);
|
||||
// 否则整页 Scaffold + SafeArea + 返回箭头行(mobile/tablet 全屏 push)。
|
||||
// wrapPageBody=true 时由本组件把 child 套进 PageBody(桌面内容页统一宽度容器);默认
|
||||
// false——调用方若已自行用 PageBody 包裹 child(如购买页需要 wide 变体),避免重复包裹。
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../pangolin_theme.dart';
|
||||
import 'page_body.dart';
|
||||
import 'pangolin_icons.dart';
|
||||
|
||||
class SubScaffold extends StatelessWidget {
|
||||
const SubScaffold({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.child,
|
||||
this.onBack,
|
||||
this.embedded = false,
|
||||
this.wrapPageBody = false,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final Widget child;
|
||||
final VoidCallback? onBack;
|
||||
final bool embedded;
|
||||
final bool wrapPageBody;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final c = context.pangolin;
|
||||
final body = wrapPageBody ? PageBody(child: child) : child;
|
||||
if (embedded) return body;
|
||||
return Scaffold(
|
||||
backgroundColor: c.bg,
|
||||
body: SafeArea(
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 6, 16, 10),
|
||||
child: Row(children: [
|
||||
IconButton(
|
||||
onPressed: onBack ?? () => Navigator.of(context).maybePop(),
|
||||
icon: Icon(PangolinIcons.arrowLeft, size: 22, color: c.fg1),
|
||||
),
|
||||
Text(title, style: PangolinText.h3.copyWith(color: c.fg1, fontWeight: FontWeight.w700)),
|
||||
]),
|
||||
),
|
||||
Expanded(child: body),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user