import 'package:flutter/material.dart'; class NavBar extends StatelessWidget { final int currentIndex; final List navItems; final Function(int) onTap; const NavBar({ super.key, required this.currentIndex, required this.onTap, required this.navItems, }); @override Widget build(BuildContext context) { return BottomNavigationBar( currentIndex: currentIndex, iconSize: 25, type: BottomNavigationBarType.fixed, backgroundColor: Colors.white, items: navItems, onTap: onTap, ); } } class SettingsDrawer extends StatelessWidget { const SettingsDrawer({super.key}); @override Widget build(BuildContext context) { // final themeProvider = Provider.of(context); return Drawer( child: ListView( padding: EdgeInsets.zero, children: [ ConstrainedBox( constraints: const BoxConstraints(maxHeight: 100), child: DrawerHeader( decoration: BoxDecoration(color: Theme.of(context).primaryColor), child: const Text( '设置', style: TextStyle(color: Colors.white, fontSize: 24), ), ), ), ListTile( leading: const Icon(Icons.brightness_4), title: const Text('夜间模式'), // trailing: Switch( // value: themeProvider.isDarkMode, // onChanged: (bool value) { // themeProvider.toggleTheme(); // }, // ), // onTap: () => themeProvider.toggleTheme(), ), // 其他设置选项 ListTile( leading: const Icon(Icons.notifications), title: const Text('通知设置'), onTap: () { Navigator.pop(context); // 关闭抽屉 // 跳转到通知设置页面 }, ), ListTile( leading: const Icon(Icons.language), title: const Text('语言'), onTap: () { Navigator.pop(context); // 关闭抽屉 // 跳转到语言设置页面 }, ), // 底部关于 const Divider(), ListTile( leading: const Icon(Icons.info), title: const Text('关于我们'), onTap: () { Navigator.pop(context); // 关闭抽屉 // 跳转到关于页面 }, ), ], ), ); } } List homeActions(BuildContext context) { return [ IconButton( icon: Icon(Icons.search, color: Colors.white), onPressed: () { // 搜索功能 }, ), IconButton( icon: Icon(Icons.add, color: Colors.white), onPressed: () { Navigator.pushNamed(context, '/recordForm'); }, ), // Builder( // builder: (BuildContext context) { // return IconButton( // icon: Icon(Icons.settings, color: Colors.white), // onPressed: () { // Scaffold.of(context).openEndDrawer(); // }, // ); // }, // ), ]; }