智慧水务管理系统 - 精河县供水工程综合管理平台

1234567891011121314151617181920212223242526272829303132333435
  1. import 'package:flutter/material.dart';
  2. import 'package:provider/provider.dart';
  3. import '../../services/auth_service.dart';
  4. class HomePage extends StatefulWidget {
  5. const HomePage({super.key});
  6. @override State<HomePage> createState() => _HomePageState();
  7. }
  8. class _HomePageState extends State<HomePage> {
  9. int _tabIndex = 0;
  10. @override
  11. Widget build(BuildContext context) {
  12. final auth = context.read<AuthService>();
  13. return Scaffold(
  14. appBar: AppBar(title: const Text('智慧水务'), actions: [
  15. IconButton(icon: const Icon(Icons.logout), onPressed: () async { await auth.logout(); Navigator.pushReplacement(context, MaterialPageRoute(builder: (_) => const HomePage())); })
  16. ]),
  17. body: IndexedStack(index: _tabIndex, children: const [
  18. Center(child: Text('💧 供水管理')),
  19. Center(child: Text('🔍 巡检管理')),
  20. Center(child: Text('💰 营业收费')),
  21. ]),
  22. bottomNavigationBar: BottomNavigationBar(
  23. currentIndex: _tabIndex, onTap: (i) => setState(() => _tabIndex = i),
  24. items: const [
  25. BottomNavigationBarItem(icon: Icon(Icons.water), label: '供水'),
  26. BottomNavigationBarItem(icon: Icon(Icons.search), label: '巡检'),
  27. BottomNavigationBarItem(icon: Icon(Icons.receipt_long), label: '营收'),
  28. ],
  29. ),
  30. );
  31. }
  32. }