feat:拆分组件

This commit is contained in:
2025-07-07 22:55:45 +08:00
parent e2ebe917ac
commit 8058a77bd1
7 changed files with 281 additions and 172 deletions

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:food_hub_app/profile.dart';
import 'package:food_hub_app/record.dart';
import 'package:food_hub_app/views/login.dart';
@@ -19,7 +20,25 @@ class MyApp extends StatelessWidget {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(fontFamily: 'CustomFont', primaryColor: Colors.green),
locale: const Locale('zh', 'CN'),
supportedLocales: const [
Locale('en', 'US'), // 英语
Locale('zh', 'CN'), // 中文
],
// 本地化代理配置
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
// 根据系统语言自动选择Locale
localeResolutionCallback: (locale, supportedLocales) {
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale?.languageCode) {
return supportedLocale;
}
}
return supportedLocales.first;
},
home: LoginPage(),
routes: {
'/home': (context) => MainPage(),