import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../services/auth_service.dart'; import '../profile/profile_page.dart'; import 'tabs/water_supply_tab.dart'; import 'tabs/inspection_tab.dart'; import 'tabs/revenue_tab.dart'; /// 首页 —— 底部三 Tab (供水 / 巡检 / 营收) + 个人中心入口 class HomePage extends StatefulWidget { const HomePage({super.key}); @override State createState() => _HomePageState(); } class _HomePageState extends State { int _tabIndex = 0; final List _tabs = const [ WaterSupplyTab(), InspectionTab(), RevenueTab(), ]; final List _titles = const ['供水管理', '巡检管理', '营业收费']; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(_titles[_tabIndex]), centerTitle: true, actions: [ IconButton( icon: const Icon(Icons.person_outline), tooltip: '个人中心', onPressed: () { Navigator.push( context, MaterialPageRoute(builder: (_) => const ProfilePage()), ); }, ), ], ), body: IndexedStack(index: _tabIndex, children: _tabs), bottomNavigationBar: NavigationBar( selectedIndex: _tabIndex, onDestinationSelected: (i) => setState(() => _tabIndex = i), destinations: const [ NavigationDestination( icon: Icon(Icons.water_drop_outlined), selectedIcon: Icon(Icons.water_drop), label: '供水', ), NavigationDestination( icon: Icon(Icons.search), selectedIcon: Icon(Icons.search), label: '巡检', ), NavigationDestination( icon: Icon(Icons.receipt_long_outlined), selectedIcon: Icon(Icons.receipt_long), label: '营收', ), ], ), ); } }