Commit c4e334ad44c9c0fb583d5298be37de3c9c875d4b

Authored by wdn127929
1 parent 1e1c09c1

详细模式okok

... ... @@ -8,6 +8,7 @@ part 'notebook.g.dart';
class Notebook {
Notebook();
String tableinfo;
String id;
String orderid;
String openid;
... ... @@ -49,12 +50,25 @@ class Notebook {
OrderInfo orderInfo;
String nick_name;
// String get tableinfoStr {
// return name +
// "\n" +
// (tid.split(",").length >= 2
// ? ('等' + tid.split(",").length.toString() + '桌')
// : '');
// }
String get tableinfoStr {
return name +
"\n" +
(tid.split(",").length >= 2
? ('等' + tid.split(",").length.toString() + '桌')
: '');
List list = json.decode(tableinfo);
String temp = '';
for (var item in list) {
temp += item['name'] + '、';
}
if (temp.endsWith('、')) {
temp = temp.substring(0, temp.length - 1);
}
return temp;
}
String get rnameStr {
... ... @@ -112,7 +126,7 @@ class Notebook {
switch (status) {
//订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订
case "1":
return "通知客户";
return "";
case "2":
return "已到店";
case "3":
... ... @@ -120,9 +134,9 @@ class Notebook {
case "4":
return "已取消";
case "6":
return "已拒绝";
return "";
default:
return "通知客户";
return "";
}
}
... ...
... ... @@ -8,6 +8,7 @@ part of 'notebook.dart';
Notebook _$NotebookFromJson(Map<String, dynamic> json) {
return Notebook()
..tableinfo = json['tableinfo'] as String
..id = json['id'] as String
..orderid = json['orderid'] as String
..openid = json['openid'] as String
... ... @@ -53,6 +54,7 @@ Notebook _$NotebookFromJson(Map<String, dynamic> json) {
}
Map<String, dynamic> _$NotebookToJson(Notebook instance) => <String, dynamic>{
'tableinfo': instance.tableinfo,
'id': instance.id,
'orderid': instance.orderid,
'openid': instance.openid,
... ...
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/res/colors.dart';
import 'package:one_key/route/navigator_util.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/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
/**
* 详细模式
*/
class NoteBookItemF extends StatefulWidget {
final num index;
final Notebook notebook;
NoteBookItemF(this.notebook, this.index);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new NoteBookItemFState();
}
}
class NoteBookItemFState extends State<NoteBookItemF> {
_onOperateClick() {
if (widget.notebook.operationText == "通知客户") {
// String _nameStr = '';
// String _tid = '';
// for (int i = 0;
// i <
// detailEntity
// .tables.length;
// i++) {
// _nameStr +=
// '${detailEntity.tables[i].name},';
// _tid +=
// '${detailEntity.tables[i].id},';
// }
// if (_tid.endsWith(',')) {
// _tid = _tid.substring(
// 0, _tid.length - 1);
// }
// if (_nameStr
// .endsWith(',')) {
// _nameStr =
// _nameStr.substring(
// 0,
// _nameStr.length -
// 1);
// }
NavigatorUtil.goInvicationPage(
context,
widget.notebook.id,
widget.notebook.tableinfoStr,
widget.notebook.ddate,
widget.notebook.ddateStr,
widget.notebook.phone,
widget.notebook.ddate_solt,
widget.notebook.rname == null ? '' : widget.notebook.rname,
widget.notebook.sex == null ? '' : widget.notebook.sex,
tid: widget.notebook.tid);
}
}
@override
Widget build(BuildContext context) {
// TODO: implement build
Notebook notebook = widget.notebook;
Color bgColor = notebook.status == "2" || notebook.status == "1"
? MyColours.color_438E93
: Color.fromRGBO(191, 196, 212, 0.2);
String detail = '';
if (notebook.tid.split(",").length >= 2) {
//连台
detail += '[连台]:${notebook.tableinfoStr};';
}
if (notebook.cusdem != null && notebook.cusdem != '') {
//有备注
detail += '[备注]:${notebook.cusdem};';
}
if (true) {
//有优惠
detail += '[优惠]:';
}
if (detail.endsWith(';')) {
detail = detail.substring(0, detail.length - 1);
}
return Stack(
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(82 * 2),
margin:
EdgeInsets.only(bottom: ScreenUtil().setWidth(9 * 2)),
alignment: Alignment.center,
child: Text(
notebook.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: bgColor,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
Padding(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(9 * 2)),
child: 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: true,
child: Image.asset(
Utils.getImgPath('ordered_hui'),
width: ScreenUtil().setWidth(18 * 2),
),
)
],
)),
widget.notebook.operationText == ''
? SizedBox()
: RoundButton(
text: widget.notebook.operationText,
gradientStart: bgColor,
gradientEnd: bgColor,
textColor: MyColours.color_ffffff,
radius: ScreenUtil().setWidth(6),
fontSize: 28,
width: ScreenUtil().setWidth(56 * 2),
)
],
),
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(28)),
),
),
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(28)),
)
: SizedBox(),
notebook.rnameStr == '' &&
notebook.phoneStr.isEmpty
? SizedBox()
: HEmptyView(8),
notebook.rnameStr == '' &&
notebook.phoneStr.isEmpty
? SizedBox()
: Expanded(
child: Container(
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(12),
vertical: ScreenUtil().setWidth(4)),
decoration: BoxDecoration(
border: Border.all(
width: ScreenUtil().setWidth(2),
color: MyColours.color_A78E44),
borderRadius:
BorderRadius.circular(6)),
child: Text(
'biaoqianvipdsdsbiaoqianvipdsdsbiaoqianvipdsdsbiaoqianvipdsdsbiaoqianvipdsds',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_A78E44,
fontSize: ScreenUtil().setSp(18)),
),
))
],
),
VEmptyView(6),
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(28)),
),
detail == '' ? SizedBox() : VEmptyView(6),
notebook.nick_name == null
? SizedBox()
: Text(
notebook.nick_name + '订',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
),
notebook.nick_name == ''
? VEmptyView(6)
: SizedBox(),
Text(
detail,
maxLines: 100,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
),
],
)))
],
),
),
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()
// ],
// );
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/v_empty_view.dart';
/**
* 简易模式
*/
class NoteBookItemSimple extends StatefulWidget {
final num index;
final Notebook notebook;
NoteBookItemSimple(this.notebook, this.index);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new NoteBookItemSimpleState();
}
}
class NoteBookItemSimpleState extends State<NoteBookItemSimple> {
_onOperateClick() {
if (widget.notebook.operationText == "通知客户") {
// String _nameStr = '';
// String _tid = '';
// for (int i = 0;
// i <
// detailEntity
// .tables.length;
// i++) {
// _nameStr +=
// '${detailEntity.tables[i].name},';
// _tid +=
// '${detailEntity.tables[i].id},';
// }
// if (_tid.endsWith(',')) {
// _tid = _tid.substring(
// 0, _tid.length - 1);
// }
// if (_nameStr
// .endsWith(',')) {
// _nameStr =
// _nameStr.substring(
// 0,
// _nameStr.length -
// 1);
// }
NavigatorUtil.goInvicationPage(
context,
widget.notebook.id,
widget.notebook.tableinfoStr,
widget.notebook.ddate,
widget.notebook.ddateStr,
widget.notebook.phone,
widget.notebook.ddate_solt,
widget.notebook.rname == null ? '' : widget.notebook.rname,
widget.notebook.sex == null ? '' : widget.notebook.sex,
tid: widget.notebook.tid);
}
}
@override
Widget build(BuildContext context) {
// TODO: implement build
Notebook notebook = widget.notebook;
Color textColor = (notebook.status == "3" ||
notebook.status == "4" ||
notebook.status == "6")
? MyColours.color_bfbfbf
: MyColours.color_353535;
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,6 +4,7 @@ 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/pages/notebook/notebook_item_f.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';
... ... @@ -16,10 +17,12 @@ import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/common_button_flat.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/page_error.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'package:table_calendar/table_calendar.dart';
... ... @@ -503,16 +506,30 @@ class NoteBookPageState extends State<NoteBookPage> {
Widget build(BuildContext context) {
// TODO: implement build
userModel = Provider.of<UserModel>(context, listen: false);
int sum = 3;
int hide = 0;
int btnNum = 0;
if (morning == "00:00-00:00") {
hide++;
}
if (noon == "00:00-00:00") {
hide++;
}
if (night == "00:00-00:00") {
hide++;
}
btnNum = sum - hide;
return Scaffold(
body: Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(24),
vertical: ScreenUtil().setWidth(32)),
padding: EdgeInsets.only(top: ScreenUtil().setWidth(32)),
child: Column(
children: [
Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.only(
right: ScreenUtil().setWidth(24),
),
child: Row(
children: [
Expanded(
... ... @@ -530,9 +547,9 @@ class NoteBookPageState extends State<NoteBookPage> {
dateTimeNow = day;
clearSel = false;
setState(() {
dateText = '更多\n日期';
dateText = '更多\n日期';
});
// _currTimeIndex();
// _getSellerTableClass();
}
... ... @@ -745,6 +762,213 @@ class NoteBookPageState extends State<NoteBookPage> {
)),
],
)),
VEmptyView(20),
Padding(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(8),
left: ScreenUtil().setWidth(24),
right: ScreenUtil().setWidth(24)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: btnNum == 3 &&
(currTimeIndex == 3 || currTimeIndex == 1)
? ScreenUtil().setWidth(240 * 2) +
ScreenUtil().setWidth(4)
: ScreenUtil().setWidth(240 * 2),
height: ScreenUtil().setWidth(80),
decoration: BoxDecoration(
color: Color.fromRGBO(232, 232, 232, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(20),
)),
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Offstage(
offstage:
morning == "00:00-00:00" ? true : false,
child: Selector<NoteBookModel, String>(
selector: (context, model) =>
model.totalmorning,
builder: (context, total, child) {
return CommonButtonFlat(
content: "早餐" + total,
state: currTimeIndex == 1 ? 1 : 0,
fontSize: 28,
padding: EdgeInsets.symmetric(
vertical:
ScreenUtil().setWidth(20)),
right: noon == "00:00-00:00" &&
night == "00:00-00:00"
? true
: false,
width: ScreenUtil().setWidth(240 * 2) /
btnNum,
onPress: () {
if (currTimeIndex == 1) return;
setState(() {
currTimeIndex = 1;
});
_getReserveList();
},
);
})),
btnNum == 3 && currTimeIndex == 3
? MyDivider(
ScreenUtil().setWidth(4),
ScreenUtil().setWidth(46),
color: MyColours.color_dfdfdf,
)
: SizedBox(),
Offstage(
offstage: noon == "00:00-00:00" ? true : false,
child: Selector<NoteBookModel, String>(
selector: (context, model) =>
model.totalnoon,
builder: (context, total, child) {
return CommonButtonFlat(
content: "午餐" + total,
state: currTimeIndex == 2 ? 1 : 0,
fontSize: 28,
width: ScreenUtil().setWidth(240 * 2) /
btnNum,
padding: EdgeInsets.symmetric(
vertical:
ScreenUtil().setWidth(20)),
left: morning == "00:00-00:00"
? true
: false,
right: night == "00:00-00:00"
? true
: false,
onPress: () {
if (currTimeIndex == 2) return;
setState(() {
currTimeIndex = 2;
});
_getReserveList();
},
);
})),
btnNum == 3 && currTimeIndex == 1
? MyDivider(
ScreenUtil().setWidth(4),
ScreenUtil().setWidth(46),
color: MyColours.color_dfdfdf,
)
: SizedBox(),
Offstage(
offstage: night == "00:00-00:00" ? true : false,
child: Container(
child: Selector<NoteBookModel, String>(
selector: (context, model) =>
model.totalnight,
builder: (context, total, child) {
return CommonButtonFlat(
content: "晚餐" + total,
left: morning == "00:00-00:00" &&
noon == "00:00-00:00"
? true
: false,
state: currTimeIndex == 3 ? 1 : 0,
fontSize: 28,
width:
ScreenUtil().setWidth(240 * 2) /
btnNum,
onPress: () {
if (currTimeIndex == 3) return;
setState(() {
currTimeIndex = 3;
});
_getReserveList();
},
);
})),
),
],
),
),
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))
],
),
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))
],
),
],
)),
Expanded(child: Consumer<NoteBookModel>(
builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
_getReserveList();
_reserveCountDay();
},
emptyMsg: "暂时没有预订哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Container(
color: MyColours.color_F8F9FD,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(24)),
child: EasyRefresh.custom(
controller: _controller,
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Container(
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(24)),
child: NoteBookItemF(
model.notebooks[index], index),
);
}, childCount: model.notebooks.length),
// itemExtent: ScreenUtil().setWidth(112),
)
],
onRefresh: () async {
_getReserveList();
},
));
}
},
))
],
)),
);
... ... @@ -862,24 +1086,24 @@ class NoteBookPageState extends State<NoteBookPage> {
],
),
),
Selector<NoteBookModel, String>(
selector: (context, model) => model.total,
builder: (context, total, child) {
return Container(
width: double.infinity,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(38)),
height: ScreenUtil().setHeight(72),
color: MyColours.color_f5f5f5,
child: Text(
total,
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(26)),
),
);
},
),
// Selector<NoteBookModel, String>(
// selector: (context, model) => model.total,
// builder: (context, total, child) {
// return Container(
// width: double.infinity,
// alignment: Alignment.centerLeft,
// padding: EdgeInsets.only(left: ScreenUtil().setWidth(38)),
// height: ScreenUtil().setHeight(72),
// color: MyColours.color_f5f5f5,
// child: Text(
// total,
// style: TextStyle(
// color: MyColours.color_353535,
// fontSize: ScreenUtil().setSp(26)),
// ),
// );
// },
// ),
_buildListTitle(),
Expanded(child: Consumer<NoteBookModel>(
builder: (context, model, _) {
... ...
... ... @@ -13,7 +13,9 @@ import 'package:provider/provider.dart';
class NoteBookModel extends ChangeNotifier {
List<Notebook> notebooks = []; //订单列表
String total = ""; //一天统计
String totalmorning = ""; //一天统计
String totalnoon = ""; //一天统计
String totalnight = ""; //一天统计
PageState pageState = PageState.Loading;
... ... @@ -79,15 +81,15 @@ class NoteBookModel extends ChangeNotifier {
int noon = int.parse(baseResp.data["noon"].toString());
int night = int.parse(baseResp.data["night"].toString());
UserModel userModel = Provider.of<UserModel>(context, listen: false);
total = "已订" + (morning + noon + night).toString();
// total = "已订" + (morning + noon + night).toString();
if (userModel.user.morning.isNotEmpty) {
total += " 早市" + morning.toString();
totalmorning += "($morning";
}
if (userModel.user.noon.isNotEmpty) {
total += " 午市" + noon.toString();
totalmorning += "($noon";
}
if (userModel.user.night.isNotEmpty) {
total += " 晚市" + night.toString();
totalmorning += "($night";
}
notifyListeners();
}
... ...
import 'package:flutter/material.dart';
class MyColours {
static const Color color_A78E44 = Color(0xffA78E44);
static const Color color_260101 = Color(0xff260101);
static const Color color_ED7B2F = Color(0xffED7B2F);
static const Color color_DBDBDB = Color(0xffDBDBDB);
static const Color color_F8F9FD = Color(0xffF8F9FD);
... ...
... ... @@ -835,6 +835,10 @@ class Utils {
return phone.replaceFirst(new RegExp(r'\d{4}'), '****', 3);
}
static String showEndPhone(String phone) {
return '*' + phone.substring(phone.length - 4);
}
static List<String> stringToList(String str) {
List<String> list = <String>[];
// for (var value in JsonDecoder().convert(str)) {
... ...
... ... @@ -12,6 +12,7 @@ class CommonButtonFlat extends StatelessWidget {
final FontWeight fontWeight;
final bool left;
final bool right;
final EdgeInsets padding;
CommonButtonFlat(
{this.onPress,
this.content,
... ... @@ -21,7 +22,8 @@ class CommonButtonFlat extends StatelessWidget {
this.fontSize = 18,
this.fontWeight = FontWeight.normal,
this.left = true,
this.right = true});
this.right = true,
this.padding = EdgeInsets.zero});
@override
Widget build(BuildContext context) {
... ... @@ -157,6 +159,7 @@ class CommonButtonFlat extends StatelessWidget {
onTap: onPress,
child: Container(
width: width,
padding: padding,
// height: ScreenUtil().setWidth(height),
decoration: boxDecoration,
... ...