verify_food_page.dart 13.9 KB
// import 'package:flutter/material.dart';
// import 'package:one_key/provider/user_model.dart';
// import 'package:one_key/widgets/MyDivider.dart';
// import 'package:one_key/widgets/system_app_bar.dart';
// import 'package:provider/provider.dart';

// import '../../models/reserve_recheck_model.dart';
// import '../../provider/notebook_detail_model.dart';
// import '../../res/colors.dart';
// import '../../utils/event_bus.dart';
// import '../../utils/screen_util.dart';
// import '../../utils/utils.dart';
// import '../../widgets/h_empty_view.dart';
// import '../../widgets/round_button.dart';
// import '../../widgets/v_empty_view.dart';

// /**
//  * 核餐页面
//  * */
// class VerifyFoodPageSim extends StatefulWidget {
//   final String rid;
//   VerifyFoodPageSim({Key key, this.rid}) : super(key: key);

//   @override
//   _VerifyFoodPageSimState createState() => _VerifyFoodPageSimState();
// }

// class _VerifyFoodPageSimState extends State<VerifyFoodPageSim> {
//   bool confirmed = true; //已确认
//   bool connected = false; //未接通
//   bool undetermined = false; //待定

//   TextEditingController customController = TextEditingController();
//   FocusNode _cusdemNode = FocusNode();
//   NotebookDetailModel detailModel;
//   ScrollController controller = ScrollController();

//   @override
//   void initState() {
//     // TODO: implement initState
//     super.initState();
//     WidgetsBinding.instance.addPostFrameCallback((_) async {
//       _getReserveRecheckByRid();
//     });
//   }

//   _itemRadioWidget(bool select, String title, {GestureTapCallback onTap}) {
//     return InkWell(
//         onTap: onTap,
//         child: Row(children: [
//           Image.asset(
//             Utils.getImgPath(
//                 select ? 'plan_dish_select' : 'plan_dish_unselect'),
//             width: w(20),
//           ),
//           HEmptyView(6),
//           Text(
//             title,
//             style: TextStyle(color: MyColours.color_515151, fontSize: font(16)),
//           ),
//         ]));
//   }

//   ///创建核餐
//   _createReserveRecheck() async {
//     Map<String, String> pramas = {
//       'rid': widget.rid,
//       'uid': Provider.of<UserModel>(context, listen: false).user.openid,
//       'type': confirmed
//           ? '1'
//           : connected
//               ? '2'
//               : '3', //1 已确认 2 未接通 3 待定
//       'desc': customController.text
//     };
//     bool success = await detailModel.createReserveRecheck(context, pramas);
//     if (success) {
//       Utils.showToast('保存成功');

//       bus.emit('refresh_detail_reserve_recheck');
//       bus.emit('refresh_book_list');
//       Navigator.pop(context);
//     }
//   }

//   ///获取核餐记录
//   _getReserveRecheckByRid() async {
//     Map<String, String> params = {
//       'rid': widget.rid,
//     };
//     await detailModel.getReserveRecheckByRid(context, params);
//   }

//   @override
//   Widget build(BuildContext context) {
//     detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
//     return Scaffold(
//       backgroundColor: MyColours.color_ffffff,
//       appBar: SystemAppBar('核餐确认'),
//       body: Column(
//         children: [
//           Expanded(
//               child: SingleChildScrollView(
//                   controller: controller,
//                   child: Padding(
//                     padding: EdgeInsets.symmetric(
//                         horizontal: w(16), vertical: w(24)),
//                     child: Column(
//                       crossAxisAlignment: CrossAxisAlignment.start,
//                       children: [
//                         Row(
//                           children: [
//                             _itemRadioWidget(confirmed, '已确认', onTap: () {
//                               if (!confirmed) {
//                                 setState(() {
//                                   confirmed = true;

//                                   connected = false;
//                                   undetermined = false;
//                                 });
//                               }
//                             }),
//                             Spacer(),
//                             _itemRadioWidget(connected, '未接通', onTap: () {
//                               if (!connected) {
//                                 setState(() {
//                                   connected = true;

//                                   confirmed = false;
//                                   undetermined = false;
//                                 });
//                               }
//                             }),
//                             Spacer(),
//                             _itemRadioWidget(undetermined, '待定', onTap: () {
//                               if (!undetermined) {
//                                 setState(() {
//                                   undetermined = true;
//                                   connected = false;
//                                   confirmed = false;
//                                 });
//                               }
//                             }),
//                           ],
//                         ),
//                         VEmptyView(40),

//                         Text(
//                           '备注',
//                           style: TextStyle(
//                               color: MyColours.color_515151,
//                               fontSize: font(15)),
//                         ),

