import 'package:flutter/material.dart'; import 'package:food_hub_app/layout/drawer.dart'; import 'package:food_hub_app/layout/nav_bar.dart'; class HomePage extends StatefulWidget { const HomePage({super.key}); @override State createState() => _HomePage(); } class _HomePage extends State { int _currentIndex = 0; List get tabPages => pageInfos.map((item) => item.page).toList(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( centerTitle: true, title: Text('食光集', style: TextStyle(color: Colors.white)), backgroundColor: Theme.of(context).colorScheme.primary, leading: Builder( builder: (context) { return IconButton( icon: const Icon(Icons.menu), color: Colors.white, onPressed: () => Scaffold.of(context).openDrawer(), ); }, ), actions: [ Row( children: [ IconButton( icon: Icon(Icons.search, color: Colors.white), onPressed: () { // 搜索功能 }, ), IconButton( icon: Icon(Icons.add, color: Colors.white), onPressed: () { buildBottomSheet(context); }, ) ], ) ], ), backgroundColor: Color(0xFFF5F5F5), drawer: SettingsDrawer(), body: Padding(padding: EdgeInsets.all(4), child: tabPages[_currentIndex]), // floatingActionButton: FloatingActionButton( // backgroundColor: Theme.of(context).colorScheme.primary, // onPressed: () => buildBottomSheet(context), // shape: const CircleBorder(), // mini: true, // child: const Icon(Icons.add, color: Colors.white, size: 30), // ), // floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, bottomNavigationBar: buildBottomNavBar( currentIndex: _currentIndex, onTap: (index) { setState(() { _currentIndex = index; }); }, ), ); } }