mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-04 15:28:21 +08:00
add home scaffold
This commit is contained in:
@ -24,7 +24,6 @@ import 'package:flutter_go/resources/widget_name_to_icon.dart';
|
||||
const int ThemeColor = 0xFFC91B3A;
|
||||
|
||||
class AppPage extends StatefulWidget {
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _MyHomePageState();
|
||||
@ -33,13 +32,12 @@ 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)},
|
||||
@ -48,21 +46,21 @@ class _MyHomePageState extends State<AppPage>
|
||||
{'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())
|
||||
..add(WidgetPage(Provider.db))
|
||||
@ -131,13 +129,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,
|
||||
@ -147,7 +148,7 @@ class _MyHomePageState extends State<AppPage>
|
||||
);
|
||||
}
|
||||
|
||||
void _ItemTapped(int index) {
|
||||
void _itemTapped(int index) {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
appBarTitle = tabData[index]['text'];
|
||||
|
Reference in New Issue
Block a user