fa9a5c2d5e
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P9G7E3wmAYL9KeYCVZVsqu
21 lines
787 B
Dart
21 lines
787 B
Dart
// page_body.dart — 桌面内容页统一宽度容器(镜像 design/prototype/atoms.css 的 .view-body)。
|
|
// 默认 600 居中;wide=true 840(多列网格页,如购买页)。手机屏宽 < 600 时约束自然不生效,可无条件包。
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
const double kViewMaxW = 600; // atoms.css .view-body
|
|
const double kViewMaxWWide = 840; // atoms.css .view-body.is-wide
|
|
|
|
class PageBody extends StatelessWidget {
|
|
const PageBody({super.key, required this.child, this.wide = false});
|
|
final Widget child;
|
|
final bool wide;
|
|
@override
|
|
Widget build(BuildContext context) => Center(
|
|
child: ConstrainedBox(
|
|
constraints:
|
|
BoxConstraints(maxWidth: wide ? kViewMaxWWide : kViewMaxW),
|
|
child: child,
|
|
),
|
|
);
|
|
}
|