message_page_old.dart
8.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/constant/state.dart';
// import 'package:one_key/pages_sim/message/message_online_check_page.dart';
// import 'package:one_key/provider/message_dialog_model.dart';
// import 'package:one_key/provider/message_model.dart';
// import 'package:one_key/provider/user_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/utils/event_bus.dart';
// import 'package:one_key/widgets/app_bar.dart';
// import 'package:one_key/widgets/v_empty_view.dart';
// import 'package:provider/provider.dart';
// import 'message_online_page.dart';
// import 'message_order_page.dart';
// /*
// 消息中心
// */
// class MessagePage extends StatefulWidget {
// @override
// State<StatefulWidget> createState() {
// // TODO: implement createState
// return new MessagePageState();
// }
// }
// class MessagePageState extends State<MessagePage>
// with TickerProviderStateMixin {
// Color selectedColor = MyColours.color_199095;
// Color unSelectedColor = MyColours.color_999999;
// TabController tabController;
// MessageModel messageModel;
// UserModel userModel;
// MessageDialogModel messageDialogModel;
// @override
// void initState() {
// super.initState();
// tabController = TabController(length: 3, vsync: this);
// tabController.addListener(() {
// //点击tab时或滑动tab回调一次
// if (tabController.index.toDouble() == tabController.animation.value) {
// getMessage(index: tabController.index);
// }
// });
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
// getMessage(index: 0);
// });
// //刷新未读数
// bus.on("refresh_untreated_num", (arg) {
// _getUnMsgNum();
// });
// //移除在线预订消息
// bus.on("remove_untreated_message", (args) {
// messageModel.removeUntreatedMessageByMid(args.toString());
// messageDialogModel.removeMessage(args.toString());
// });
// }
// //三种分类各自的未读消息数目
// _getUnMsgNum() async {
// if (mounted) {
// Map<String, String> params = {"sid": userModel.user.sellerid};
// await messageModel.getUnMsgNum(context, params);
// }
// }
// //获取在线预订消息status 0未处理 1已处理
// getMessage({bool showLoading = true, int index}) async {
// String typeId = '';
// if (index == 0) {
// typeId = '10';
// } else if (index == 1) {
// typeId = '1';
// } else if (index == 2) {
// typeId = '12';
// }
// Map<String, String> params = {
// "sid": userModel.user.sellerid,
// "type_id": typeId, //1提前点餐2内部预订10在线预订
// "status": '0',
// "offset": '0',
// "limit": "20",
// };
// await messageModel.getMessages(context, params, showLoading: showLoading);
// _getUnMsgNum();
// }
// @override
// Widget build(BuildContext context) {
// messageModel = Provider.of<MessageModel>(context, listen: true);
// userModel = Provider.of<UserModel>(context, listen: false);
// messageDialogModel =
// Provider.of<MessageDialogModel>(context, listen: false);
// return Container(
// width: double.infinity,
// height: double.infinity,
// color: MyColours.color_ffffff,
// child: Column(
// children: <Widget>[
// MyAppBar(
// "消息中心",
// showBack: false,
// ),
// TabBar(
// controller: tabController,
// tabs: [
// Tab(
// child: SizedBox(
// height: ScreenUtil().setWidth(60),
// width: ScreenUtil().setWidth(144),
// child: Stack(
// children: [
// Text(
// "在线预订",
// style: TextStyle(
// color: tabController.index == 0
// ? selectedColor
// : unSelectedColor,
// fontSize: ScreenUtil().setSp(32),
// fontWeight: FontWeight.bold),
// ),
// Positioned(
// top: 0,
// right: 0,
// child: Container(
// width: ScreenUtil().setWidth(16),
// height: ScreenUtil().setWidth(16),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(16)),
// color: messageModel.onlineTotal > 0
// ? MyColours.color_fa5151
// : MyColours.color_ffffff),
// ),
// )
// ],
// ),
// ),
// ),
// Tab(
// child: SizedBox(
// height: ScreenUtil().setWidth(60),
// width: ScreenUtil().setWidth(144),
// child: Stack(
// children: [
// Text(
// "提前点餐",
// style: TextStyle(
// color: tabController.index == 1
// ? selectedColor
// : unSelectedColor,
// fontSize: ScreenUtil().setSp(32),
// fontWeight: FontWeight.bold),
// ),
// Positioned(
// top: 0,
// right: 0,
// child: Container(
// width: ScreenUtil().setWidth(16),
// height: ScreenUtil().setWidth(16),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(16)),
// color: messageModel.orderTotal > 0
// ? MyColours.color_fa5151
// : MyColours.color_ffffff),
// ),
// )
// ],
// ),
// ),
// ),
// Tab(
// child: SizedBox(
// height: ScreenUtil().setWidth(60),
// width: ScreenUtil().setWidth(144),
// child: Stack(
// children: [
// Text(
// "在线买单",
// style: TextStyle(
// color: tabController.index == 2
// ? selectedColor
// : unSelectedColor,
// fontSize: ScreenUtil().setSp(32),
// fontWeight: FontWeight.bold),
// ),
// Positioned(
// top: 0,
// right: 0,
// child: Container(
// width: ScreenUtil().setWidth(16),
// height: ScreenUtil().setWidth(16),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(16)),
// color: messageModel.checkTotal > 0
// ? MyColours.color_fa5151
// : MyColours.color_ffffff),
// ),
// )
// ],
// ),
// ),
// )
// ],
// indicatorColor: MyColours.color_199095,
// indicatorSize: TabBarIndicatorSize.label,
// indicatorPadding: EdgeInsets.only(
// left: ScreenUtil().setWidth(16),
// right: ScreenUtil().setWidth(32)),
// indicatorWeight: ScreenUtil().setWidth(6.0),
// ),
// VEmptyView(11),
// Expanded(
// flex: 1,
// child: TabBarView(controller: tabController, children: [
// MessageOnlinePageSim(),
// MessageOrderPageSim(),
// MessageOnlineCheckPageSim()
// ]),
// )
// ],
// ),
// );
// }
// @override
// void dispose() {
// // TODO: implement dispose
// super.dispose();
// bus.off("refresh_untreated_num");
// bus.off("remove_untreated_message");
// }
// }