 6c64c86239
			
		
	
	
		6c64c86239
		
	
	
	
	
		
			
			- 添加 .gitignore 文件,配置项目忽略项 - 创建 .metadata 文件,记录项目元数据 - 编写 README.md,介绍项目基本信息 - 配置 analysis_options.yaml,设置代码分析规则 - 创建 Android 相关文件和目录结构 - 创建 iOS 相关文件和目录结构
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:flutter/material.dart';
 | |
| import 'package:item_tracker/screens/item_list_screen.dart';
 | |
| import 'package:item_tracker/screens/statistics_screen.dart';
 | |
| import 'package:item_tracker/screens/my_screen.dart'; // 新增导入
 | |
| 
 | |
| class HomeScreen extends StatefulWidget {
 | |
|   @override
 | |
|   _HomeScreenState createState() => _HomeScreenState();
 | |
| }
 | |
| 
 | |
| class _HomeScreenState extends State<HomeScreen> {
 | |
|   int _selectedIndex = 0;
 | |
|   static List<Widget> _widgetOptions = <Widget>[
 | |
|     ItemListScreen(), 
 | |
|     StatisticsScreen(),
 | |
|     MyScreen(),
 | |
|   ];
 | |
| 
 | |
|   void _onItemTapped(int index) {
 | |
|     setState(() {
 | |
|       _selectedIndex = index;
 | |
|     });
 | |
|   }
 | |
| 
 | |
|   @override
 | |
|   Widget build(BuildContext context) {
 | |
|     return Scaffold(
 | |
|       appBar: AppBar(
 | |
|         title: Text('物品记录器'),
 | |
|       ),
 | |
|       body: Center(
 | |
|         child: _widgetOptions.elementAt(_selectedIndex),
 | |
|       ),
 | |
|       bottomNavigationBar: BottomNavigationBar(
 | |
|         items: const <BottomNavigationBarItem>[
 | |
|           BottomNavigationBarItem(
 | |
|             icon: Icon(Icons.add_business_sharp),
 | |
|             label: '首页',
 | |
|           ),
 | |
|           BottomNavigationBarItem(
 | |
|             icon: Icon(Icons.person),
 | |
|             label: '我的',
 | |
|           ),
 | |
|         ],
 | |
|         currentIndex: _selectedIndex,
 | |
|         selectedItemColor: Colors.blue,
 | |
|         onTap: _onItemTapped,
 | |
|       ),
 | |
|     );
 | |
|   }
 | |
| } |