Commit e207a2053b0db78bd50c2abb7cc2700a96416872

Authored by wdn127929
1 parent d903a39c

用餐人数

... ... @@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_picker/flutter_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
... ... @@ -70,6 +71,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
String formatPhone = "";
OnlineCheckEditProvider _onlineCheckEditProvider;
List<String> personNumList = []; // 人数
@override
void initState() {
... ... @@ -79,6 +81,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
_initCancel();
_getReserveDetail();
_getOrderInfo();
_initPersonNumList();
managers = await detailModel.getManagers(context);
//添加listener监听
//对应的TextField失去或者获取焦点都会回调此监听
... ... @@ -99,6 +102,15 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
});
}
//人数
_initPersonNumList() {
personNumList = [];
for (int i = 1; i < 31; i++) {
personNumList.add(i.toString());
}
personNumList.add('30以上');
}
//设置消息状态
setMessageStatus() {
if (widget.mid == null || widget.mid.isEmpty) return;
... ... @@ -517,14 +529,6 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
children: <Widget>[
RowMultiText("用餐时间",
detailEntity.ddateHm),
Offstage(
offstage:
detailEntity.type == "0"
? false
: true,
child: RowMultiText("用餐人数",
detailEntity.pnum),
)
],
),
Image.asset(
... ... @@ -535,6 +539,17 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
],
),
Offstage(
offstage: detailEntity.type == "0"
? false
: true,
child: TitleAndTextfield(
title: "用餐人数",
bookNum: detailEntity.pnum,
pnumlist: personNumList,
detailModel: model,
),
),
Offstage(
offstage:
detailEntity.demands.length <= 0
? true
... ... @@ -1176,3 +1191,140 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
);
}
}
class TitleAndTextfield extends StatelessWidget {
final String title;
final String bookNum;
final List<String> pnumlist;
final NotebookDetailModel detailModel;
const TitleAndTextfield(
{Key key, this.title, this.bookNum, this.pnumlist, this.detailModel})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
color: MyColours.color_ffffff,
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(25)),
alignment: Alignment.center,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Align(
alignment: Alignment.centerLeft,
child: Text(
title,
style: TextStyle(
color: MyColours.color_828282,
fontSize: ScreenUtil().setSp(30)),
),
),
Spacer(),
Text(
"预订$bookNum人 实到",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(30)),
softWrap: true,
),
HEmptyView(10),
InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(context, pnumlist, (value) {
if (value != null) {
detailModel.selectNum = value.first;
detailModel.notifyListeners();
// setState(() {
// selectPnum = value.first;
// pnum = pnumlist[value.first];
// });
}
},
selecteds: detailModel.selectNum == null
? []
: [detailModel.selectNum])
.then((value) {});
},
child: Container(
height: ScreenUtil().setWidth(44),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_199095))),
child: Text(
detailModel.selectNum == null
? "修改"
: "${detailModel.selectNum}",
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(32))),
),
),
HEmptyView(10),
Padding(
padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(6)),
child: Text(
"人",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(30)),
),
),
]));
}
}
// Container(
// alignment: Alignment.center,
// // color: Colors.red,
// width: ScreenUtil().setWidth(114),
// height: ScreenUtil().setWidth(50),
// // padding: EdgeInsets.zero,
// child: TextField(
// controller: widget.model.numController,
// maxLines: 1,
// inputFormatters: [
// LengthLimitingTextInputFormatter(3),
// WhitelistingTextInputFormatter.digitsOnly
// ],
// //光标颜色
// cursorColor:
// 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) {
// },
// onEditingComplete: () {
// // _cancelNode.unfocus();
// },
// keyboardType: TextInputType.number,
// ),
// )
... ...
... ... @@ -14,6 +14,7 @@ import 'package:provider/provider.dart';
class NotebookDetailModel extends ChangeNotifier {
PageState pageState = PageState.Loading;
int selectNum;
///获取已预订订单
Future<NotebookDetail> getReserveDetail(
... ...