|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_screenutil/screenutil.dart';
|
|
|
|
import 'package:one_key/models/notebook_detail.dart';
|
|
|
|
import 'package:one_key/provider/notebook_detail_change_model.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/utils/dialog_util.dart';
|
|
|
|
import 'package:one_key/utils/navigator_util.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/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/new_table_item.dart';
|
|
|
|
import 'package:one_key/widgets/table_item.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
typedef clickCallback = void Function(String value);
|
|
|
|
|
|
|
|
class NoteBookChangePage extends StatefulWidget {
|
|
|
|
final NotebookDetail detailEntity;
|
|
|
|
final String rid;
|
|
|
|
|
|
|
|
const NoteBookChangePage({Key key, this.detailEntity, this.rid})
|
|
|
|
: super(key: key);
|
|
|
|
@override
|
|
|
|
_NoteBookChangePageState createState() => _NoteBookChangePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _NoteBookChangePageState extends State<NoteBookChangePage> {
|
|
|
|
// String dateText = ""; //当前显示日期时间
|
|
|
|
// int currTimeIndex = 1; //当前选中时间段
|
|
|
|
// String morning; //早市时间段
|
|
|
|
// String noon; //午市时间段
|
|
|
|
// String night; //晚市时间段
|
|
|
|
|
|
|
|
DateTime dateTime; //当前日期
|
|
|
|
NotebookDetailChangeModel _notebookDetailChangeModel;
|
|
|
|
FocusNode _phoneNode = FocusNode();
|
|
|
|
FocusNode _nameNode = FocusNode();
|
|
|
|
FocusNode _needNode = FocusNode();
|
|
|
|
|
|
|
|
// //生成日期文本
|
|
|
|
// _createDateText(DateTime day) {
|
|
|
|
// if (Utils.isOneDay(day, dateTime)) return; //日期没变
|
|
|
|
// setState(() {
|
|
|
|
// DateTime dateNow = DateTime.now();
|
|
|
|
// if (Utils.isOneDay(day, dateNow)) {
|
|
|
|
// dateText = Utils.addZeroNumber(dateNow.month) +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateNow.day) +
|
|
|
|
// " 今天";
|
|
|
|
// } else {
|
|
|
|
// dateText =
|
|
|
|
// Utils.addZeroNumber(day.month) + "-" + Utils.addZeroNumber(day.day);
|
|
|
|
// }
|
|
|
|
// dateTime = day;
|
|
|
|
// });
|
|
|
|
// // _getReserveList();
|
|
|
|
// // _reserveCountDay();
|
|
|
|
// }
|
|
|
|
|
|
|
|
//初始化时间
|
|
|
|
_initTime() {
|
|
|
|
_notebookDetailChangeModel =
|
|
|
|
Provider.of<NotebookDetailChangeModel>(context, listen: false);
|
|
|
|
//今天
|
|
|
|
DateTime dateTime = DateTime.now();
|
|
|
|
int dateTimeMill = dateTime.millisecondsSinceEpoch;
|
|
|
|
String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'MM-dd');
|
|
|
|
_notebookDetailChangeModel.dateList.add({
|
|
|
|
'title': dateText,
|
|
|
|
'select': false,
|
|
|
|
'fontSize': 34.0,
|
|
|
|
'dayText': ' 今天',
|
|
|
|
'isImage': false
|
|
|
|
});
|
|
|
|
//明天
|
|
|
|
int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000;
|
|
|
|
String dateTextTomorrow =
|
|
|
|
DateUtil.formatDateMs(tomorrowMill, format: 'MM-dd');
|
|
|
|
_notebookDetailChangeModel.dateList.add({
|
|
|
|
'title': dateTextTomorrow,
|
|
|
|
'select': false,
|
|
|
|
'fontSize': 34.0,
|
|
|
|
'dayText': ' 明天',
|
|
|
|
'isImage': false
|
|
|
|
});
|
|
|
|
//第三个
|
|
|
|
_notebookDetailChangeModel.dateList.add({
|
|
|
|
'title': '其他',
|
|
|
|
'select': true,
|
|
|
|
'fontSize': 30.0,
|
|
|
|
'dayText': '',
|
|
|
|
'isImage': true
|
|
|
|
});
|
|
|
|
|
|
|
|
print(widget.detailEntity);
|
|
|
|
// dateList.add(value)
|
|
|
|
// morning =
|
|
|
|
// userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
|
|
|
|
// noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
|
|
|
|
// night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
|
|
|
|
// if (dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.month) +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.day) +
|
|
|
|
// " " +
|
|
|
|
// morning.split("-")[1] +
|
|
|
|
// ":00"))) {
|
|
|
|
// //未过早市
|
|
|
|
// currTimeIndex = 1;
|
|
|
|
// } else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.month) +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.day) +
|
|
|
|
// " " +
|
|
|
|
// morning.split("-")[1] +
|
|
|
|
// ":00")) &&
|
|
|
|
// dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.month) +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.day) +
|
|
|
|
// " " +
|
|
|
|
// noon.split("-")[1] +
|
|
|
|
// ":00"))) {
|
|
|
|
// //过了早市,未过午市
|
|
|
|
// currTimeIndex = 2;
|
|
|
|
// } else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.month) +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.day) +
|
|
|
|
// " " +
|
|
|
|
// noon.split("-")[1] +
|
|
|
|
// ":00")) &&
|
|
|
|
// dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.month) +
|
|
|
|
// "-" +
|
|
|
|
// Utils.addZeroNumber(dateTime.day) +
|
|
|
|
// " " +
|
|
|
|
// night.split("-")[1] +
|
|
|
|
// ":00"))) {
|
|
|
|
// //过了午市,未过晚市
|
|
|
|
// currTimeIndex = 3;
|
|
|
|
// } else {
|
|
|
|
// //过了晚市
|
|
|
|
// currTimeIndex = 3;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
dateTime = DateTime.now();
|
|
|
|
|
|
|
|
_notebookDetailChangeModel =
|
|
|
|
Provider.of<NotebookDetailChangeModel>(context, listen: false);
|
|
|
|
_notebookDetailChangeModel.initDateHourMinuteList(context);
|
|
|
|
_notebookDetailChangeModel.getNewTableList(context);
|
|
|
|
_initData();
|
|
|
|
|
|
|
|
// _initTime();
|
|
|
|
}
|
|
|
|
|
|
|
|
_initData() {
|
|
|
|
print(widget.detailEntity);
|
|
|
|
for (var item in widget.detailEntity.tables) {
|
|
|
|
item.selected = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_topWidget() {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
//第一行 日期选择
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: _notebookDetailChangeModel.dateList.map((value) {
|
|
|
|
return CustomButton(
|
|
|
|
dateText: value['title'],
|
|
|
|
fontSize: value['fontSize'],
|
|
|
|
dayText: value['dayText'],
|
|
|
|
isImage: value['isImage'],
|
|
|
|
isSelect: value['select'],
|
|
|
|
onTap: () {
|
|
|
|
for (int j = 0;
|
|
|
|
j < _notebookDetailChangeModel.dateList.length;
|
|
|
|
j++) {
|
|
|
|
_notebookDetailChangeModel.dateList[j]['select'] = false;
|
|
|
|
|
|
|
|
if (_notebookDetailChangeModel.dateList[j]['title'] ==
|
|
|
|
value['title']) {
|
|
|
|
_notebookDetailChangeModel.dateList[j]['select'] = true;
|
|
|
|
if (j == 0 || j == 1) {
|
|
|
|
_notebookDetailChangeModel.dateList[2]['title'] =
|
|
|
|
'其他';
|
|
|
|
}
|
|
|
|
if (j ==
|
|
|
|
_notebookDetailChangeModel.dateList.length - 1) {
|
|
|
|
String selectStr =
|
|
|
|
_notebookDetailChangeModel.dateList[2]['title'];
|
|
|
|
String timeNow = DateUtil.formatDate(
|
|
|
|
DateTime.now(),
|
|
|
|
);
|
|
|
|
String selectDate =
|
|
|
|
timeNow.replaceRange(5, 10, selectStr);
|
|
|
|
DialogUtil.showCalendarDialog(
|
|
|
|
context, DateUtil.getDateTime(selectDate))
|
|
|
|
.then((day) {
|
|
|
|
if (day != null) {
|
|
|
|
// _createDateText(day);
|
|
|
|
dateTime = day;
|
|
|
|
int dateTimeMill = day.millisecondsSinceEpoch;
|
|
|
|
String dateText = DateUtil.formatDateMs(
|
|
|
|
dateTimeMill,
|
|
|
|
format: 'MM-dd');
|
|
|
|
bool isThird = true;
|
|
|
|
for (int i = 0;
|
|
|
|
i <
|
|
|
|
_notebookDetailChangeModel
|
|
|
|
.dateList.length;
|
|
|
|
i++) {
|
|
|
|
_notebookDetailChangeModel.dateList[i]
|
|
|
|
['select'] = false;
|
|
|
|
|
|
|
|
if (_notebookDetailChangeModel.dateList[i]
|
|
|
|
['title'] ==
|
|
|
|
dateText) {
|
|
|
|
_notebookDetailChangeModel.dateList[i]
|
|
|
|
['select'] = true;
|
|
|
|
isThird = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isThird) {
|
|
|
|
_notebookDetailChangeModel.dateList[2]
|
|
|
|
['select'] = true;
|
|
|
|
_notebookDetailChangeModel.dateList[2]
|
|
|
|
['title'] = dateText;
|
|
|
|
} else {
|
|
|
|
_notebookDetailChangeModel.dateList[2]
|
|
|
|
['title'] = '其他';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_notebookDetailChangeModel.notifyListeners();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_notebookDetailChangeModel.notifyListeners();
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}).toList()),
|
|
|
|
|
|
|
|
VEmptyView(60),
|
|
|
|
//早市、午市、晚市
|
|
|
|
Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: _notebookDetailChangeModel.sunDateList.map((value) {
|
|
|
|
return Container(
|
|
|
|
margin: _notebookDetailChangeModel.sunDateList.length == 3 &&
|
|
|
|
value['ddateSolt'] == 3
|
|
|
|
? EdgeInsets.only(right: 0)
|
|
|
|
: EdgeInsets.only(right: ScreenUtil().setWidth(20)),
|
|
|
|
child: CustomButton(
|
|
|
|
onTap: () {
|
|
|
|
for (var item in _notebookDetailChangeModel.sunDateList) {
|
|
|
|
item['isSelect'] = false;
|
|
|
|
if (item['dateText'] == value['dateText']) {
|
|
|
|
item['isSelect'] = true;
|
|
|
|
String key = '';
|
|
|
|
|
|
|
|
if (item['ddateSolt'] == 1) {
|
|
|
|
//早市
|
|
|
|
key = 'morning';
|
|
|
|
} else if (item['ddateSolt'] == 2) {
|
|
|
|
//午市
|
|
|
|
key = 'noon';
|
|
|
|
} else if (item['ddateSolt'] == 3) {
|
|
|
|
//晚市
|
|
|
|
key = 'night';
|
|
|
|
}
|
|
|
|
if (key != '') {
|
|
|
|
for (var sunitem
|
|
|
|
in _notebookDetailChangeModel.dailyMap[key]) {
|
|
|
|
if (sunitem['select'] == true) {
|
|
|
|
_notebookDetailChangeModel.ddateStr =
|
|
|
|
sunitem['title'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_notebookDetailChangeModel.notifyListeners();
|
|
|
|
},
|
|
|
|
dateText: value['dateText'],
|
|
|
|
dayText: '',
|
|
|
|
isSelect: value['isSelect'],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}).toList()),
|
|
|
|
VEmptyView(60),
|
|
|
|
|
|
|
|
///人数选择
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: _notebookDetailChangeModel.personNumList.map((value) {
|
|
|
|
return CustomButton(
|
|
|
|
onTap: () {
|
|
|
|
for (int j = 0;
|
|
|
|
j < _notebookDetailChangeModel.personNumList.length;
|
|
|
|
j++) {
|
|
|
|
_notebookDetailChangeModel.personNumList[j]['isSelect'] =
|
|
|
|
false;
|
|
|
|
|
|
|
|
if (_notebookDetailChangeModel.personNumList[j]
|
|
|
|
['dateText'] ==
|
|
|
|
value['dateText']) {
|
|
|
|
_notebookDetailChangeModel.personNumList[j]['isSelect'] =
|
|
|
|
true;
|
|
|
|
_notebookDetailChangeModel.numController.text =
|
|
|
|
value['dateText'];
|
|
|
|
// if (j < 5) {
|
|
|
|
// _notebookDetailChangeModel.personNumList[5]
|
|
|
|
// ['dateText'] = '更多';
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_notebookDetailChangeModel.notifyListeners();
|
|
|
|
},
|
|
|
|
dateText: value['dateText'],
|
|
|
|
fontSize: value['fontSize'],
|
|
|
|
dayText: '',
|
|
|
|
width: value['width'],
|
|
|
|
isImage: value['isImage'],
|
|
|
|
isSelect: value['isSelect'],
|
|
|
|
isTextFiled: value['isTextFiled'],
|
|
|
|
model: _notebookDetailChangeModel,
|
|
|
|
);
|
|
|
|
}).toList(),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 可订桌位
|
|
|
|
_middleWidget() {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
|
|
|
|
color: MyColours.color_f5f5f5,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
'可订桌位',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_353535,
|
|
|
|
fontSize: ScreenUtil().setSp(30)),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
String tid = await NavigatorUtil.goSelectTablePage(
|
|
|
|
context,
|
|
|
|
widget.rid,
|
|
|
|
int.parse(widget.detailEntity.ddate) * 1000,
|
|
|
|
widget.detailEntity.ddate_solt);
|
|
|
|
if (tid != null) {
|
|
|
|
// setReserveStatus("5", tid: tid);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text('更多',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_353535,
|
|
|
|
fontSize: ScreenUtil().setSp(26))),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
'assets/arr_right_gray.png',
|
|
|
|
width: ScreenUtil().setWidth(12),
|
|
|
|
height: ScreenUtil().setWidth(22),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(32),
|
|
|
|
Align(
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: Offstage(
|
|
|
|
offstage: _notebookDetailChangeModel.tableList.length > 0
|
|
|
|
? false
|
|
|
|
: true,
|
|
|
|
child: Container(
|
|
|
|
// height: ScreenUtil().setHeight(178),
|
|
|
|
height: ScreenUtil().setHeight(210),
|
|
|
|
child: ListView.builder(
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
itemBuilder: (BuildContext contxt, int index) {
|
|
|
|
return NewTableItem(
|
|
|
|
_notebookDetailChangeModel.tableList[index],
|
|
|
|
height: 160,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
itemCount: _notebookDetailChangeModel.tableList.length > 3
|
|
|
|
? 3
|
|
|
|
: _notebookDetailChangeModel.tableList.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_bottomWidget() {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
),
|
|
|
|
margin: EdgeInsets.only(top: ScreenUtil().setWidth(72)),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(34),
|
|
|
|
color: MyColours.color_353535),
|
|
|
|
controller: _notebookDetailChangeModel.phoneController,
|
|
|
|
focusNode: _phoneNode,
|
|
|
|
// textAlignVertical: TextAlignVertical.top,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "客户电话",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(34),
|
|
|
|
),
|
|
|
|
// contentPadding:
|
|
|
|
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
|
|
|
|
border: InputBorder.none,
|
|
|
|
),
|
|
|
|
onChanged: (value) {},
|
|
|
|
onEditingComplete: () {
|
|
|
|
print('fff');
|
|
|
|
_phoneNode.unfocus();
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(40),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
_showDateChooseWidget(context);
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
int.parse(widget.detailEntity.is_set_ddate) == 0
|
|
|
|
? '未设置到店时间'
|
|
|
|
: _notebookDetailChangeModel.ddateStr,
|
|
|
|
style: TextStyle(
|
|
|
|
color: int.parse(widget.detailEntity.is_set_ddate) == 0
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(34),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_F1F0F4),
|
|
|
|
VEmptyView(72),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(34),
|
|
|
|
color: MyColours.color_353535),
|
|
|
|
controller: _notebookDetailChangeModel.nameController,
|
|
|
|
focusNode: _nameNode,
|
|
|
|
// textAlignVertical: TextAlignVertical.top,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "客户姓名(必填)",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(34),
|
|
|
|
),
|
|
|
|
// contentPadding:
|
|
|
|
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
|
|
|
|
border: InputBorder.none,
|
|
|
|
),
|
|
|
|
onChanged: (value) {},
|
|
|
|
onEditingComplete: () {
|
|
|
|
print('fff');
|
|
|
|
_nameNode.unfocus();
|
|
|
|
},
|
|
|
|
// keyboardType: TextInputType.number,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(40),
|
|
|
|
Row(
|
|
|
|
children: _notebookDetailChangeModel.sexList.map((value) {
|
|
|
|
return _callButton(
|
|
|
|
onPress: () {
|
|
|
|
for (var item in _notebookDetailChangeModel.sexList) {
|
|
|
|
item['select'] = false;
|
|
|
|
if (item['title'] == value['title']) {
|
|
|
|
item['select'] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_notebookDetailChangeModel.notifyListeners();
|
|
|
|
},
|
|
|
|
content: value['title'],
|
|
|
|
hasLeftBorder: value['hasLeftBorder'],
|
|
|
|
isSelect: value['select']);
|
|
|
|
}).toList()),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_F1F0F4),
|
|
|
|
VEmptyView(72),
|
|
|
|
TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(34),
|
|
|
|
color: MyColours.color_353535),
|
|
|
|
controller: _notebookDetailChangeModel.customController,
|
|
|
|
focusNode: _needNode,
|
|
|
|
// textAlignVertical: TextAlignVertical.top,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: "客户要求(25字以内,选填)",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(34),
|
|
|
|
),
|
|
|
|
// contentPadding:
|
|
|
|
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
|
|
|
|
border: InputBorder.none,
|
|
|
|
),
|
|
|
|
onChanged: (value) {},
|
|
|
|
onEditingComplete: () {
|
|
|
|
print('fff');
|
|
|
|
_needNode.unfocus();
|
|
|
|
},
|
|
|
|
// keyboardType: TextInputType.number,
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_F1F0F4),
|
|
|
|
// VEmptyView(72),
|
|
|
|
// VEmptyView(62),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///底部弹框,设置时间30分钟间隔布局
|
|
|
|
_showDateChooseWidget(BuildContext context) async {
|
|
|
|
List tempMndList = [];
|
|
|
|
|
|
|
|
String title = '早市';
|
|
|
|
String key;
|
|
|
|
for (var item in _notebookDetailChangeModel.sunDateList) {
|
|
|
|
if (item['isSelect'] == true) {
|
|
|
|
title = item['dateText'];
|
|
|
|
key = item['key'];
|
|
|
|
tempMndList = _notebookDetailChangeModel.dailyMap[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//计算行数
|
|
|
|
|
|
|
|
int line = 0;
|
|
|
|
int count = tempMndList.length;
|
|
|
|
if (count % 3 == 0) {
|
|
|
|
line = int.parse('${count / 3}');
|
|
|
|
} else {
|
|
|
|
line = (count / 3).ceil();
|
|
|
|
}
|
|
|
|
int height = 85 + 40 + 36 * line + (line - 1) * 15;
|
|
|
|
final option = await showModalBottomSheet(
|
|
|
|
context: context,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
builder: (context) {
|
|
|
|
return StatefulBuilder(builder: (context, state) {
|
|
|
|
return SafeArea(
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(10))),
|
|
|
|
height: ScreenUtil().setWidth(height * 2),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
child: Align(
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
ScreenUtil().setWidth(10)),
|
|
|
|
child: Image.asset(
|
|
|
|
'assets/icon_exist.png',
|
|
|
|
width: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Center(
|
|
|
|
child: Text(title,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(34),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: MyColours.color_353535)),
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(60)),
|
|
|
|
child: GridView.builder(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.only(top: ScreenUtil().setWidth(20)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
cacheExtent: ScreenUtil().setWidth(0),
|
|
|
|
itemCount: tempMndList.length,
|
|
|
|
gridDelegate:
|
|
|
|
SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 3,
|
|
|
|
childAspectRatio: 80 / 36,
|
|
|
|
mainAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(15 * 2),
|
|
|
|
crossAxisSpacing:
|
|
|
|
ScreenUtil().setWidth(38 * 2)),
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
// locationState = state;
|
|
|
|
return CustomButton(
|
|
|
|
onTap: () {
|
|
|
|
// state(() {
|
|
|
|
for (var item in tempMndList) {
|
|
|
|
item['select'] = false;
|
|
|
|
if (item['title'] ==
|
|
|
|
tempMndList[index]['title']) {
|
|
|
|
item['select'] = true;
|
|
|
|
widget.detailEntity.is_set_ddate = '1';
|
|
|
|
_notebookDetailChangeModel.ddateStr =
|
|
|
|
item['title'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// });
|
|
|
|
|
|
|
|
_notebookDetailChangeModel.notifyListeners();
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
width: 80,
|
|
|
|
height: 36,
|
|
|
|
dateText: tempMndList[index]['title'].toString(),
|
|
|
|
dayText: '',
|
|
|
|
isSelect: tempMndList[index]['select'],
|
|
|
|
);
|
|
|
|
}))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _callButton(
|
|
|
|
{GestureTapCallback onPress,
|
|
|
|
content,
|
|
|
|
hasLeftBorder = true,
|
|
|
|
isSelect = false}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onPress,
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil().setWidth(84),
|
|
|
|
height: ScreenUtil().setHeight(48),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: isSelect ? MyColours.color_199095 : MyColours.color_fefefe,
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
color: MyColours.color_6AB6B9,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
top: BorderSide(
|
|
|
|
color: MyColours.color_6AB6B9,
|
|
|
|
width: ScreenUtil().setWidth(1)),
|
|
|
|
left: hasLeftBorder
|
|
|
|
? BorderSide(
|
|
|
|
color: MyColours.color_6AB6B9,
|
|
|
|
width: ScreenUtil().setWidth(2))
|
|
|
|
: BorderSide.none,
|
|
|
|
right: BorderSide(
|
|
|
|
color: MyColours.color_6AB6B9,
|
|
|
|
width: ScreenUtil().setWidth(2)))),
|
|
|
|
child: Align(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
content,
|
|
|
|
style: TextStyle(
|
|
|
|
color: isSelect ? Colors.white : MyColours.color_353535,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
_notebookDetailChangeModel =
|
|
|
|
Provider.of<NotebookDetailChangeModel>(context, listen: true);
|
|
|
|
return GestureDetector(
|
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
child: Scaffold(
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
body: Column(children: <Widget>[
|
|
|
|
SizedBox(height: ScreenUtil.statusBarHeight),
|
|
|
|
MyAppBar(
|
|
|
|
"变更预订",
|
|
|
|
showBack: true,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [_topWidget(), _middleWidget(), _bottomWidget()],
|
|
|
|
))),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
vertical: ScreenUtil().setWidth(60),
|
|
|
|
),
|
|
|
|
child: CommonButton(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 84,
|
|
|
|
fontSize: 34,
|
|
|
|
content: "确定修改",
|
|
|
|
state: 2,
|
|
|
|
onPress: () {
|
|
|
|
_notebookDetailChangeModel.setReserveInfo(context);
|
|
|
|
// messageDialogModel.removeMessage(message.id);
|
|
|
|
// NavigatorUtil.goHandleOnlinePage(
|
|
|
|
// context, message.rid.toString(), message.id,
|
|
|
|
// replace: messageDialogModel.messages.isEmpty);
|
|
|
|
},
|
|
|
|
))
|
|
|
|
]),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class CustomButton extends StatefulWidget {
|
|
|
|
final String dateText;
|
|
|
|
final String dayText;
|
|
|
|
final bool isSelect;
|
|
|
|
final double fontSize;
|
|
|
|
final bool isImage;
|
|
|
|
final double width;
|
|
|
|
final GestureTapCallback onTap;
|
|
|
|
final bool isTextFiled;
|
|
|
|
final NotebookDetailChangeModel model;
|
|
|
|
final double height;
|
|
|
|
|
|
|
|
const CustomButton({
|
|
|
|
Key key,
|
|
|
|
this.dateText,
|
|
|
|
this.dayText,
|
|
|
|
this.isSelect,
|
|
|
|
this.fontSize = 34,
|
|
|
|
this.isImage = false,
|
|
|
|
this.width = 105,
|
|
|
|
this.onTap,
|
|
|
|
this.isTextFiled = false,
|
|
|
|
this.model,
|
|
|
|
this.height = 25,
|
|
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
|
|
_ButtonState createState() => _ButtonState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ButtonState extends State<CustomButton> {
|
|
|
|
FocusNode _cancelNode = FocusNode();
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: widget.onTap,
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil().setWidth(widget.width * 2),
|
|
|
|
height: ScreenUtil().setWidth(widget.height * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: widget.isSelect ? MyColours.color_199095 : Colors.white,
|
|
|
|
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
width: ScreenUtil().setWidth(2))),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
widget.isTextFiled
|
|
|
|
? Container(
|
|
|
|
width: ScreenUtil().setWidth(70),
|
|
|
|
height: ScreenUtil().setWidth(50),
|
|
|
|
child: TextField(
|
|
|
|
controller: widget.model.numController,
|
|
|
|
maxLines: 1,
|
|
|
|
inputFormatters: [LengthLimitingTextInputFormatter(3)],
|
|
|
|
//光标颜色
|
|
|
|
cursorColor: widget.isSelect
|
|
|
|
? Colors.white
|
|
|
|
: MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
color: widget.isSelect
|
|
|
|
? Colors.white
|
|
|
|
: MyColours.color_199095),
|
|
|
|
// controller: _cancelController,
|
|
|
|
focusNode: _cancelNode,
|
|
|
|
textAlignVertical: TextAlignVertical.bottom,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
// fillColor: Colors.lightGreenAccent,
|
|
|
|
// filled: true,
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
hintText: "更多",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: widget.isSelect
|
|
|
|
? Colors.white
|
|
|
|
: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
),
|
|
|
|
// contentPadding: EdgeInsets.only(
|
|
|
|
// bottom: ScreenUtil().setWidth(30)), //ios 17
|
|
|
|
// border: InputBorder.none,
|
|
|
|
),
|
|
|
|
onChanged: (value) {
|
|
|
|
bool isThird = true;
|
|
|
|
for (int i = 0;
|
|
|
|
i < widget.model.personNumList.length;
|
|
|
|
i++) {
|
|
|
|
widget.model.personNumList[i]['isSelect'] = false;
|
|
|
|
|
|
|
|
if (widget.model.personNumList[i]['dateText'] ==
|
|
|
|
value) {
|
|
|
|
widget.model.personNumList[i]['isSelect'] = true;
|
|
|
|
isThird = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isThird) {
|
|
|
|
widget.model.personNumList[5]['isSelect'] = true;
|
|
|
|
widget.model.personNumList[5]['dateText'] = value;
|
|
|
|
} else {
|
|
|
|
widget.model.personNumList[5]['dateText'] = '更多';
|
|
|
|
}
|
|
|
|
widget.model.notifyListeners();
|
|
|
|
},
|
|
|
|
onEditingComplete: () {
|
|
|
|
print('fff');
|
|
|
|
_cancelNode.unfocus();
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Text(widget.dateText,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: widget.isSelect
|
|
|
|
? MyColours.color_fefefe
|
|
|
|
: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(widget.fontSize))),
|
|
|
|
widget.isImage ? HEmptyView(20) : Container(),
|
|
|
|
widget.isImage
|
|
|
|
? Image.asset(
|
|
|
|
widget.isSelect
|
|
|
|
? 'assets/message_selected.png'
|
|
|
|
: 'assets/message_default.png',
|
|
|
|
width: ScreenUtil().setWidth(36))
|
|
|
|
: Text(widget.dayText,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: widget.isSelect
|
|
|
|
? MyColours.color_fefefe
|
|
|
|
: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(30)))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|