feat:更新记录页面模块

This commit is contained in:
2025-07-06 19:04:30 +08:00
parent bb6874582f
commit ab00d6726f
12 changed files with 518 additions and 165 deletions

View File

@@ -12,7 +12,15 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(debugShowCheckedModeBanner: false, home: MainPage());
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(fontFamily: 'CustomFont', primaryColor: Colors.green),
home: MainPage(),
routes: {
'/home': (context) => MainPage(),
'/new': (context) => NewPage(),
},
);
}
}
@@ -32,14 +40,46 @@ class _mainPage extends State<MainPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("食光集", style: TextStyle(fontSize: 18)),
backgroundColor: Colors.green,
centerTitle: true,
title: Text('Food Hub'),
backgroundColor: Colors.white,
leading: IconButton(
icon: Icon(Icons.menu),
onPressed: () {
// 打开侧边栏或菜单
},
),
actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: () {
// 搜索功能
},
),
IconButton(
icon: Icon(Icons.more_vert),
onPressed: () {
// 更多选项
},
),
],
),
backgroundColor: Color(0xFFF5F5F5),
body: _tabPages[_currentIndex],
floatingActionButton:
_currentIndex == _tabPages.length - 1
? null
: FloatingActionButton(
mini: true,
onPressed: () {
Navigator.pushNamed(context, '/new');
},
backgroundColor: Colors.green,
shape: const CircleBorder(),
child: Icon(Icons.add, color: Colors.white),
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
fixedColor: Colors.green,
iconSize: 25,
type: BottomNavigationBarType.fixed,
items: const [
@@ -58,3 +98,24 @@ class _mainPage extends State<MainPage> {
);
}
}
class NewPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('新页面')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('这是新页面'),
ElevatedButton(
onPressed: () => Navigator.pop(context),
child: Text('返回'),
),
],
),
),
);
}
}