Commit 780da2ace7135d2fb68ff6e9f0e684cb0862e466

Authored by wdn127929
1 parent 0ff7872a

消息处理点击范围、消息红点、录入预订首页数据保留、早餐两个bug OK

... ... @@ -16,6 +16,7 @@ import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/provider/create_store_model.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:one_key/provider/message_model.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/online_check_edit_provider.dart';
import 'package:one_key/provider/other_login_provider.dart';
... ... @@ -72,6 +73,9 @@ Future<void> main() async {
.then((_) {
runApp(MultiProvider(
providers: [
ChangeNotifierProvider<MessageModel>(
create: (_) => MessageModel(),
),
ChangeNotifierProvider<UserModel>(
create: (_) => UserModel(),
),
... ...
... ... @@ -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 -
... ...
... ... @@ -1322,6 +1322,7 @@ class _HomeEnterPageState extends State<HomeEnterPage>
@override
Widget build(BuildContext context) {
super.build(context);
_homeEnterModel = Provider.of<HomeEnterModel>(context, listen: true);
userModel = Provider.of<UserModel>(context, listen: false);
remarkManagerModel = Provider.of<RemarkManagerModel>(context, listen: true);
... ...
... ... @@ -51,7 +51,7 @@ class MessageItem extends StatelessWidget {
MessageDialogModel messageDialogModel =
Provider.of<MessageDialogModel>(context, listen: false);
return GestureDetector(
onTap: () {
onTap: () async {
//true已处理跳转 false未处理列表不需要点击事件
if (isTreated) {
if (message.message_type == "10") {
... ... @@ -74,6 +74,74 @@ class MessageItem extends StatelessWidget {
//发票详情页面跳转
NavigatorUtil.goInvoiceDetailPage(context, rid: '${message.rid}');
}
} else {
messageDialogModel.removeMessage(message.id);
//message_type:10 跳转在线预订 11 取消订单 1 提前点餐
if (message.message_type == "10") {
NavigatorUtil.goHandleOnlinePage(
context, message.rid.toString(), message.id);
} else if (message.message_type == "11") {
NavigatorUtil.goNotebookDetailPage(
context, message.rid.toString(), message.uid);
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
"id": message.id,
"status": message.message_type == "1" ? "is_read" : "is_handle"
};
await messageDialogModel.setMessageStatus(context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if (message.message_type == "1") {
//提前点餐
NavigatorUtil.goHasOrderFoodPage(context, rid: message.rid);
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
"id": message.id,
"status": message.message_type == "1" ? "is_read" : "is_handle"
};
await messageDialogModel.setMessageStatus(context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if ('${message.message_type}' == "12") {
//在线买单消息 去处理 跳转在线买单处理页面
NavigatorUtil.goOnlineCheckEditPage(context,
rid: '${message.rid}', mid: message.id);
} else if ('${message.message_type}' == "13") {
//在线买单消息 去查看 跳转在线买单详情页面
NavigatorUtil.goOnlineCheckDetailPage(context,
rid: '${message.rid}');
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
"id": message.id,
"status": message.message_type == "1" ? "is_read" : "is_handle"
};
await messageDialogModel.setMessageStatus(context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
} else if (message.message_type == "14") {
//发票详情页面跳转
NavigatorUtil.goInvoiceDetailPage(context, rid: '${message.rid}');
bus.emit("remove_untreated_message", message.id);
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
"id": message.id,
"status": message.message_type == "1" ? "is_read" : "is_handle"
};
await messageDialogModel.setMessageStatus(context, params);
bus.emit("refresh_untreated_num"); //刷新未读消息数目
}
}
},
child: Stack(
... ...
... ... @@ -98,6 +98,7 @@ class HomeEnterModel with ChangeNotifier {
/// 初始化 早市、午市、晚市
_initSunDateList(morning, noon, night, ddateSolt, dateText) {
sunDateList = [];
if (morning != '') {
sunDateList.add({
'dateText': '早餐',
... ...