index_page.dart 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_provider_demo/pages/home_page.dart';
  3. import 'package:flutter_provider_demo/pages/message_page.dart';
  4. import 'package:flutter_provider_demo/pages/mine_page.dart';
  5. /// Description: index page
  6. /// Time : 09/03/2023 Sunday
  7. /// Author : liuyuqi.gov@msn.cn
  8. class IndexPage extends StatefulWidget {
  9. const IndexPage({super.key});
  10. @override
  11. State<IndexPage> createState() => _IndexPageState();
  12. }
  13. class _IndexPageState extends State<IndexPage> {
  14. final List<String> _list = <String>[];
  15. List<Widget> pages = [
  16. const HomePage(),
  17. const MessagePage(),
  18. const MinePage()
  19. ];
  20. @override
  21. Widget build(BuildContext context) {
  22. return Scaffold(
  23. body: const Placeholder(),
  24. appBar: AppBar(
  25. title: const Text('Index Page'),
  26. ),
  27. floatingActionButton: FloatingActionButton(
  28. onPressed: () {
  29. setState(() {
  30. _list.add('Item ${_list.length}');
  31. });
  32. },
  33. tooltip: 'Add Item',
  34. child: const Icon(Icons.add),
  35. ),
  36. bottomNavigationBar: BottomNavigationBar(
  37. items: const <BottomNavigationBarItem>[
  38. BottomNavigationBarItem(
  39. icon: Icon(Icons.home),
  40. label: 'Home',
  41. ),
  42. BottomNavigationBarItem(
  43. icon: Icon(Icons.business),
  44. label: 'Message',
  45. ),
  46. BottomNavigationBarItem(
  47. icon: Icon(Icons.school),
  48. label: 'Mine',
  49. ),
  50. ],
  51. ));
  52. }
  53. }