|
@@ -1,71 +0,0 @@
|
1
|
|
-import 'package:flutter/material.dart';
|
2
|
|
-import 'package:flutter/cupertino.dart';
|
3
|
|
-import 'home_page.dart';
|
4
|
|
-import 'Information_page.dart';
|
5
|
|
-import 'Mine_page.dart';
|
6
|
|
-import 'Orders_page.dart';
|
7
|
|
-
|
8
|
|
-class IndexPage extends StatefulWidget {
|
9
|
|
- _IndexPageState createState() => _IndexPageState();
|
10
|
|
-}
|
11
|
|
-
|
12
|
|
-class _IndexPageState extends State<IndexPage> {
|
13
|
|
-
|
14
|
|
-
|
15
|
|
- final List<BottomNavigationBarItem> bottomTabs = [
|
16
|
|
- BottomNavigationBarItem(
|
17
|
|
- icon: Icon(CupertinoIcons.home),
|
18
|
|
- title: Text('首页'),
|
19
|
|
- ),
|
20
|
|
- BottomNavigationBarItem(
|
21
|
|
- icon: Icon(CupertinoIcons.search),
|
22
|
|
- title: Text('资讯'),
|
23
|
|
-
|
24
|
|
- ),
|
25
|
|
- BottomNavigationBarItem(
|
26
|
|
- icon: Icon(CupertinoIcons.shopping_cart),
|
27
|
|
- title: Text('订单'),
|
28
|
|
-
|
29
|
|
- ),
|
30
|
|
- BottomNavigationBarItem(
|
31
|
|
- icon: Icon(CupertinoIcons.profile_circled),
|
32
|
|
- title: Text('我的'),
|
33
|
|
- ),
|
34
|
|
- ];
|
35
|
|
-
|
36
|
|
- final List tabBodies = [
|
37
|
|
- HomePage(),
|
38
|
|
- InformationPage(),
|
39
|
|
- OrdersPage(),
|
40
|
|
- MinePage(),
|
41
|
|
- ];
|
42
|
|
-
|
43
|
|
- int currentIndex = 0;
|
44
|
|
- var currentPage;
|
45
|
|
-
|
46
|
|
- @override
|
47
|
|
- void initState() {
|
48
|
|
- super.initState();
|
49
|
|
- currentPage = tabBodies[currentIndex];
|
50
|
|
- }
|
51
|
|
-
|
52
|
|
- @override
|
53
|
|
- Widget build(BuildContext context) {
|
54
|
|
- // TODO: implement build
|
55
|
|
- return Scaffold(
|
56
|
|
- backgroundColor: Color.fromRGBO(244, 245, 245, 1),
|
57
|
|
- bottomNavigationBar: BottomNavigationBar(
|
58
|
|
- type: BottomNavigationBarType.fixed,
|
59
|
|
- currentIndex: currentIndex,
|
60
|
|
- items: bottomTabs,
|
61
|
|
- onTap: (index){
|
62
|
|
- setState(() {
|
63
|
|
- currentIndex = index;
|
64
|
|
- currentPage = tabBodies[currentIndex];
|
65
|
|
- });
|
66
|
|
- },
|
67
|
|
- ),
|
68
|
|
- body: currentPage,
|
69
|
|
- );
|
70
|
|
- }
|
71
|
|
-}
|