Files
platforms/apps/user_app/lib/app/app.dart
czl231 3ef33b531d 已完成用户APP首期功能开发
交付用户端首期页面、配套接口、后台资源及测试文档。用户APP构建、静态分析和三个管理后台构建通过;完整测试仍有2项失败,后端模型注释检查未通过,详见交付记录。
2026-09-13 00:57:32 +08:00

51 lines
1.7 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 功能:装配用户端主题与路由,并让桌面 Web 预览保持产品图手机画布宽度。
// 版本1.1.0。
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import '../ui/core/app_theme.dart';
import 'dependencies.dart';
import 'router.dart';
class UserClientApp extends StatefulWidget {
const UserClientApp({required this.dependencies, super.key});
final AppDependencies dependencies;
@override
State<UserClientApp> createState() => _UserClientAppState();
}
class _UserClientAppState extends State<UserClientApp> {
late final _router = createRouter(widget.dependencies);
@override
Widget build(BuildContext context) => MaterialApp.router(
title: '瓶安芯',
// 首期面向中文用户,系统日期与时间控件统一使用简体中文。
locale: const Locale('zh', 'CN'),
supportedLocales: const [Locale('zh', 'CN')],
localizationsDelegates: GlobalMaterialLocalizations.delegates,
debugShowCheckedModeBanner: false,
theme: AppTheme.light(),
darkTheme: AppTheme.dark(),
themeMode: ThemeMode.system,
routerConfig: _router,
builder: (context, child) {
if (!kIsWeb) return child ?? const SizedBox.shrink();
// 产品设计宽853像素按2倍密度绘制Web预览以427 CSS像素展示同一手机画布。
return ColoredBox(
color: const Color(0xFFEFF2F7),
child: Align(
alignment: Alignment.topCenter,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 427),
child: SizedBox(width: double.infinity, child: child),
),
),
);
},
);
}