添加个人中心

This commit is contained in:
yifeng.yl
2019-05-31 10:47:16 +08:00
16 changed files with 194 additions and 59 deletions

View File

@ -29,7 +29,6 @@ class AppPage extends StatefulWidget {
AppPage(this.userInfo);
@override
State<StatefulWidget> createState() {
return _MyHomePageState();
@ -38,39 +37,37 @@ class AppPage extends StatefulWidget {
class _MyHomePageState extends State<AppPage>
with SingleTickerProviderStateMixin {
SpUtil sp;
WidgetControlModel widgetControl = new WidgetControlModel();
SearchHistoryList searchHistoryList;
bool isSearch = false;
String appBarTitle = tabData[0]['text'];
List<Widget> list = List();
List<Widget> _list = List();
int _currentIndex = 0;
static List tabData = [
{'text': '业界动态', 'icon': Icon(Icons.language)},
{'text': 'WIDGET', 'icon': Icon(Icons.extension)},
{'text': '组件收藏', 'icon': Icon(Icons.favorite)},
{'text': '关于手册', 'icon': Icon(Icons.import_contacts)}
{'text': '关于手册', 'icon': Icon(Icons.import_contacts)},
];
List<BottomNavigationBarItem> myTabs = [];
List<BottomNavigationBarItem> _myTabs = [];
@override
void initState() {
super.initState();
initSearchHistory();
for (int i = 0; i < tabData.length; i++) {
myTabs.add(BottomNavigationBarItem(
_myTabs.add(BottomNavigationBarItem(
icon: tabData[i]['icon'],
title: Text(
tabData[i]['text'],
),
));
}
list
_list
// ..add(FirstPage())
..add(MainPage(userInfo:widget.userInfo))
..add(MainPage(userInfo: widget.userInfo))
..add(WidgetPage(Provider.db))
..add(CollectionPage())
..add(FourthPage());
@ -126,7 +123,6 @@ class _MyHomePageState extends State<AppPage>
}
renderAppBar(BuildContext context, Widget widget, int index) {
print('renderAppBar=====>>>>>>${index}');
if (index == 0) {
return null;
}
@ -137,13 +133,16 @@ class _MyHomePageState extends State<AppPage>
Widget build(BuildContext context) {
return new Scaffold(
appBar: renderAppBar(context, widget, _currentIndex),
body: list[_currentIndex],
body: IndexedStack(
index: _currentIndex,
children: _list,
),
bottomNavigationBar: BottomNavigationBar(
items: myTabs,
items: _myTabs,
//高亮 被点击高亮
currentIndex: _currentIndex,
//修改 页面
onTap: _ItemTapped,
onTap: _itemTapped,
//shifting :按钮点击移动效果
//fixed固定
type: BottomNavigationBarType.fixed,
@ -153,7 +152,7 @@ class _MyHomePageState extends State<AppPage>
);
}
void _ItemTapped(int index) {
void _itemTapped(int index) {
setState(() {
_currentIndex = index;
appBarTitle = tabData[index]['text'];