Commit cdc6147ae5d286e01a53f8f950c21fbe94321e18

Authored by wdn127929
1 parent 2484126a

-点击单个桌位切换简易模式

... ... @@ -50,6 +50,7 @@ class Notebook {
String name;
OrderInfo orderInfo;
String nick_name;
bool issimple;
// String get tableinfoStr {
// return name +
... ...
... ... @@ -10,6 +10,29 @@ import 'package:one_key/widgets/v_empty_view.dart';
/**
* 简易模式
*/
import 'dart:convert';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/pages/notebook/spread_widget.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/loading.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
/**
* 详细模式
*/
class NoteBookItemSimple extends StatefulWidget {
final num index;
final Notebook notebook;
... ... @@ -23,7 +46,19 @@ class NoteBookItemSimple extends StatefulWidget {
}
}
class NoteBookItemSimpleState extends State<NoteBookItemSimple> {
class NoteBookItemSimpleState extends State<NoteBookItemSimple>
with SingleTickerProviderStateMixin {
bool _large = false;
List cancelReasonList = [];
bool isShowTF = false;
// int paddingBottom;
int paddingTop = 138;
FocusNode _cancelNode = FocusNode();
TextEditingController _cancelController = TextEditingController();
StateSetter _cancelState;
ScrollController _scrollController;
_onOperateClick() {
if (widget.notebook.operationText == "通知客户") {
// String _nameStr = '';
... ... @@ -65,169 +100,837 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> {
}
}
/// 初始化取消原因数据
_initCancel() {
// isShowTF = false;
// paddingBottom = ScreenUtil.screenHeightDp.ceil() - 138 - 340;
cancelReasonList = [
{'title': '顾客取消', 'select': false},
{'title': '顾客行程有变', 'select': false},
{'title': '信息填写有误', 'select': false},
{'title': '操作失误', 'select': false},
{'title': '其他原因', 'select': false},
];
}
_updateSize(bool cando) {
if (!cando) {
return;
}
setState(() {
_large = !_large;
});
}
///处理在线预订
setReserveStatus(String status, {String desc}) async {
// bus.emit("remove_untreated_message",widget.mid);
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {
"rid": widget.notebook.id,
"status": status, //5安排包间 2:确认到店(到店),3:用餐完成(离店),4:取消预定,5:分配包间:6:拒单
"uid": userModel.user.openid,
};
if (status == '4') {
Map<String, String> causeMap = {
"uid": userModel.user.openid,
"uname": userModel.user.account,
"desc": desc,
};
params["cause"] = json.encode(causeMap);
}
NotebookDetailModel detailModel =
Provider.of<NotebookDetailModel>(context, listen: false);
bool success =
await detailModel.setReserveStatus(context, params, ifPush: false);
if (success) {
bus.emit("refresh_book_list");
// if (status == "4") {
// //取消预订
// bus.emit("refresh_tablemanager"); //刷新桌位
// }
// _getReserveDetail();
}
}
///取消预订弹框
_showCancelWidget(context) {
_scrollController = ScrollController();
_initCancel();
showGeneralDialog(
context: context,
barrierDismissible: false,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
barrierColor: Color.fromRGBO(0, 0, 0, 0.25),
pageBuilder: (BuildContext context, Animation animation,
Animation secondaryAnimation) {
return Scaffold(
backgroundColor: Color.fromRGBO(0, 0, 0, 0.25),
body: StatefulBuilder(builder: (context, state) {
_cancelState = state;
return GestureDetector(
behavior: HitTestBehavior.opaque,
// onTap: () {
// Navigator.of(context).pop();
// },
child: Center(
child: Container(
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(28 * 2)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10)),
),
height: ScreenUtil().setWidth(355 * 2),
child: Column(
// mainAxisSize: MainAxisSize.min,
children: [
// Stack(
// children: [
VEmptyView(48),
Container(
height: ScreenUtil().setWidth(48),
child: Text(
'是否确定取消预订',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Color.fromRGBO(0, 0, 0, 0.9)),
),
),
// Positioned(
// top: ScreenUtil().setWidth(8),
// right: ScreenUtil().setWidth(0),
// child: GestureDetector(
// onTap: () {
// _initCancel();
// Navigator.of(context).pop();
// },
// child: Container(
// padding: EdgeInsets.only(left: 20),
// child: Image.asset(
// 'assets/close.png',
// width: ScreenUtil().setWidth(32),
// height: ScreenUtil().setWidth(32),
// ),
// )))
// ],
// ),
VEmptyView(40),
Container(
child: Column(
// mainAxisSize: MainAxisSize.min,
children: cancelReasonList.map((value) {
return value['title'] == '其他原因'
? SizedBox()
: GestureDetector(
onTap: () {
for (var item in cancelReasonList) {
item['select'] = false;
// isShowTF = false;
// paddingBottom =
// ScreenUtil.screenHeightDp.ceil() -
// 138 -
// 340;
if (item['title'] ==
value['title']) {
item['select'] = true;
// if (item['title'] == '其他原因') {
// // isShowTF = true;
// // paddingBottom = 130;
// // paddingBottom =
// // ScreenUtil.screenHeightDp.ceil() -
// // 138 -
// // 340 -
// // 46;
// }
}
}
state(() {});
},
child: Container(
height: ScreenUtil().setWidth(48),
margin: EdgeInsets.only(
bottom:
ScreenUtil().setWidth(40)),
child: Row(
children: [
Image.asset(
value['select']
? 'assets/select.png'
: 'assets/unselect.png',
width: ScreenUtil()
.setWidth(42)),
HEmptyView(20),
Container(
child: Text(value['title'],
style: TextStyle(
fontSize: ScreenUtil()
.setSp(32),
fontWeight:
FontWeight.normal,
decoration:
TextDecoration
.none,
color: MyColours
.color_333333)))
],
),
),
);
}).toList(),
)),
Material(
child: Container(
color: Colors.white,
height: ScreenUtil().setWidth(42 * 2),
child: Row(children: [
InkWell(
onTap: () {
for (var item in cancelReasonList) {
item['select'] = false;
}
cancelReasonList[4]['select'] =
true;
state(() {});
},
child: Padding(
padding: EdgeInsets.only(
right: ScreenUtil()
.setWidth(20)),
child: Image.asset(
cancelReasonList[4]['select']
? 'assets/select.png'
: 'assets/unselect.png',
width: ScreenUtil()
.setWidth(44)))),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Color.fromRGBO(
240, 240, 240, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
// height: ScreenUtil().setWidth(42 * 2),
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(16)),
child: TextField(
maxLines: 1,
controller: _cancelController,
focusNode: _cancelNode,
style: TextStyle(
textBaseline:
TextBaseline.alphabetic),
textAlignVertical:
TextAlignVertical.center,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
hintText: "其他",
// focusColor: Color.fromRGBO(0, 0, 0, 0.4),
hintStyle: TextStyle(
color:
Color.fromRGBO(0, 0, 0, 0.4),
fontSize: ScreenUtil().setSp(32),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 0,
color: Colors.transparent)),
border: OutlineInputBorder(
borderSide: BorderSide(
width: 0,
color: Colors.transparent)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 0,
color: Colors.transparent)),
),
// border: InputBorder.none,
onChanged: (_) {
setState(() {});
},
onEditingComplete: () {
print('fff');
_cancelNode.unfocus();
},
// keyboardType: TextInputType.number,
),
))
]))),
VEmptyView(15),
Material(
child: RoundButton(
onPressed: () {
String desc = '';
for (var value in cancelReasonList) {
if (value['select'] == true) {
desc = value['title'];
if (value['title'] == '其他原因') {
desc = _cancelController.text.trim();
if (desc.isEmpty) {
Utils.showToast("请填写原因");
return;
}
}
}
}
if (desc == '') {
Utils.showToast('请选择原因');
return;
}
Navigator.of(context).pop();
Loading.showLoading(context);
setReserveStatus('4', desc: desc);
},
text: '确认',
height: ScreenUtil().setWidth(80),
width: ScreenUtil().setWidth(300),
radius: ScreenUtil().setWidth(10),
),
)
],
),
),
));
}));
});
}
@override
Widget build(BuildContext context) {
// TODO: implement build
Notebook notebook = widget.notebook;
UserModel userModel = Provider.of<UserModel>(context, listen: false);
bool canDo = true;
if (userModel.user.role_name != '管理员' &&
userModel.user.role_name != '店长' &&
notebook.uid != "null" &&
notebook.uid != userModel.user.openid) {
canDo = false;
} else {
if (notebook.status == '0' ||
notebook.status == '1' ||
notebook.status == '2' ||
notebook.status == '5') {
canDo = true;
} else {
canDo = false;
}
}
Color textColor = (notebook.status == "3" ||
notebook.status == "4" ||
notebook.status == "6")
? MyColours.color_bfbfbf
: MyColours.color_353535;
Color bgColor = notebook.status == '0' ||
notebook.status == "2" ||
notebook.status == "1" ||
notebook.status == '5'
? MyColours.color_438E93
: MyColours.color_BFC4D4;
String detail = '';
if (notebook.tid.split(",").length >= 2) {
//连台
detail += '[连台]:${notebook.tableinfoStr};';
}
if (notebook.cusdem != null && notebook.cusdem != '') {
//有备注
detail += '[备注]:${notebook.cusdem};';
}
if (notebook.aname != null) {
//有优惠
detail += '[优惠]:${notebook.aname}';
}
if (detail.endsWith(';')) {
detail = detail.substring(0, detail.length - 1);
}
double widthBtn = 464.0;
if (notebook.status == '2') {
widthBtn = 208.0;
}
return Stack(
children: [
Container(
width: double.infinity,
// height: ScreenUtil().setWidth(120),
color: (widget.index % 2 == 0)
? MyColours.color_f7fdfd
: MyColours.color_ffffff,
child: Row(
children: <Widget>[
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
NavigatorUtil.goNotebookDetailPage(
context, notebook.id, notebook.uid);
},
child: Row(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(86 * 2),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(14),
vertical: ScreenUtil().setWidth(40)),
alignment: Alignment.center,
child: Column(
children: [
Text(
'${notebook.tableinfoStr?.trim()}',
maxLines: 30,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(30)),
),
notebook.type == '1'
? Text('online',
style: TextStyle(
color: Colors.blue,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(26)))
: SizedBox()
],
),
),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(90),
color: MyColours.color_ededed,
),
clipBehavior: Clip.none,
alignment: Alignment.centerRight,
children: [
Container(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(16),
top: ScreenUtil().setWidth(16),
bottom: ScreenUtil().setWidth(16),
right: ScreenUtil().setWidth(44),
),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(48)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(32)),
border: Border.all(
color: Color.fromRGBO(191, 196, 212, 0.2),
width: ScreenUtil().setWidth(1)),
),
child: Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: ScreenUtil().setWidth(230),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
notebook.rnameStr,
// 'nnnnnnnnnnnnnn',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(30)),
),
notebook.phoneStr.isNotEmpty
? Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(10)),
child: Text(
notebook.phoneStr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(26)),
))
: Container()
],
),
),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(90),
color: MyColours.color_ededed,
),
Container(
width: ScreenUtil().setWidth(159),
width: ScreenUtil().setWidth(82 * 2),
margin:
EdgeInsets.only(bottom: ScreenUtil().setWidth(9 * 2)),
alignment: Alignment.center,
child: Text(
notebook.ddateStr,
notebook.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(30)),
color: bgColor,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
widget.notebook.operationText == ''
? SizedBox()
: RoundButton(
text: widget.notebook.operationText,
gradientStart: bgColor,
gradientEnd: bgColor,
textColor: MyColours.color_ffffff,
radius: ScreenUtil().setWidth(6),
fontSize: 24,
width: ScreenUtil().setWidth(42 * 2),
height: ScreenUtil().setWidth(17 * 2),
)
],
),
),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(90),
color: MyColours.color_ededed,
),
GestureDetector(
onTap: _onOperateClick,
behavior: HitTestBehavior.opaque,
child: Container(
padding:
EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),
width: ScreenUtil().setWidth(184),
// color: Colors.red,
alignment: Alignment.center,
child: Text(
notebook.operationText,
style: TextStyle(
color: (notebook.status == "3" ||
notebook.status == "4" ||
notebook.status == "6")
? MyColours.color_bfbfbf
: MyColours.color_2bb5b7,
// fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(30)),
),
HEmptyView(24),
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setWidth(66 * 2),
color: Color.fromRGBO(191, 196, 212, 0.2),
),
),
],
HEmptyView(32),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
NavigatorUtil.goNotebookDetailPage(
context, notebook.id, notebook.uid);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
notebook.rnameStr == ''
? SizedBox()
: Container(
child: Text(
notebook.rnameStr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_260101,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(24)),
),
),
notebook.phoneStr.isNotEmpty
? Text(
'(' +
Utils.showEndPhone(
'${notebook.phoneStr}') +
')',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_260101,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(24)),
)
: SizedBox(),
notebook.rnameStr == '' &&
notebook.phoneStr.isEmpty
? SizedBox()
: HEmptyView(8),
Text(
notebook.actual_pnum == null
? notebook.ddateStr
: notebook.actual_pnum +
'人' +
' ' +
notebook.ddateStr,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_260101,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(24)),
),
],
),
VEmptyView(8),
notebook.nick_name == null &&
notebook.tid.split(",").length < 2 &&
(notebook.cusdem == null ||
notebook.cusdem == '') &&
notebook.aname == null
? SizedBox()
: Row(
children: [
notebook.nick_name == null
? SizedBox()
: Text(
notebook.nick_name + '订',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_999999,
fontSize:
ScreenUtil().setSp(24)),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
Offstage(
offstage: notebook.tid
.split(",")
.length <
2,
child: Image.asset(
Utils.getImgPath(
'ordered_lian'),
width: ScreenUtil()
.setWidth(18 * 2),
),
),
notebook.cusdem == null ||
notebook.cusdem == ''
? SizedBox()
: HEmptyView(8),
Offstage(
offstage:
notebook.cusdem == null ||
notebook.cusdem == '',
child: Image.asset(
Utils.getImgPath(
'ordered_bei'),
width: ScreenUtil()
.setWidth(18 * 2),
),
),
false
? SizedBox()
: HEmptyView(8),
Offstage(
offstage:
notebook.aname == null,
child: Image.asset(
Utils.getImgPath(
'ordered_hui'),
width: ScreenUtil()
.setWidth(18 * 2),
),
)
],
),
],
)
],
)))
],
),
),
),
notebook.orderInfo != null && notebook.orderInfo.status == '3'
? Container(
alignment: Alignment.center,
width: ScreenUtil().setWidth(52 * 2),
height: ScreenUtil().setWidth(19 * 2),
decoration: BoxDecoration(
color: MyColours.color_F59A23,
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(ScreenUtil().setWidth(10))),
),
child: Text(
'已买单',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_ffffff,
fontWeight: FontWeight.bold),
))
: Container()
],
);
Positioned(
right: ScreenUtil().setWidth(8),
child: AnimatedSize(
curve: Curves.easeIn,
duration: Duration(microseconds: 30000),
vsync: this,
child: InkWell(
onTap: () => _updateSize(canDo),
child: _large
? Stack(
children: [
Container(
width:
ScreenUtil().setWidth(widthBtn + 8 * 2),
height: ScreenUtil().setWidth(80),
decoration: BoxDecoration(
color: Color.fromRGBO(67, 142, 147, 0.2),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(16)),
)),
Positioned(
top: ScreenUtil().setWidth(8),
left: ScreenUtil().setWidth(8),
child: Container(
width: ScreenUtil().setWidth(widthBtn),
height: ScreenUtil().setWidth(32 * 2),
decoration: BoxDecoration(
color: Color.fromRGBO(125, 174, 177, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8)),
),
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(16)),
child: Row(
children: [
Image.asset(
Utils.getImgPath(
'ordered_arrow_right'),
width:
ScreenUtil().setWidth(24 * 2),
),
HEmptyView(32),
notebook.status == '2'
? SizedBox()
: RoundButton(
text: '到店',
width: ScreenUtil()
.setWidth(36 * 2),
height: ScreenUtil()
.setWidth(24 * 2),
gradientStart:
MyColours.color_ffffff,
gradientEnd:
MyColours.color_ffffff,
textColor:
MyColours.color_260101,
isBold: true,
fontSize: 28,
radius:
ScreenUtil().setWidth(8),
onPressed: () {
Loading.showLoading(
context);
setReserveStatus('2');
},
),
notebook.status == '2'
? SizedBox()
: HEmptyView(44),
RoundButton(
text: '离店',
width:
ScreenUtil().setWidth(36 * 2),
height:
ScreenUtil().setWidth(24 * 2),
gradientStart:
MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
textColor: MyColours.color_260101,
isBold: true,
fontSize: 28,
radius: ScreenUtil().setWidth(8),
onPressed: () {
Loading.showLoading(context);
setReserveStatus('3');
},
),
notebook.status == '2'
? SizedBox()
: HEmptyView(44),
notebook.status == '2'
? SizedBox()
: InkWell(
onTap: () {
_showCancelWidget(context);
},
child: Text(
'取消预订',
style: TextStyle(
decoration:
TextDecoration
.underline,
color: MyColours
.color_ffffff,
fontSize: ScreenUtil()
.setSp(28),
fontWeight:
FontWeight.bold),
))
],
),
))
],
)
: Image.asset(
Utils.getImgPath(
canDo ? 'ordered_open' : 'ordered_off'),
width: ScreenUtil().setWidth(80),
))))
// Positioned(
// right: ScreenUtil().setWidth(8),
// child: Image.asset(
// Utils.getImgPath(true ? 'ordered_open' : 'ordered_off'),
// width: ScreenUtil().setWidth(80),
// ))
]);
// return Stack(
// children: [
// Container(
// width: double.infinity,
// // height: ScreenUtil().setWidth(120),
// color: (widget.index % 2 == 0)
// ? MyColours.color_f7fdfd
// : MyColours.color_ffffff,
// child: Row(
// children: <Widget>[
// GestureDetector(
// behavior: HitTestBehavior.translucent,
// onTap: () {
// NavigatorUtil.goNotebookDetailPage(
// context, notebook.id, notebook.uid);
// },
// child: Row(
// children: <Widget>[
// Container(
// width: ScreenUtil().setWidth(86 * 2),
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(14),
// vertical: ScreenUtil().setWidth(40)),
// alignment: Alignment.center,
// child: Column(
// children: [
// Text(
// '${notebook.tableinfoStr?.trim()}',
// maxLines: 30,
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: textColor,
// // fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(30)),
// ),
// notebook.type == '1'
// ? Text('online',
// style: TextStyle(
// color: Colors.blue,
// // fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(26)))
// : SizedBox()
// ],
// ),
// ),
// MyDivider(
// ScreenUtil().setWidth(1),
// ScreenUtil().setHeight(90),
// color: MyColours.color_ededed,
// ),
// Container(
// width: ScreenUtil().setWidth(230),
// alignment: Alignment.center,
// child: Column(
// mainAxisSize: MainAxisSize.min,
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Text(
// notebook.rnameStr,
// // 'nnnnnnnnnnnnnn',
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: textColor,
// // fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(30)),
// ),
// notebook.phoneStr.isNotEmpty
// ? Padding(
// padding: EdgeInsets.only(
// top: ScreenUtil().setWidth(10)),
// child: Text(
// notebook.phoneStr,
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: textColor,
// // fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(26)),
// ))
// : Container()
// ],
// ),
// ),
// MyDivider(
// ScreenUtil().setWidth(1),
// ScreenUtil().setHeight(90),
// color: MyColours.color_ededed,
// ),
// Container(
// width: ScreenUtil().setWidth(159),
// alignment: Alignment.center,
// child: Text(
// notebook.ddateStr,
// style: TextStyle(
// color: textColor,
// // fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(30)),
// ),
// ),
// ],
// ),
// ),
// MyDivider(
// ScreenUtil().setWidth(1),
// ScreenUtil().setHeight(90),
// color: MyColours.color_ededed,
// ),
// GestureDetector(
// onTap: _onOperateClick,
// behavior: HitTestBehavior.opaque,
// child: Container(
// padding:
// EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),
// width: ScreenUtil().setWidth(184),
// // color: Colors.red,
// alignment: Alignment.center,
// child: Text(
// notebook.operationText,
// style: TextStyle(
// color: (notebook.status == "3" ||
// notebook.status == "4" ||
// notebook.status == "6")
// ? MyColours.color_bfbfbf
// : MyColours.color_2bb5b7,
// // fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(30)),
// ),
// ),
// ),
// ],
// ),
// ),
// notebook.orderInfo != null && notebook.orderInfo.status == '3'
// ? Container(
// alignment: Alignment.center,
// width: ScreenUtil().setWidth(52 * 2),
// height: ScreenUtil().setWidth(19 * 2),
// decoration: BoxDecoration(
// color: MyColours.color_F59A23,
// borderRadius: BorderRadius.only(
// bottomRight: Radius.circular(ScreenUtil().setWidth(10))),
// ),
// child: Text(
// '已买单',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(24),
// color: MyColours.color_ffffff,
// fontWeight: FontWeight.bold),
// ))
// : Container()
// ],
// );
}
}
... ...
... ... @@ -4,7 +4,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/pages/notebook/notebook_item_f.dart';
import 'package:one_key/pages/notebook/notebook_item_f_simple.dart';
import 'package:one_key/pages/notebook/notebook_item_widget.dart';
import 'package:one_key/provider/notebook_model.dart';
import 'package:one_key/provider/update_model.dart';
... ... @@ -59,6 +61,8 @@ class NoteBookPageState extends State<NoteBookPage> {
StartingDayOfWeek startingDayOfWeek;
bool clearSel = false;
bool isall = true;
bool isSimple = true;
NoteBookModel noteBookModel;
@override
void initState() {
... ... @@ -195,8 +199,7 @@ class NoteBookPageState extends State<NoteBookPage> {
}
//获取已预订列表
_getReserveList() {
NoteBookModel model = Provider.of<NoteBookModel>(context, listen: false);
_getReserveList() async {
Map<String, String> params = {
"sid": userModel.user.sellerid,
"rdate": _getRdate(),
... ... @@ -210,7 +213,8 @@ class NoteBookPageState extends State<NoteBookPage> {
params["account"] = userModel.user.account;
}
model.getReserveList(context, params);
await noteBookModel.getReserveList(context, params);
_simpleState();
}
//解析返回显示的日期
... ... @@ -503,10 +507,25 @@ class NoteBookPageState extends State<NoteBookPage> {
return container;
}
_simpleState() {
if (noteBookModel.notebooks.length > 0) {
if (isSimple) {
for (Notebook item in noteBookModel.notebooks) {
item.issimple = true;
}
} else {
for (Notebook item in noteBookModel.notebooks) {
item.issimple = false;
}
}
}
}
@override
Widget build(BuildContext context) {
// TODO: implement build
userModel = Provider.of<UserModel>(context, listen: false);
noteBookModel = Provider.of<NoteBookModel>(context, listen: true);
int sum = 3;
int hide = 0;
int btnNum = 0;
... ... @@ -917,22 +936,29 @@ class NoteBookPageState extends State<NoteBookPage> {
width: ScreenUtil().setWidth(24 * 2))
],
)),
Column(
children: [
Text(
'简易模式',
style: TextStyle(
fontSize: ScreenUtil().setSp(20),
fontWeight: FontWeight.bold,
color: MyColours.color_515151),
),
VEmptyView(16),
Image.asset(
Utils.getImgPath(
true ? 'f_swich_on' : 'f_swich_off'),
width: ScreenUtil().setWidth(24 * 2))
],
),
InkWell(
onTap: () {
setState(() {
isSimple = !isSimple;
});
_simpleState();
},
child: Column(
children: [
Text(
'简易模式',
style: TextStyle(
fontSize: ScreenUtil().setSp(20),
fontWeight: FontWeight.bold,
color: MyColours.color_515151),
),
VEmptyView(16),
Image.asset(
Utils.getImgPath(
isSimple ? 'f_swich_on' : 'f_swich_off'),
width: ScreenUtil().setWidth(24 * 2))
],
)),
],
)),
Expanded(child: Consumer<NoteBookModel>(
... ... @@ -963,8 +989,11 @@ class NoteBookPageState extends State<NoteBookPage> {
return Container(
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(24)),
child: NoteBookItemF(
model.notebooks[index], index),
child: model.notebooks[index].issimple
? NoteBookItemSimple(
model.notebooks[index], index)
: NoteBookItemF(
model.notebooks[index], index),
);
}, childCount: model.notebooks.length),
// itemExtent: ScreenUtil().setWidth(112),
... ...