|
...
|
...
|
@@ -58,6 +58,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
int xgCount = 1; //注册信鸽次数,最多5次
|
|
|
|
|
|
|
|
DateTime lastBack;
|
|
|
|
PageController _pageController;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -66,6 +67,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
LogUtil.v("home_initState");
|
|
|
|
WidgetsBinding.instance.addObserver(this);
|
|
|
|
_currIndex = widget.initialIndex;
|
|
|
|
_pageController = PageController(initialPage: _currIndex);
|
|
|
|
pages
|
|
|
|
..add(ChangeNotifierProvider<HomeEnterModel>(
|
|
|
|
create: (_) => HomeEnterModel(),
|
|
...
|
...
|
@@ -73,9 +75,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
create: (_) => RemarkManagerModel(),
|
|
|
|
child: SafeArea(child: HomeEnterPage()),
|
|
|
|
)))
|
|
|
|
..add(ChangeNotifierProvider<MessageModel>(
|
|
|
|
create: (_) => MessageModel(),
|
|
|
|
child: SafeArea(child: MessagePage()),
|
|
|
|
..add(SafeArea(
|
|
|
|
child: MessagePage(),
|
|
|
|
))
|
|
|
|
// ..add(ChangeNotifierProvider<EnterModel>(
|
|
|
|
// create: (_) => EnterModel(),
|
|
...
|
...
|
@@ -442,6 +443,20 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取未处理消息数目
|
|
|
|
bool _getUnMsgNum() {
|
|
|
|
MessageModel messageModel =
|
|
|
|
Provider.of<MessageModel>(context, listen: true);
|
|
|
|
if (
|
|
|
|
messageModel.onlineTotal +
|
|
|
|
messageModel.orderTotal +
|
|
|
|
messageModel.checkTotal >
|
|
|
|
0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 系统窗口相关改变回调
|
|
|
|
void didChangeMetrics() {
|
|
|
|
super.didChangeMetrics();
|
|
...
|
...
|
@@ -463,50 +478,87 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
// TODO: implement build
|
|
|
|
|
|
|
|
return new WillPopScope(
|
|
|
|
child: Scaffold(
|
|
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
|
|
iconSize: ScreenUtil().setWidth(48),
|
|
|
|
unselectedFontSize: ScreenUtil().setSp(22),
|
|
|
|
selectedFontSize: ScreenUtil().setSp(22),
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
items: [
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Image(
|
|
|
|
image: AssetImage("assets/enter_order_n.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
activeIcon: Image(
|
|
|
|
image: AssetImage("assets/enter_order_s.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
|
|
iconSize: ScreenUtil().setWidth(48),
|
|
|
|
unselectedFontSize: ScreenUtil().setSp(22),
|
|
|
|
selectedFontSize: ScreenUtil().setSp(22),
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
items: [
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Image(
|
|
|
|
image: AssetImage("assets/enter_order_n.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
activeIcon: Image(
|
|
|
|
image: AssetImage("assets/enter_order_s.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"录入预订",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 0 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"录入预订",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 0 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Stack(
|
|
|
|
children: [
|
|
|
|
Image(
|
|
|
|
image: AssetImage("assets/message_default.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
top: 0,
|
|
|
|
right: 0,
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil().setWidth(16),
|
|
|
|
height: ScreenUtil().setWidth(16),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(16)),
|
|
|
|
color: _getUnMsgNum()
|
|
|
|
? MyColours.color_fa5151
|
|
|
|
: Colors.transparent),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
activeIcon: Stack(
|
|
|
|
children: [
|
|
|
|
Image(
|
|
|
|
image: AssetImage("assets/message_selected.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
top: 0,
|
|
|
|
right: 0,
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil().setWidth(16),
|
|
|
|
height: ScreenUtil().setWidth(16),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(16)),
|
|
|
|
color: _getUnMsgNum()
|
|
|
|
? MyColours.color_fa5151
|
|
|
|
: Colors.transparent),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"消息中心",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 1 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Image(
|
|
|
|
image: AssetImage("assets/message_default.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
activeIcon: Image(
|
|
|
|
image: AssetImage("assets/message_selected.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"消息中心",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 1 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// BottomNavigationBarItem(
|
|
|
|
// icon: Image(
|
|
|
|
// image: AssetImage("assets/message_default.png"),
|
|
...
|
...
|
@@ -525,151 +577,161 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { |
|
|
|
// fontSize: ScreenUtil().setSp(22)),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Image(
|
|
|
|
image: AssetImage("assets/notebook_default.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
activeIcon: Image(
|
|
|
|
image: AssetImage("assets/notebook_selected.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Image(
|
|
|
|
image: AssetImage("assets/notebook_default.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
activeIcon: Image(
|
|
|
|
image: AssetImage("assets/notebook_selected.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"已预订",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 2 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"已预订",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 2 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Image(
|
|
|
|
image: AssetImage("assets/tablemanage_default.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
activeIcon: Image(
|
|
|
|
image: AssetImage("assets/tablemanage_selected.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"桌位",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 3 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Image(
|
|
|
|
image: AssetImage("assets/tablemanage_default.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Image(
|
|
|
|
image: AssetImage("assets/my_default.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
activeIcon: Image(
|
|
|
|
image: AssetImage("assets/my_selected.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"我的",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 4 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
activeIcon: Image(
|
|
|
|
image: AssetImage("assets/tablemanage_selected.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"桌位",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 3 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
icon: Image(
|
|
|
|
image: AssetImage("assets/my_default.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
activeIcon: Image(
|
|
|
|
image: AssetImage("assets/my_selected.png"),
|
|
|
|
width: ScreenUtil().setWidth(48),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
"我的",
|
|
|
|
style: TextStyle(
|
|
|
|
color: _currIndex == 4 ? _activeColor : _defaultColor,
|
|
|
|
fontSize: ScreenUtil().setSp(22)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
type: BottomNavigationBarType.fixed,
|
|
|
|
currentIndex: _currIndex,
|
|
|
|
onTap: (int index) {
|
|
|
|
if (_currIndex != index) {
|
|
|
|
],
|
|
|
|
type: BottomNavigationBarType.fixed,
|
|
|
|
currentIndex: _currIndex,
|
|
|
|
onTap: (int index) {
|
|
|
|
if (_currIndex != index) {
|
|
|
|
setState(() {
|
|
|
|
_currIndex = index;
|
|
|
|
_pageController.jumpToPage(index);
|
|
|
|
});
|
|
|
|
if (_currIndex == 5) {
|
|
|
|
Utils.changeStatusColor(color: MyColours.color_199095);
|
|
|
|
} else {
|
|
|
|
Utils.changeStatusColor(color: Colors.white);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
// bottomNavigationBar: BottomAppBar(
|
|
|
|
// shape: CircularNotchedRectangle(),
|
|
|
|
// child: Container(
|
|
|
|
// height: ScreenUtil().setWidth(98),
|
|
|
|
// // padding: EdgeInsets.fromLTRB(0, 12, 0, 8),
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisSize: MainAxisSize.max,
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
// children: <Widget>[
|
|
|
|
// GestureDetector(
|
|
|
|
// onTap: () {
|
|
|
|
// // onTap(0);
|
|
|
|
// },
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
// children: <Widget>[
|
|
|
|
// Image(
|
|
|
|
// image: AssetImage("assets/my_selected.png"),
|
|
|
|
// width: ScreenUtil().setWidth(44),
|
|
|
|
// height: ScreenUtil().setWidth(44),
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// "我的",
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: _currIndex == 2
|
|
|
|
// ? _activeColor
|
|
|
|
// : _defaultColor,
|
|
|
|
// fontSize: ScreenUtil().setSp(22)),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )),
|
|
|
|
// GestureDetector(
|
|
|
|
// onTap: () {
|
|
|
|
// // onTap(1);
|
|
|
|
// },
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
// children: <Widget>[
|
|
|
|
// Image(
|
|
|
|
// image: AssetImage("assets/my_selected.png"),
|
|
|
|
// width: ScreenUtil().setWidth(44),
|
|
|
|
// height: ScreenUtil().setWidth(44),
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// "我的",
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: _currIndex == 2
|
|
|
|
// ? _activeColor
|
|
|
|
// : _defaultColor,
|
|
|
|
// fontSize: ScreenUtil().setSp(22)),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )),
|
|
|
|
// Column(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
// children: <Widget>[
|
|
|
|
// Image(
|
|
|
|
// image: AssetImage("assets/my_selected.png"),
|
|
|
|
// width: ScreenUtil().setWidth(44),
|
|
|
|
// height: ScreenUtil().setWidth(44),
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// "我的",
|
|
|
|
// style: TextStyle(
|
|
|
|
// color:
|
|
|
|
// _currIndex == 2 ? _activeColor : _defaultColor,
|
|
|
|
// fontSize: ScreenUtil().setSp(22)),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )
|
|
|
|
// ])),
|
|
|
|
// ),
|
|
|
|
// body: pages[_currIndex],
|
|
|
|
body: PageView(
|
|
|
|
controller: _pageController,
|
|
|
|
children: pages,
|
|
|
|
onPageChanged: (index) {
|
|
|
|
setState(() {
|
|
|
|
_currIndex = index;
|
|
|
|
});
|
|
|
|
if (_currIndex == 5) {
|
|
|
|
Utils.changeStatusColor(color: MyColours.color_199095);
|
|
|
|
} else {
|
|
|
|
Utils.changeStatusColor(color: Colors.white);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
|
|
|
// bottomNavigationBar: BottomAppBar(
|
|
|
|
// shape: CircularNotchedRectangle(),
|
|
|
|
// child: Container(
|
|
|
|
// height: ScreenUtil().setWidth(98),
|
|
|
|
// // padding: EdgeInsets.fromLTRB(0, 12, 0, 8),
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisSize: MainAxisSize.max,
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
// children: <Widget>[
|
|
|
|
// GestureDetector(
|
|
|
|
// onTap: () {
|
|
|
|
// // onTap(0);
|
|
|
|
// },
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
// children: <Widget>[
|
|
|
|
// Image(
|
|
|
|
// image: AssetImage("assets/my_selected.png"),
|
|
|
|
// width: ScreenUtil().setWidth(44),
|
|
|
|
// height: ScreenUtil().setWidth(44),
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// "我的",
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: _currIndex == 2
|
|
|
|
// ? _activeColor
|
|
|
|
// : _defaultColor,
|
|
|
|
// fontSize: ScreenUtil().setSp(22)),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )),
|
|
|
|
// GestureDetector(
|
|
|
|
// onTap: () {
|
|
|
|
// // onTap(1);
|
|
|
|
// },
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
// children: <Widget>[
|
|
|
|
// Image(
|
|
|
|
// image: AssetImage("assets/my_selected.png"),
|
|
|
|
// width: ScreenUtil().setWidth(44),
|
|
|
|
// height: ScreenUtil().setWidth(44),
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// "我的",
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: _currIndex == 2
|
|
|
|
// ? _activeColor
|
|
|
|
// : _defaultColor,
|
|
|
|
// fontSize: ScreenUtil().setSp(22)),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )),
|
|
|
|
// Column(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
// children: <Widget>[
|
|
|
|
// Image(
|
|
|
|
// image: AssetImage("assets/my_selected.png"),
|
|
|
|
// width: ScreenUtil().setWidth(44),
|
|
|
|
// height: ScreenUtil().setWidth(44),
|
|
|
|
// ),
|
|
|
|
// Text(
|
|
|
|
// "我的",
|
|
|
|
// style: TextStyle(
|
|
|
|
// color:
|
|
|
|
// _currIndex == 2 ? _activeColor : _defaultColor,
|
|
|
|
// fontSize: ScreenUtil().setSp(22)),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// )
|
|
|
|
// ])),
|
|
|
|
// ),
|
|
|
|
body: pages[_currIndex],
|
|
|
|
),
|
|
|
|
},
|
|
|
|
physics: NeverScrollableScrollPhysics(), //禁止底部滑动
|
|
|
|
)),
|
|
|
|
onWillPop: () async {
|
|
|
|
if (lastBack != null &&
|
|
|
|
DateTime.now().millisecondsSinceEpoch -
|
...
|
...
|
|