|
|
@@ -16,11 +16,10 @@ class HomePage extends StatefulWidget {
|
|
|
_HomePageState createState() => _HomePageState();
|
|
|
}
|
|
|
|
|
|
-class _HomePageState extends State < HomePage > with SingleTickerProviderStateMixin{
|
|
|
-
|
|
|
- TabController _controller;
|
|
|
+class _HomePageState extends State < HomePage > with SingleTickerProviderStateMixin {
|
|
|
+
|
|
|
int _currentIndex = 0;
|
|
|
- List<Widget> pageList =[
|
|
|
+ List < Widget > pageList = [
|
|
|
OrderTakingPage(),
|
|
|
OrderManagementPage(),
|
|
|
SendExpressPage(),
|
|
|
@@ -30,60 +29,53 @@ class _HomePageState extends State < HomePage > with SingleTickerProviderStateMi
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
- _controller = TabController(length: pageList.length, vsync: this);
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- return
|
|
|
- Scaffold(
|
|
|
- body: TabBarView(
|
|
|
- physics: NeverScrollableScrollPhysics(), //禁止滚动
|
|
|
- controller: _controller,
|
|
|
- children: [
|
|
|
- OrderTakingPage(),
|
|
|
- OrderManagementPage(),
|
|
|
- SendExpressPage(),
|
|
|
- MyPage()
|
|
|
- ]),
|
|
|
- bottomNavigationBar: BottomNavigationBar(
|
|
|
- currentIndex: _currentIndex,
|
|
|
- type: BottomNavigationBarType.fixed,
|
|
|
- items:[
|
|
|
- BottomNavigationBarItem(
|
|
|
- icon: Image.asset('lib/images/icon_jiedan.png',scale: 1.6,),
|
|
|
- title: Text('接单',style: TextStyle(color:_currentIndex==0?Color.fromRGBO(64, 98, 254, 1):Colors.grey,fontSize: ScreenUtil.getInstance().setSp(20)),),
|
|
|
- activeIcon: Image.asset('lib/images/icon_jiedan01.png',scale: 1.6)
|
|
|
- ),
|
|
|
- BottomNavigationBarItem(
|
|
|
- icon: Image.asset('lib/images/icon_dingdan.png',scale: 1.6),
|
|
|
- title: Text('订单管理',style: TextStyle(color:_currentIndex==1?Color.fromRGBO(64, 98, 254, 1):Colors.grey,fontSize: ScreenUtil.getInstance().setSp(20)),),
|
|
|
- activeIcon: Image.asset('lib/images/icon_dingdan01.png',scale: 1.6)
|
|
|
- ),
|
|
|
- BottomNavigationBarItem(
|
|
|
- icon: Image.asset('lib/images/icon_fajian.png',scale: 1.6),
|
|
|
- title: Text('发件',style: TextStyle(color:_currentIndex==2?Color.fromRGBO(64, 98, 254, 1):Colors.grey,fontSize: ScreenUtil.getInstance().setSp(20)),),
|
|
|
- activeIcon: Image.asset('lib/images/icon_fajian01.png',scale: 1.6)
|
|
|
- ),
|
|
|
- BottomNavigationBarItem(
|
|
|
- icon: Image.asset('lib/images/icon_wode.png',scale: 1.6),
|
|
|
- title: Text('我的',style: TextStyle(color:_currentIndex==3?Color.fromRGBO(64, 98, 254, 1):Colors.grey,fontSize: ScreenUtil.getInstance().setSp(20)),),
|
|
|
- activeIcon: Image.asset('lib/images/icon_wode01.png',scale: 1.6)
|
|
|
- ),
|
|
|
- ],
|
|
|
- onTap: (index){
|
|
|
- setState(() {
|
|
|
- _currentIndex = index;
|
|
|
- });
|
|
|
- // if(_currentIndex==2){
|
|
|
- // Navigator.pushReplacement(context, MaterialPageRoute(builder: (context){
|
|
|
- // return SendExpressPage();
|
|
|
- // }));
|
|
|
- // }else{
|
|
|
- _controller.animateTo(_currentIndex);
|
|
|
- //}
|
|
|
- },
|
|
|
- ),
|
|
|
- );
|
|
|
+ return
|
|
|
+ Scaffold(
|
|
|
+ body: IndexedStack(
|
|
|
+ index: _currentIndex,
|
|
|
+ children: pageList
|
|
|
+ ),
|
|
|
+ bottomNavigationBar: BottomNavigationBar(
|
|
|
+ currentIndex: _currentIndex,
|
|
|
+ type: BottomNavigationBarType.fixed,
|
|
|
+ items: [
|
|
|
+ BottomNavigationBarItem(
|
|
|
+ icon: Image.asset('lib/images/icon_jiedan.png', scale: 1.6, ),
|
|
|
+ title: Text('接单', style: TextStyle(color: _currentIndex == 0 ? Color.fromRGBO(64, 98, 254, 1) : Colors.grey, fontSize: ScreenUtil.getInstance().setSp(20)), ),
|
|
|
+ activeIcon: Image.asset('lib/images/icon_jiedan01.png', scale: 1.6)
|
|
|
+ ),
|
|
|
+ BottomNavigationBarItem(
|
|
|
+ icon: Image.asset('lib/images/icon_dingdan.png', scale: 1.6),
|
|
|
+ title: Text('订单管理', style: TextStyle(color: _currentIndex == 1 ? Color.fromRGBO(64, 98, 254, 1) : Colors.grey, fontSize: ScreenUtil.getInstance().setSp(20)), ),
|
|
|
+ activeIcon: Image.asset('lib/images/icon_dingdan01.png', scale: 1.6)
|
|
|
+ ),
|
|
|
+ BottomNavigationBarItem(
|
|
|
+ icon: Image.asset('lib/images/icon_fajian.png', scale: 1.6),
|
|
|
+ title: Text('发件', style: TextStyle(color: _currentIndex == 2 ? Color.fromRGBO(64, 98, 254, 1) : Colors.grey, fontSize: ScreenUtil.getInstance().setSp(20)), ),
|
|
|
+ activeIcon: Image.asset('lib/images/icon_fajian01.png', scale: 1.6)
|
|
|
+ ),
|
|
|
+ BottomNavigationBarItem(
|
|
|
+ icon: Image.asset('lib/images/icon_wode.png', scale: 1.6),
|
|
|
+ title: Text('我的', style: TextStyle(color: _currentIndex == 3 ? Color.fromRGBO(64, 98, 254, 1) : Colors.grey, fontSize: ScreenUtil.getInstance().setSp(20)), ),
|
|
|
+ activeIcon: Image.asset('lib/images/icon_wode01.png', scale: 1.6)
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ onTap: (index) {
|
|
|
+ setState(() {
|
|
|
+ _currentIndex = index;
|
|
|
+ });
|
|
|
+ // if(_currentIndex==2){
|
|
|
+ // Navigator.pushReplacement(context, MaterialPageRoute(builder: (context){
|
|
|
+ // return SendExpressPage();
|
|
|
+ // }));
|
|
|
+ // }else{
|
|
|
+ //}
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
}
|
|
|
}
|