index_page.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'package:flutter/material.dart';
  2. class IndexPage extends StatefulWidget {
  3. const IndexPage({super.key});
  4. @override
  5. State<IndexPage> createState() => _IndexPageState();
  6. }
  7. class _IndexPageState extends State<IndexPage> {
  8. int index = 0;
  9. @override
  10. Widget build(BuildContext context) {
  11. return Scaffold(
  12. appBar: AppBar(
  13. title: const Text('Maps Sample App'),
  14. backgroundColor: Colors.green[700],
  15. ),
  16. bottomNavigationBar: BottomNavigationBar(items: [
  17. BottomNavigationBarItem(icon: Icon(Icons.home), label: '出行'),
  18. BottomNavigationBarItem(icon: Icon(Icons.business), label: '周边惠'),
  19. BottomNavigationBarItem(icon: Icon(Icons.school), label: '打车'),
  20. BottomNavigationBarItem(icon: Icon(Icons.school), label: '我的'),
  21. ]),
  22. drawer: Drawer(
  23. child: ListView(
  24. padding: EdgeInsets.zero,
  25. children: <Widget>[
  26. const DrawerHeader(
  27. decoration: BoxDecoration(
  28. color: Colors.green,
  29. ),
  30. child: Text('Drawer Header'),
  31. ),
  32. ListTile(
  33. title: const Text('Item 1'),
  34. onTap: () {
  35. Navigator.pop(context);
  36. },
  37. ),
  38. ListTile(
  39. title: const Text('Item 2'),
  40. onTap: () {
  41. Navigator.pop(context);
  42. },
  43. ),
  44. ],
  45. ),
  46. ),
  47. body: buildContent(index),
  48. );
  49. }
  50. buildContent(int index) {
  51. return Placeholder();
  52. }
  53. }