@@ -24,7 +24,6 @@ import 'package:flutter_go/resources/widget_name_to_icon.dart';
24
24
const int ThemeColor = 0xFFC91B3A ;
25
25
26
26
class AppPage extends StatefulWidget {
27
-
28
27
@override
29
28
State <StatefulWidget > createState () {
30
29
return _MyHomePageState ();
@@ -33,13 +32,12 @@ class AppPage extends StatefulWidget {
33
32
34
33
class _MyHomePageState extends State <AppPage >
35
34
with SingleTickerProviderStateMixin {
36
-
37
35
SpUtil sp;
38
36
WidgetControlModel widgetControl = new WidgetControlModel ();
39
37
SearchHistoryList searchHistoryList;
40
38
bool isSearch = false ;
41
39
String appBarTitle = tabData[0 ]['text' ];
42
- List <Widget > list = List ();
40
+ List <Widget > _list = List ();
43
41
int _currentIndex = 0 ;
44
42
static List tabData = [
45
43
// {'text': '业界动态', 'icon': Icon(Icons.language)},
@@ -48,21 +46,21 @@ class _MyHomePageState extends State<AppPage>
48
46
{'text' : '关于手册' , 'icon' : Icon (Icons .import_contacts)},
49
47
];
50
48
51
- List <BottomNavigationBarItem > myTabs = [];
49
+ List <BottomNavigationBarItem > _myTabs = [];
52
50
53
51
@override
54
52
void initState () {
55
53
super .initState ();
56
54
initSearchHistory ();
57
55
for (int i = 0 ; i < tabData.length; i++ ) {
58
- myTabs .add (BottomNavigationBarItem (
56
+ _myTabs .add (BottomNavigationBarItem (
59
57
icon: tabData[i]['icon' ],
60
58
title: Text (
61
59
tabData[i]['text' ],
62
60
),
63
61
));
64
62
}
65
- list
63
+ _list
66
64
// ..add(FirstPage())
67
65
// ..add(MainPage())
68
66
..add (WidgetPage (Provider .db))
@@ -131,13 +129,16 @@ class _MyHomePageState extends State<AppPage>
131
129
Widget build (BuildContext context) {
132
130
return new Scaffold (
133
131
appBar: renderAppBar (context, widget, _currentIndex),
134
- body: list[_currentIndex],
132
+ body: IndexedStack (
133
+ index: _currentIndex,
134
+ children: _list,
135
+ ),
135
136
bottomNavigationBar: BottomNavigationBar (
136
- items: myTabs ,
137
+ items: _myTabs ,
137
138
//高亮 被点击高亮
138
139
currentIndex: _currentIndex,
139
140
//修改 页面
140
- onTap: _ItemTapped ,
141
+ onTap: _itemTapped ,
141
142
//shifting :按钮点击移动效果
142
143
//fixed:固定
143
144
type: BottomNavigationBarType .fixed,
@@ -147,7 +148,7 @@ class _MyHomePageState extends State<AppPage>
147
148
);
148
149
}
149
150
150
- void _ItemTapped (int index) {
151
+ void _itemTapped (int index) {
151
152
setState (() {
152
153
_currentIndex = index;
153
154
appBarTitle = tabData[index]['text' ];
0 commit comments