//                         VEmptyView(30),
//                         //输入框
//                         Container(
//                           width: double.infinity,
//                           padding: EdgeInsets.symmetric(
//                               horizontal: w(10), vertical: w(10)),
//                           alignment: Alignment.topLeft,
//                           decoration: BoxDecoration(
//                               color: MyColours.color_ffffff,
//                               border: Border.all(
//                                   color: MyColours.color_DBDBDB, width: w(1)),
//                               borderRadius: BorderRadius.circular(r(8))),
//                           child: TextField(
//                               controller: customController,
//                               focusNode: _cusdemNode,
//                               style: TextStyle(
//                                   color: MyColours.color_333333,
//                                   fontSize: font(14),
//                                   textBaseline: TextBaseline.alphabetic),
//                               textAlignVertical: TextAlignVertical.center,
//                               maxLines: 5,
//                               maxLength: 100,
//                               decoration: InputDecoration(
//                                 hintText: "请输入备注或点击快捷选择标签",
//                                 hintStyle: TextStyle(
//                                   color: MyColours.color_979797,
//                                   fontSize: font(14),
//                                 ),
//                                 contentPadding: EdgeInsets.zero,
//                                 border: OutlineInputBorder(
//                                     borderSide: BorderSide.none),
//                               ),
//                               keyboardType: TextInputType.text,
//                               onChanged: (value) {
//                                 // setState(() {
//                                 //   currentRemark = value ?? "";
//                                 // });
//                                 // if (value.length < currRemark.length &&
//                                 //     currRemark.substring(value.length) != ',') {
//                                 //   setState(() {
//                                 //     currRemark = value ?? "";
//                                 //   });
//                                 //   if (sum == 0) {
//                                 //     for (int i = 0; i < remarks.length; i++) {
//                                 //       if (remarks[i].isSelect &&
//                                 //           remarks[i].remark == selectItem.last) {
//                                 //         setState(() {
//                                 //           remarks[i].isSelect = false;
//                                 //         });
//                                 //       }
//                                 //     }
//                                 //   }
//                                 //   sum++;
//                                 //   if (sum == selectItem.last.length ||
//                                 //       selectItem.length == 1 ||
//                                 //       selectItem.length == 0) {
//                                 //     selectItem.removeLast();
//                                 //     sum = 0;
//                                 //   }
//                                 // } else {
//                                 //   setState(() {
//                                 //     currRemark = value ?? "";
//                                 //   });
//                                 // }
//                               }),
//                         ),
//                         VEmptyView(20),
//                         MyDivider(
//                           double.infinity,
//                           w(0.5),
//                           color: MyColours.color_BFC4D4,
//                         ),
//                         VEmptyView(30),
//                         ListView.builder(
//                             padding: EdgeInsets.only(left: w(13), top: w(20)),
//                             itemCount: detailModel.reserveRecheckList.length,
//                             shrinkWrap: true,
//                             controller: controller,
//                             itemBuilder: (BuildContext context, int index) {
//                               ReserveRecheckSunModel data =
//                                   detailModel.reserveRecheckList[index];
//                               return Container(
//                                   margin: EdgeInsets.only(bottom: w(10)),
//                                   child: Column(
//                                     children: [
//                                       Row(
//                                           mainAxisAlignment:
//                                               MainAxisAlignment.spaceBetween,
//                                           children: [
//                                             Text(
//                                               '${data.typeShow}',
//                                               overflow: TextOverflow.ellipsis,
//                                               style: TextStyle(
//                                                   color: MyColours.color_515151,
//                                                   fontSize: font(14)),
//                                             ),
//                                             Text(
//                                               '${data.nickName} ${data.cdateStr}',
//                                               overflow: TextOverflow.ellipsis,
//                                               style: TextStyle(
//                                                   color: MyColours.color_999999,
//                                                   fontSize: font(14)),
//                                             ),
//                                           ]),
//                                       Align(
//                                         alignment: Alignment.centerRight,
//                                         child: Text(
//                                           '${data.desc}',
//                                           textAlign: TextAlign.right,
//                                           // overflow: TextOverflow.ellipsis,
//                                           style: TextStyle(
//                                               color: MyColours.color_999999,
//                                               fontSize: font(14)),
//                                         ),
//                                       ),
//                                     ],
//                                   ));
//                             }),
//                       ],
//                     ),
//                   ))),
//           Container(
//             padding: EdgeInsets.symmetric(horizontal: w(24), vertical: w(35)),
//             child: Row(
//               children: [
//                 RoundButton(
//                   text: '取消',
//                   width: w(100),
//                   height: w(43),
//                   radius: r(5),
//                   fontSize: 32,
//                   isBold: true,
//                   gradientStart: MyColours.color_ffffff,
//                   gradientEnd: MyColours.color_ffffff,
//                   textColor: MyColours.color_438E93,
//                   borderColor: MyColours.color_438E93,
//                   onPressed: () {
//                     Navigator.pop(context);
//                   },
//                 ),
//                 HEmptyView(24),
//                 Expanded(
//                     child: RoundButton(
//                   text: '保存',
//                   height: w(43),
//                   radius: r(5),
//                   isBold: true,
//                   fontSize: 32,
//                   gradientStart: MyColours.color_438E93,
//                   gradientEnd: MyColours.color_438E93,
//                   textColor: MyColours.color_ffffff,
//                   borderColor: MyColours.color_438E93,
//                   onPressed: () {
//                     _createReserveRecheck();
//                   },
//                 )),
//               ],
//             ),
//           )
//         ],
//       ),
//     );
//   }
// }