| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'pages/order_taking_page.dart';
- import 'pages/order_management_page.dart';
- import 'pages/send_express_page.dart';
- import 'pages/my_page.dart';
- class HomePage extends StatefulWidget {
- final Widget child;
- HomePage({
- Key key,
- this.child
- }): super(key: key);
- _HomePageState createState() => _HomePageState();
- }
- class _HomePageState extends State < HomePage > {
- int _currentIndex = 0;
- List < Widget > pageList = [
- OrderTakingPage(),
- OrderManagementPage(),
- SendExpressPage(),
- MyPage()
- ];
- @override
- void initState() {
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- ScreenUtil.instance = ScreenUtil(width: 750, height: 1334,allowFontScaling:false)..init(context);
- return
- Scaffold(
- body:pageList[_currentIndex],
-
- // 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{
- //}
- },
- ),
- );
- }
- }
|