Showing
16 changed files
with
778 additions
and
45 deletions
| @@ -11,14 +11,14 @@ if (flutterRoot == null) { | @@ -11,14 +11,14 @@ if (flutterRoot == null) { | ||
| 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | -def flutterVersionCode = "152" | 14 | +def flutterVersionCode = "153" |
| 15 | if (flutterVersionCode == null) { | 15 | if (flutterVersionCode == null) { |
| 16 | - flutterVersionCode = '152' | 16 | + flutterVersionCode = '153' |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | -def flutterVersionName = "1.5.2" | 19 | +def flutterVersionName = "1.5.3" |
| 20 | if (flutterVersionName == null) { | 20 | if (flutterVersionName == null) { |
| 21 | - flutterVersionName = '1.5.2' | 21 | + flutterVersionName = '1.5.3' |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | apply plugin: 'com.android.application' | 24 | apply plugin: 'com.android.application' |
| @@ -34,7 +34,7 @@ Future<void> main() async { | @@ -34,7 +34,7 @@ Future<void> main() async { | ||
| 34 | Routes.configureRoutes(router); | 34 | Routes.configureRoutes(router); |
| 35 | App.router = router; | 35 | App.router = router; |
| 36 | App.setupLocator(); | 36 | App.setupLocator(); |
| 37 | - LogUtil.init(isDebug: false, tag: 'ONE_KEY'); | 37 | + LogUtil.init(isDebug: true, tag: 'ONE_KEY'); |
| 38 | Provider.debugCheckInvalidValueType = null; | 38 | Provider.debugCheckInvalidValueType = null; |
| 39 | await initializeDateFormatting(); | 39 | await initializeDateFormatting(); |
| 40 | Utils.changeStatusColor(); | 40 | Utils.changeStatusColor(); |
lib/models/remark.dart
0 → 100644
| 1 | +import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | + | ||
| 3 | +part 'remark.g.dart'; | ||
| 4 | + | ||
| 5 | +@JsonSerializable() | ||
| 6 | +class Remark extends Object { | ||
| 7 | + @JsonKey(name: 'id') | ||
| 8 | + String id; | ||
| 9 | + | ||
| 10 | + @JsonKey(name: 'uid') | ||
| 11 | + String uid; | ||
| 12 | + | ||
| 13 | + @JsonKey(name: 'often_use') | ||
| 14 | + String oftenUse; | ||
| 15 | + | ||
| 16 | + @JsonKey(name: 'custom') | ||
| 17 | + String custom; | ||
| 18 | + | ||
| 19 | + @JsonKey(name: 'cdate') | ||
| 20 | + String cdate; | ||
| 21 | + | ||
| 22 | + bool selected = false; | ||
| 23 | + | ||
| 24 | + Remark(); | ||
| 25 | + | ||
| 26 | + factory Remark.fromJson(Map<String, dynamic> srcJson) => | ||
| 27 | + _$RemarkFromJson(srcJson); | ||
| 28 | + | ||
| 29 | + Map<String, dynamic> toJson() => _$RemarkToJson(this); | ||
| 30 | +} |
lib/models/remark.g.dart
0 → 100644
| 1 | +// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | + | ||
| 3 | +part of 'remark.dart'; | ||
| 4 | + | ||
| 5 | +// ************************************************************************** | ||
| 6 | +// JsonSerializableGenerator | ||
| 7 | +// ************************************************************************** | ||
| 8 | + | ||
| 9 | +Remark _$RemarkFromJson(Map<String, dynamic> json) { | ||
| 10 | + return Remark() | ||
| 11 | + ..id = json['id'] as String | ||
| 12 | + ..uid=json['uid'] as String | ||
| 13 | + ..oftenUse=json['often_use'] as String | ||
| 14 | + ..custom=json['custom'] as String | ||
| 15 | + ..cdate = json['cdate'] as String; | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +Map<String, dynamic> _$RemarkToJson(Remark instance) => <String, dynamic>{ | ||
| 19 | + 'id': instance.id, | ||
| 20 | + 'uid': instance.uid, | ||
| 21 | + 'often_use': instance.oftenUse, | ||
| 22 | + 'custom': instance.custom, | ||
| 23 | + 'cdate': instance.cdate, | ||
| 24 | +}; |
| @@ -45,4 +45,12 @@ class HttpUrl { | @@ -45,4 +45,12 @@ class HttpUrl { | ||
| 45 | static const String set_order_time = | 45 | static const String set_order_time = |
| 46 | "?service=App.Seller.SetReOrderTime"; //在线预订配置-接单时间 | 46 | "?service=App.Seller.SetReOrderTime"; //在线预订配置-接单时间 |
| 47 | 47 | ||
| 48 | + static const String get_custom_remark= | ||
| 49 | + "?service=App.User.GetCustomRemark"; //获取常用备注 | ||
| 50 | + | ||
| 51 | + static const String del_custom_remark= | ||
| 52 | + "?service=App.User.DelCustomRemark"; //删除常用备注 | ||
| 53 | + | ||
| 54 | + static const String add_custom_remark= | ||
| 55 | + "?service=App.User.AddCustomRemark"; //添加常用备注 | ||
| 48 | } | 56 | } |
| @@ -2,16 +2,18 @@ import 'dart:convert'; | @@ -2,16 +2,18 @@ import 'dart:convert'; | ||
| 2 | import 'dart:ui'; | 2 | import 'dart:ui'; |
| 3 | 3 | ||
| 4 | import 'package:common_utils/common_utils.dart'; | 4 | import 'package:common_utils/common_utils.dart'; |
| 5 | +// import 'package:contacts_service/contacts_service.dart'; | ||
| 5 | import 'package:flutter/material.dart'; | 6 | import 'package:flutter/material.dart'; |
| 6 | import 'package:flutter/services.dart'; | 7 | import 'package:flutter/services.dart'; |
| 7 | import 'package:flutter_screenutil/screenutil.dart'; | 8 | import 'package:flutter_screenutil/screenutil.dart'; |
| 8 | import 'package:one_key/models/notebook_detail.dart'; | 9 | import 'package:one_key/models/notebook_detail.dart'; |
| 10 | +import 'package:one_key/models/remark.dart'; | ||
| 9 | import 'package:one_key/models/reserve_info_model.dart'; | 11 | import 'package:one_key/models/reserve_info_model.dart'; |
| 10 | import 'package:one_key/provider/notebook_detail_change_model.dart'; | 12 | import 'package:one_key/provider/notebook_detail_change_model.dart'; |
| 11 | import 'package:one_key/provider/notebook_detail_model.dart'; | 13 | import 'package:one_key/provider/notebook_detail_model.dart'; |
| 14 | +import 'package:one_key/provider/remark_manager_model.dart'; | ||
| 12 | import 'package:one_key/provider/user_model.dart'; | 15 | import 'package:one_key/provider/user_model.dart'; |
| 13 | import 'package:one_key/res/colors.dart'; | 16 | import 'package:one_key/res/colors.dart'; |
| 14 | -import 'package:one_key/res/styles.dart'; | ||
| 15 | import 'package:one_key/utils/dialog_util.dart'; | 17 | import 'package:one_key/utils/dialog_util.dart'; |
| 16 | import 'package:one_key/utils/event_bus.dart'; | 18 | import 'package:one_key/utils/event_bus.dart'; |
| 17 | import 'package:one_key/utils/misc.dart'; | 19 | import 'package:one_key/utils/misc.dart'; |
| @@ -23,7 +25,6 @@ import 'package:one_key/widgets/common_button.dart'; | @@ -23,7 +25,6 @@ import 'package:one_key/widgets/common_button.dart'; | ||
| 23 | import 'package:one_key/widgets/h_empty_view.dart'; | 25 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 24 | import 'package:one_key/widgets/new_table_item.dart'; | 26 | import 'package:one_key/widgets/new_table_item.dart'; |
| 25 | import 'package:one_key/widgets/round_button.dart'; | 27 | import 'package:one_key/widgets/round_button.dart'; |
| 26 | -import 'package:one_key/widgets/table_item.dart'; | ||
| 27 | import 'package:one_key/widgets/v_empty_view.dart'; | 28 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 28 | import 'package:permission_handler/permission_handler.dart'; | 29 | import 'package:permission_handler/permission_handler.dart'; |
| 29 | import 'package:provider/provider.dart'; | 30 | import 'package:provider/provider.dart'; |
| @@ -51,6 +52,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -51,6 +52,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 51 | FocusNode _needNode = FocusNode(); | 52 | FocusNode _needNode = FocusNode(); |
| 52 | NotebookDetailModel detailModel = NotebookDetailModel(); | 53 | NotebookDetailModel detailModel = NotebookDetailModel(); |
| 53 | EasyContactPicker _contactPicker = EasyContactPicker(); | 54 | EasyContactPicker _contactPicker = EasyContactPicker(); |
| 55 | + RemarkManagerModel remarkManagerModel; | ||
| 54 | 56 | ||
| 55 | @override | 57 | @override |
| 56 | void initState() { | 58 | void initState() { |
| @@ -68,6 +70,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -68,6 +70,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 68 | widget.detailEntity.pnum, | 70 | widget.detailEntity.pnum, |
| 69 | widget.detailEntity.tables); | 71 | widget.detailEntity.tables); |
| 70 | _initData(); | 72 | _initData(); |
| 73 | + Map<String, String> params = { | ||
| 74 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid | ||
| 75 | + }; | ||
| 76 | + remarkManagerModel.getRemarks(context, params); | ||
| 71 | // //输入框焦点 | 77 | // //输入框焦点 |
| 72 | // _nameNode.addListener(() { | 78 | // _nameNode.addListener(() { |
| 73 | // if (!_nameNode.hasFocus) { | 79 | // if (!_nameNode.hasFocus) { |
| @@ -144,8 +150,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -144,8 +150,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 144 | } | 150 | } |
| 145 | if (j == | 151 | if (j == |
| 146 | _notebookDetailChangeModel.dateList.length - 1) { | 152 | _notebookDetailChangeModel.dateList.length - 1) { |
| 147 | - String selectStr = | ||
| 148 | - _notebookDetailChangeModel.dateList[2]['title']+" 00:00:00"; | 153 | + String selectStr = _notebookDetailChangeModel |
| 154 | + .dateList[2]['title'] + | ||
| 155 | + " 00:00:00"; | ||
| 149 | _calendWidget(DateUtil.getDateTime(selectStr)); | 156 | _calendWidget(DateUtil.getDateTime(selectStr)); |
| 150 | } | 157 | } |
| 151 | } | 158 | } |
| @@ -307,7 +314,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -307,7 +314,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 307 | // _createDateText(day); | 314 | // _createDateText(day); |
| 308 | dateTime = day; | 315 | dateTime = day; |
| 309 | int dateTimeMill = day.millisecondsSinceEpoch; | 316 | int dateTimeMill = day.millisecondsSinceEpoch; |
| 310 | - String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'yyyy-MM-dd'); | 317 | + String dateText = |
| 318 | + DateUtil.formatDateMs(dateTimeMill, format: 'yyyy-MM-dd'); | ||
| 311 | bool isThird = true; | 319 | bool isThird = true; |
| 312 | for (int i = 0; i < _notebookDetailChangeModel.dateList.length; i++) { | 320 | for (int i = 0; i < _notebookDetailChangeModel.dateList.length; i++) { |
| 313 | _notebookDetailChangeModel.dateList[i]['select'] = false; | 321 | _notebookDetailChangeModel.dateList[i]['select'] = false; |
| @@ -632,43 +640,117 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -632,43 +640,117 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 632 | MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2), | 640 | MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2), |
| 633 | color: MyColours.color_F1F0F4), | 641 | color: MyColours.color_F1F0F4), |
| 634 | VEmptyView(52), | 642 | VEmptyView(52), |
| 635 | - TextField( | ||
| 636 | - maxLines: 1, | ||
| 637 | - inputFormatters: [LengthLimitingTextInputFormatter(25)], | ||
| 638 | - //输入文本的样式 | ||
| 639 | - style: TextStyle( | ||
| 640 | - fontSize: ScreenUtil().setSp(34), | ||
| 641 | - color: MyColours.color_353535), | ||
| 642 | - controller: _notebookDetailChangeModel.customController, | ||
| 643 | - focusNode: _needNode, | ||
| 644 | - // textAlignVertical: TextAlignVertical.top, | ||
| 645 | - decoration: InputDecoration( | ||
| 646 | - hintText: "客户要求(25字以内,选填)", | ||
| 647 | - hintStyle: TextStyle( | ||
| 648 | - color: MyColours.color_999999, | ||
| 649 | - fontSize: ScreenUtil().setSp(34), | 643 | + Row( |
| 644 | + children: [ | ||
| 645 | + Expanded( | ||
| 646 | + child: TextField( | ||
| 647 | + maxLines: 1, | ||
| 648 | + inputFormatters: [LengthLimitingTextInputFormatter(25)], | ||
| 649 | + //输入文本的样式 | ||
| 650 | + style: TextStyle( | ||
| 651 | + fontSize: ScreenUtil().setSp(34), | ||
| 652 | + color: MyColours.color_353535), | ||
| 653 | + controller: _notebookDetailChangeModel.customController, | ||
| 654 | + focusNode: _needNode, | ||
| 655 | + // textAlignVertical: TextAlignVertical.top, | ||
| 656 | + decoration: InputDecoration( | ||
| 657 | + hintText: "客户要求(25字以内,选填)", | ||
| 658 | + hintStyle: TextStyle( | ||
| 659 | + color: MyColours.color_999999, | ||
| 660 | + fontSize: ScreenUtil().setSp(34), | ||
| 661 | + ), | ||
| 662 | + // contentPadding: | ||
| 663 | + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 664 | + border: InputBorder.none, | ||
| 665 | + ), | ||
| 666 | + onChanged: (value) {}, | ||
| 667 | + onEditingComplete: () { | ||
| 668 | + print('fff'); | ||
| 669 | + _needNode.unfocus(); | ||
| 670 | + }, | ||
| 671 | + // keyboardType: TextInputType.number, | ||
| 672 | + )), | ||
| 673 | + InkWell( | ||
| 674 | + onTap: () { | ||
| 675 | + DialogUtil.showRemarkDialog( | ||
| 676 | + context, remarkManagerModel.remarks, (item) { | ||
| 677 | + int index = remarkManagerModel.remarks.indexOf(item); | ||
| 678 | + _refreshRemark(remarkManagerModel.remarks, index); | ||
| 679 | + }); | ||
| 680 | + }, | ||
| 681 | + child: Container( | ||
| 682 | + margin: EdgeInsets.only(left: ScreenUtil().setWidth(40)), | ||
| 683 | + width: ScreenUtil().setWidth(122), | ||
| 684 | + height: ScreenUtil().setWidth(42), | ||
| 685 | + child: Text( | ||
| 686 | + '快速备注', | ||
| 687 | + style: TextStyle( | ||
| 688 | + fontSize: ScreenUtil().setSp(30), | ||
| 689 | + color: MyColours.color_199095), | ||
| 690 | + ), | ||
| 691 | + ), | ||
| 650 | ), | 692 | ), |
| 651 | - // contentPadding: | ||
| 652 | - // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 653 | - border: InputBorder.none, | ||
| 654 | - ), | ||
| 655 | - onChanged: (value) {}, | ||
| 656 | - onEditingComplete: () { | ||
| 657 | - print('fff'); | ||
| 658 | - _needNode.unfocus(); | ||
| 659 | - }, | ||
| 660 | - // keyboardType: TextInputType.number, | 693 | + ], |
| 661 | ), | 694 | ), |
| 662 | VEmptyView(40), | 695 | VEmptyView(40), |
| 663 | MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2), | 696 | MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2), |
| 664 | color: MyColours.color_F1F0F4), | 697 | color: MyColours.color_F1F0F4), |
| 665 | - // VEmptyView(72), | 698 | + VEmptyView(30), |
| 699 | + _remarkListWidget() | ||
| 666 | // VEmptyView(62), | 700 | // VEmptyView(62), |
| 667 | ], | 701 | ], |
| 668 | ), | 702 | ), |
| 669 | ); | 703 | ); |
| 670 | } | 704 | } |
| 671 | 705 | ||
| 706 | + _remarkListWidget() { | ||
| 707 | + List<Remark> remark = []; | ||
| 708 | + if (remarkManagerModel.remarks.length > 4) { | ||
| 709 | + remark = remarkManagerModel.remarks.sublist(0, 5); | ||
| 710 | + } else { | ||
| 711 | + remark = remarkManagerModel.remarks; | ||
| 712 | + } | ||
| 713 | + return Container( | ||
| 714 | + height: ScreenUtil().setWidth(50), | ||
| 715 | + child: ListView.builder( | ||
| 716 | + shrinkWrap: true, | ||
| 717 | + itemCount: remark.length, | ||
| 718 | + scrollDirection: Axis.horizontal, | ||
| 719 | + itemBuilder: (BuildContext contxt, int index) { | ||
| 720 | + return remarkButton( | ||
| 721 | + content: remark[index].custom, | ||
| 722 | + isSelect: remark[index].selected, | ||
| 723 | + onPress: () { | ||
| 724 | + setState(() { | ||
| 725 | + remark[index].selected = !remark[index].selected; | ||
| 726 | + }); | ||
| 727 | + _refreshRemark(remark, index); | ||
| 728 | + }); | ||
| 729 | + }), | ||
| 730 | + ); | ||
| 731 | + } | ||
| 732 | + | ||
| 733 | + _refreshRemark(List<Remark> remark, int index) { | ||
| 734 | + String currentRemark = ''; | ||
| 735 | + for (int i = 0; i < remark.length; i++) { | ||
| 736 | + if (remark[i].selected) { | ||
| 737 | + if (currentRemark.length == 0) { | ||
| 738 | + currentRemark += '${remark[i].custom}'; | ||
| 739 | + } else { | ||
| 740 | + currentRemark += '、${remark[i].custom}'; | ||
| 741 | + } | ||
| 742 | + } | ||
| 743 | + } | ||
| 744 | + if (currentRemark.length > 25) { | ||
| 745 | + Utils.showToast('备注字数超过25个字!'); | ||
| 746 | + remark[index].selected = !remark[index].selected; | ||
| 747 | + } else { | ||
| 748 | + setState(() { | ||
| 749 | + _notebookDetailChangeModel.customController.text = currentRemark; | ||
| 750 | + }); | ||
| 751 | + } | ||
| 752 | + } | ||
| 753 | + | ||
| 672 | ///底部弹框,设置时间30分钟间隔布局 | 754 | ///底部弹框,设置时间30分钟间隔布局 |
| 673 | _showDateChooseWidget(BuildContext context) async { | 755 | _showDateChooseWidget(BuildContext context) async { |
| 674 | List tempMndList = []; | 756 | List tempMndList = []; |
| @@ -725,7 +807,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -725,7 +807,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 725 | ), | 807 | ), |
| 726 | Padding( | 808 | Padding( |
| 727 | padding: EdgeInsets.symmetric( | 809 | padding: EdgeInsets.symmetric( |
| 728 | - horizontal: ScreenUtil().setWidth(60),vertical: ScreenUtil().setWidth(40)), | 810 | + horizontal: ScreenUtil().setWidth(60), |
| 811 | + vertical: ScreenUtil().setWidth(40)), | ||
| 729 | child: GridView.builder( | 812 | child: GridView.builder( |
| 730 | padding: | 813 | padding: |
| 731 | EdgeInsets.only(top: ScreenUtil().setWidth(20)), | 814 | EdgeInsets.only(top: ScreenUtil().setWidth(20)), |
| @@ -822,7 +905,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -822,7 +905,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 822 | //用户选择不在弹出权限提示框 | 905 | //用户选择不在弹出权限提示框 |
| 823 | print('never'); | 906 | print('never'); |
| 824 | DialogUtil.openAlertDialog( | 907 | DialogUtil.openAlertDialog( |
| 825 | - context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置',340.0, onTap: () { | 908 | + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0, |
| 909 | + onTap: () { | ||
| 826 | openSetting(); | 910 | openSetting(); |
| 827 | Navigator.pop(context, ''); | 911 | Navigator.pop(context, ''); |
| 828 | }); | 912 | }); |
| @@ -868,6 +952,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -868,6 +952,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 868 | Widget build(BuildContext context) { | 952 | Widget build(BuildContext context) { |
| 869 | _notebookDetailChangeModel = | 953 | _notebookDetailChangeModel = |
| 870 | Provider.of<NotebookDetailChangeModel>(context, listen: true); | 954 | Provider.of<NotebookDetailChangeModel>(context, listen: true); |
| 955 | + remarkManagerModel = Provider.of<RemarkManagerModel>(context, listen: true); | ||
| 871 | return GestureDetector( | 956 | return GestureDetector( |
| 872 | behavior: HitTestBehavior.translucent, | 957 | behavior: HitTestBehavior.translucent, |
| 873 | onTap: () { | 958 | onTap: () { |
| @@ -1126,3 +1211,29 @@ class _ButtonState extends State<CustomButton> { | @@ -1126,3 +1211,29 @@ class _ButtonState extends State<CustomButton> { | ||
| 1126 | ); | 1211 | ); |
| 1127 | } | 1212 | } |
| 1128 | } | 1213 | } |
| 1214 | + | ||
| 1215 | +Widget remarkButton({GestureTapCallback onPress, content, isSelect = false}) { | ||
| 1216 | + return InkWell( | ||
| 1217 | + onTap: onPress, | ||
| 1218 | + child: Container( | ||
| 1219 | + height: ScreenUtil().setHeight(48), | ||
| 1220 | + margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)), | ||
| 1221 | + padding: EdgeInsets.symmetric( | ||
| 1222 | + horizontal: ScreenUtil().setWidth(20), | ||
| 1223 | + vertical: ScreenUtil().setWidth(6)), | ||
| 1224 | + decoration: BoxDecoration( | ||
| 1225 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 1226 | + color: isSelect ? MyColours.color_199095 : MyColours.color_f5f5f5, | ||
| 1227 | + ), | ||
| 1228 | + child: Align( | ||
| 1229 | + alignment: Alignment.center, | ||
| 1230 | + child: Text( | ||
| 1231 | + content, | ||
| 1232 | + style: TextStyle( | ||
| 1233 | + color: isSelect ? Colors.white : MyColours.color_353535, | ||
| 1234 | + fontSize: ScreenUtil().setSp(28)), | ||
| 1235 | + ), | ||
| 1236 | + ), | ||
| 1237 | + ), | ||
| 1238 | + ); | ||
| 1239 | +} |
| @@ -203,6 +203,18 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -203,6 +203,18 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 203 | NavigatorUtil.goReceiveOrdersTimeSetPage(context); | 203 | NavigatorUtil.goReceiveOrdersTimeSetPage(context); |
| 204 | }, | 204 | }, |
| 205 | ), | 205 | ), |
| 206 | + MyDivider( | ||
| 207 | + double.infinity, | ||
| 208 | + ScreenUtil().setHeight(1), | ||
| 209 | + color: MyColours.color_f3f3f3, | ||
| 210 | + ), | ||
| 211 | + MyItem( | ||
| 212 | + title: "常用备注管理", | ||
| 213 | + content: "", | ||
| 214 | + callback: () { | ||
| 215 | + NavigatorUtil.goRemarkManagerPage(context); | ||
| 216 | + }, | ||
| 217 | + ), | ||
| 206 | VEmptyView(40), | 218 | VEmptyView(40), |
| 207 | MyItem( | 219 | MyItem( |
| 208 | title: "联系客服", | 220 | title: "联系客服", |
lib/pages/my/remark_manager_page.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 3 | +import 'package:one_key/constant/state.dart'; | ||
| 4 | +import 'package:one_key/models/remark.dart'; | ||
| 5 | +import 'package:one_key/provider/remark_manager_model.dart'; | ||
| 6 | +import 'package:one_key/provider/user_model.dart'; | ||
| 7 | +import 'package:one_key/res/colors.dart'; | ||
| 8 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 9 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 10 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 11 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 12 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 13 | +import 'package:provider/provider.dart'; | ||
| 14 | + | ||
| 15 | +import '../../app.dart'; | ||
| 16 | + | ||
| 17 | +class RemarkManagerPage extends StatefulWidget { | ||
| 18 | + @override | ||
| 19 | + State<StatefulWidget> createState() { | ||
| 20 | + // TODO: implement createState | ||
| 21 | + return RemarkManagerPageState(); | ||
| 22 | + } | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +class RemarkManagerPageState extends State<RemarkManagerPage> { | ||
| 26 | + RemarkManagerModel remarkManagerModel; | ||
| 27 | + | ||
| 28 | + bool isAdding = false; //正在添加备注 | ||
| 29 | + | ||
| 30 | + TextEditingController _controller = TextEditingController(); | ||
| 31 | + FocusNode focusNode = FocusNode(); | ||
| 32 | + | ||
| 33 | + @override | ||
| 34 | + void initState() { | ||
| 35 | + // TODO: implement initState | ||
| 36 | + super.initState(); | ||
| 37 | + | ||
| 38 | + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 39 | + _getRemarks(); | ||
| 40 | + }); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + //获取备注 | ||
| 44 | + _getRemarks() { | ||
| 45 | + Map<String, String> params = { | ||
| 46 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid | ||
| 47 | + }; | ||
| 48 | + remarkManagerModel.getRemarks(context, params); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + //添加备注 | ||
| 52 | + _addRemark() { | ||
| 53 | + Map<String, String> params = { | ||
| 54 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 55 | + "custom": _controller.text | ||
| 56 | + }; | ||
| 57 | + remarkManagerModel.addRemark(context, params); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + //删除备注 | ||
| 61 | + _delRemark(Remark remark) { | ||
| 62 | + if (remark.id == "-1") return; | ||
| 63 | + Map<String, String> params = { | ||
| 64 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 65 | + "kid": remark.id, | ||
| 66 | + }; | ||
| 67 | + remarkManagerModel.delRemark(context, params); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + //构建常用备注 | ||
| 71 | + List<Widget> _buildAlwayItems() { | ||
| 72 | + List<Widget> always = []; | ||
| 73 | + for (Remark remark in remarkManagerModel.remarks) { | ||
| 74 | + if (remark.oftenUse != null && remark.oftenUse.isNotEmpty) | ||
| 75 | + always.add(Container( | ||
| 76 | + height: ScreenUtil().setWidth(50), | ||
| 77 | + decoration: BoxDecoration( | ||
| 78 | + color: MyColours.color_199095, | ||
| 79 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 80 | + child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[ | ||
| 81 | + Flexible( | ||
| 82 | + child: Padding( | ||
| 83 | + padding: | ||
| 84 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 85 | + child: Text( | ||
| 86 | + "${remark.oftenUse}", | ||
| 87 | + style: TextStyle( | ||
| 88 | + fontSize: ScreenUtil().setSp(30), | ||
| 89 | + color: MyColours.color_ffffff, | ||
| 90 | + ), | ||
| 91 | + overflow: TextOverflow.ellipsis, | ||
| 92 | + ), | ||
| 93 | + ), | ||
| 94 | + ), | ||
| 95 | + MyDivider( | ||
| 96 | + ScreenUtil().setWidth(2), | ||
| 97 | + ScreenUtil().setWidth(30), | ||
| 98 | + color: MyColours.color_6AB6B9, | ||
| 99 | + ), | ||
| 100 | + GestureDetector( | ||
| 101 | + onTap: () { | ||
| 102 | + setState(() { | ||
| 103 | + remark.oftenUse = ""; | ||
| 104 | + }); | ||
| 105 | + _delRemark(remark); | ||
| 106 | + }, | ||
| 107 | + child: Padding( | ||
| 108 | + padding: EdgeInsets.all(ScreenUtil().setWidth(10)), | ||
| 109 | + child: Text( | ||
| 110 | + "X", | ||
| 111 | + style: TextStyle( | ||
| 112 | + color: MyColours.color_ffffff, | ||
| 113 | + fontSize: ScreenUtil().setSp(30)), | ||
| 114 | + )), | ||
| 115 | + ) | ||
| 116 | + ]), | ||
| 117 | + )); | ||
| 118 | + } | ||
| 119 | + return always; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + //构建所有备注 | ||
| 123 | + List<Widget> _buildAllItems() { | ||
| 124 | + List<Widget> alls = []; | ||
| 125 | + for (Remark remark in remarkManagerModel.remarks) { | ||
| 126 | + alls.add( | ||
| 127 | + GestureDetector( | ||
| 128 | + onTap: () { | ||
| 129 | + setState(() { | ||
| 130 | + remark.oftenUse = remark.custom; | ||
| 131 | + }); | ||
| 132 | + }, | ||
| 133 | + child: Container( | ||
| 134 | + height: ScreenUtil().setWidth(50), | ||
| 135 | + padding: | ||
| 136 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 137 | + decoration: | ||
| 138 | + (remark.oftenUse != null && remark.oftenUse.isNotEmpty) | ||
| 139 | + ? BoxDecoration( | ||
| 140 | + color: MyColours.color_199095, | ||
| 141 | + borderRadius: | ||
| 142 | + BorderRadius.circular(ScreenUtil().setWidth(10))) | ||
| 143 | + : BoxDecoration( | ||
| 144 | + color: MyColours.color_ffffff, | ||
| 145 | + borderRadius: | ||
| 146 | + BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 147 | + border: Border.all( | ||
| 148 | + color: MyColours.color_6AB6B9, | ||
| 149 | + width: ScreenUtil().setWidth(2))), | ||
| 150 | + child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[ | ||
| 151 | + Flexible( | ||
| 152 | + child: Text( | ||
| 153 | + "${remark.custom}", | ||
| 154 | + style: TextStyle( | ||
| 155 | + fontSize: ScreenUtil().setSp(30), | ||
| 156 | + color: | ||
| 157 | + (remark.oftenUse != null && remark.oftenUse.isNotEmpty) | ||
| 158 | + ? MyColours.color_ffffff | ||
| 159 | + : MyColours.color_199095, | ||
| 160 | + ), | ||
| 161 | + overflow: TextOverflow.ellipsis, | ||
| 162 | + )), | ||
| 163 | + ]), | ||
| 164 | + )), | ||
| 165 | + ); | ||
| 166 | + } | ||
| 167 | + alls.add(Stack( | ||
| 168 | + children: [ | ||
| 169 | + isAdding | ||
| 170 | + ? Container( | ||
| 171 | + width: ScreenUtil().setWidth(200), | ||
| 172 | + height: ScreenUtil().setWidth(50), | ||
| 173 | + padding: | ||
| 174 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 175 | + decoration: BoxDecoration( | ||
| 176 | + border: Border.all( | ||
| 177 | + color: MyColours.color_cccccc, | ||
| 178 | + width: ScreenUtil().setWidth(2)), | ||
| 179 | + borderRadius: | ||
| 180 | + BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 181 | + child: Expanded( | ||
| 182 | + child: TextField( | ||
| 183 | + controller: _controller, | ||
| 184 | + focusNode: focusNode, | ||
| 185 | + autofocus: true, | ||
| 186 | + textInputAction: TextInputAction.done, | ||
| 187 | + textAlignVertical: TextAlignVertical.center, | ||
| 188 | + keyboardType: TextInputType.text, | ||
| 189 | + maxLength: 10, | ||
| 190 | + decoration: InputDecoration( | ||
| 191 | + border: InputBorder.none, | ||
| 192 | + ), | ||
| 193 | + style: TextStyle( | ||
| 194 | + color: MyColours.color_353535, | ||
| 195 | + fontSize: ScreenUtil().setSp(30), | ||
| 196 | + textBaseline: | ||
| 197 | + TextBaseline.alphabetic), | ||
| 198 | + onEditingComplete: () { | ||
| 199 | + if(_controller.text.isEmpty){ | ||
| 200 | + setState(() { | ||
| 201 | + isAdding=false; | ||
| 202 | + return; | ||
| 203 | + }); | ||
| 204 | + } | ||
| 205 | + setState(() { | ||
| 206 | + isAdding = false; | ||
| 207 | + remarkManagerModel.remarks.add(Remark() | ||
| 208 | + ..id = "-1" | ||
| 209 | + ..custom = _controller.text | ||
| 210 | + ..oftenUse = _controller.text); | ||
| 211 | + }); | ||
| 212 | + _addRemark(); | ||
| 213 | + _controller.clear(); | ||
| 214 | + }, | ||
| 215 | + ), | ||
| 216 | + ), | ||
| 217 | + ) | ||
| 218 | + : GestureDetector( | ||
| 219 | + onTap: () { | ||
| 220 | + if(remarkManagerModel.remarks.length>=20)return; | ||
| 221 | + setState(() { | ||
| 222 | + isAdding = true; | ||
| 223 | + }); | ||
| 224 | + }, | ||
| 225 | + child: Container( | ||
| 226 | + width: ScreenUtil().setWidth(200), | ||
| 227 | + height: ScreenUtil().setWidth(50), | ||
| 228 | + alignment: Alignment.center, | ||
| 229 | + decoration: BoxDecoration( | ||
| 230 | + border: Border.all( | ||
| 231 | + color: MyColours.color_cccccc, | ||
| 232 | + width: ScreenUtil().setWidth(2)), | ||
| 233 | + borderRadius: | ||
| 234 | + BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 235 | + child: Row( | ||
| 236 | + mainAxisSize: MainAxisSize.min, | ||
| 237 | + children: [ | ||
| 238 | + Icon( | ||
| 239 | + Icons.add, | ||
| 240 | + size: ScreenUtil().setWidth(30), | ||
| 241 | + color: MyColours.color_999999, | ||
| 242 | + ), | ||
| 243 | + HEmptyView(10), | ||
| 244 | + Text( | ||
| 245 | + "添加备注", | ||
| 246 | + style: TextStyle( | ||
| 247 | + color: MyColours.color_999999, | ||
| 248 | + fontSize: ScreenUtil().setSp(30)), | ||
| 249 | + ) | ||
| 250 | + ], | ||
| 251 | + ), | ||
| 252 | + ), | ||
| 253 | + ) | ||
| 254 | + ], | ||
| 255 | + )); | ||
| 256 | + return alls; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + @override | ||
| 260 | + Widget build(BuildContext context) { | ||
| 261 | + // TODO: implement build | ||
| 262 | + remarkManagerModel = | ||
| 263 | + Provider.of<RemarkManagerModel>(context, listen: false); | ||
| 264 | + return Scaffold( | ||
| 265 | + backgroundColor: MyColours.color_ffffff, | ||
| 266 | + appBar: SystemAppBar( | ||
| 267 | + '常用备注管理', | ||
| 268 | + onTap: () { | ||
| 269 | + Navigator.of(context).pop(); | ||
| 270 | + }, | ||
| 271 | + ), | ||
| 272 | + body: SafeArea( | ||
| 273 | + child: Consumer<RemarkManagerModel>( | ||
| 274 | + builder: (context, model, _) { | ||
| 275 | + if (model.pageState != PageState.Success) { | ||
| 276 | + return ExceptionPage( | ||
| 277 | + pageState: model.pageState, | ||
| 278 | + callback: () { | ||
| 279 | + _getRemarks(); | ||
| 280 | + }, | ||
| 281 | + emptyMsg: "暂时没有备注哦", | ||
| 282 | + emptyImg: "empty_search", | ||
| 283 | + showMsg: "加载中,请稍后...", | ||
| 284 | + ); | ||
| 285 | + } else { | ||
| 286 | + return Container( | ||
| 287 | + padding: EdgeInsets.symmetric( | ||
| 288 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 289 | + child: Column( | ||
| 290 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 291 | + children: [ | ||
| 292 | + VEmptyView(60), | ||
| 293 | + Row( | ||
| 294 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 295 | + children: [ | ||
| 296 | + Text( | ||
| 297 | + "我的常用备注", | ||
| 298 | + style: TextStyle( | ||
| 299 | + color: MyColours.color_353535, | ||
| 300 | + fontSize: ScreenUtil().setSp(30), | ||
| 301 | + fontWeight: FontWeight.bold), | ||
| 302 | + ), | ||
| 303 | + Text( | ||
| 304 | + "(最多添加10个)", | ||
| 305 | + style: TextStyle( | ||
| 306 | + color: MyColours.color_666666, | ||
| 307 | + fontSize: ScreenUtil().setSp(26)), | ||
| 308 | + ), | ||
| 309 | + ], | ||
| 310 | + ), | ||
| 311 | + Padding( | ||
| 312 | + padding: EdgeInsets.symmetric( | ||
| 313 | + vertical: ScreenUtil().setWidth(20)), | ||
| 314 | + child: Wrap( | ||
| 315 | + spacing: ScreenUtil().setWidth(20), | ||
| 316 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 317 | + children: _buildAlwayItems()), | ||
| 318 | + ), | ||
| 319 | + VEmptyView(20), | ||
| 320 | + MyDivider( | ||
| 321 | + double.infinity, | ||
| 322 | + ScreenUtil().setWidth(2), | ||
| 323 | + color: MyColours.color_f3f3f3, | ||
| 324 | + ), | ||
| 325 | + VEmptyView(40), | ||
| 326 | + Row( | ||
| 327 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 328 | + children: [ | ||
| 329 | + Text( | ||
| 330 | + "所有备注", | ||
| 331 | + style: TextStyle( | ||
| 332 | + color: MyColours.color_353535, | ||
| 333 | + fontSize: ScreenUtil().setSp(30), | ||
| 334 | + fontWeight: FontWeight.bold), | ||
| 335 | + ), | ||
| 336 | + Text( | ||
| 337 | + "(最多添加20个)", | ||
| 338 | + style: TextStyle( | ||
| 339 | + color: MyColours.color_666666, | ||
| 340 | + fontSize: ScreenUtil().setSp(26)), | ||
| 341 | + ), | ||
| 342 | + ], | ||
| 343 | + ), | ||
| 344 | + Padding( | ||
| 345 | + padding: EdgeInsets.symmetric( | ||
| 346 | + vertical: ScreenUtil().setWidth(20)), | ||
| 347 | + child: Wrap( | ||
| 348 | + spacing: ScreenUtil().setWidth(20), | ||
| 349 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 350 | + children: _buildAllItems()), | ||
| 351 | + ) | ||
| 352 | + ], | ||
| 353 | + ), | ||
| 354 | + ); | ||
| 355 | + } | ||
| 356 | + }, | ||
| 357 | + ), | ||
| 358 | + )); | ||
| 359 | + } | ||
| 360 | +} |
lib/provider/remark_manager_model.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:one_key/constant/constant.dart'; | ||
| 3 | +import 'package:one_key/constant/error.dart'; | ||
| 4 | +import 'package:one_key/constant/state.dart'; | ||
| 5 | +import 'package:one_key/models/remark.dart'; | ||
| 6 | +import 'package:one_key/net/base_resp.dart'; | ||
| 7 | +import 'package:one_key/net/dio_util.dart'; | ||
| 8 | +import 'package:one_key/net/http_url.dart'; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 常用备注管理 | ||
| 12 | + */ | ||
| 13 | +class RemarkManagerModel extends ChangeNotifier{ | ||
| 14 | + | ||
| 15 | + List<Remark> remarks=[];//所有备注 | ||
| 16 | + | ||
| 17 | + PageState pageState = PageState.Loading; | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + //获取备注 | ||
| 21 | + getRemarks(BuildContext context, Map<String, String> params) async { | ||
| 22 | + pageState = PageState.Loading; | ||
| 23 | + notifyListeners(); | ||
| 24 | + BaseResp<List> baseResp = await DioUtil() | ||
| 25 | + .request<List>(context, Method.get, HttpUrl.get_custom_remark, | ||
| 26 | + data: params, showLoading: false) | ||
| 27 | + .catchError((error) { | ||
| 28 | + print(error.toString()); | ||
| 29 | + if (error is MyError) { | ||
| 30 | + switch (error.type) { | ||
| 31 | + case 1: | ||
| 32 | + pageState = PageState.ConnectivityError; | ||
| 33 | + break; | ||
| 34 | + case 2: | ||
| 35 | + pageState = PageState.ConnectivityTimeOut; | ||
| 36 | + break; | ||
| 37 | + default: | ||
| 38 | + pageState = PageState.ConnectivityError; | ||
| 39 | + break; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + notifyListeners(); | ||
| 43 | + }); | ||
| 44 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 45 | + remarks = baseResp.data.map<Remark>((value) { | ||
| 46 | + return Remark.fromJson(value); | ||
| 47 | + }).toList(); | ||
| 48 | + if (remarks.isEmpty) { | ||
| 49 | + pageState = PageState.Empty; | ||
| 50 | + } else { | ||
| 51 | + pageState = PageState.Success; | ||
| 52 | + } | ||
| 53 | + notifyListeners(); | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + //添加备注 | ||
| 58 | + addRemark(BuildContext context, Map<String, String> params) async { | ||
| 59 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 60 | + .request<dynamic>(context, Method.get, HttpUrl.add_custom_remark, | ||
| 61 | + data: params, showLoading: false) | ||
| 62 | + .catchError((error) { | ||
| 63 | + print(error.toString()); | ||
| 64 | + }); | ||
| 65 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + //删除备注 | ||
| 70 | + delRemark(BuildContext context, Map<String, String> params) async { | ||
| 71 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 72 | + .request<dynamic>(context, Method.get, HttpUrl.del_custom_remark, | ||
| 73 | + data: params, showLoading: false) | ||
| 74 | + .catchError((error) { | ||
| 75 | + print(error.toString()); | ||
| 76 | + }); | ||
| 77 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | +} |
| @@ -11,6 +11,7 @@ class MyColours { | @@ -11,6 +11,7 @@ class MyColours { | ||
| 11 | static const Color color_d8d8d8 = Color(0xffD8D8D8); | 11 | static const Color color_d8d8d8 = Color(0xffD8D8D8); |
| 12 | static const Color color_bff6f7 = Color(0xffBFF6F7); | 12 | static const Color color_bff6f7 = Color(0xffBFF6F7); |
| 13 | static const Color color_c1c1c1 = Color(0xffC1C1C1); | 13 | static const Color color_c1c1c1 = Color(0xffC1C1C1); |
| 14 | + static const Color color_cccccc = Color(0xffCCCCCC); | ||
| 14 | static const Color color_2bb5b7 = Color(0xff2BB5B7); | 15 | static const Color color_2bb5b7 = Color(0xff2BB5B7); |
| 15 | static const Color color_26000000 = Color(0x26000000); | 16 | static const Color color_26000000 = Color(0x26000000); |
| 16 | static const Color color_d93535 = Color(0xffD93535); | 17 | static const Color color_d93535 = Color(0xffD93535); |
| @@ -14,6 +14,7 @@ import 'package:one_key/pages/detail/notebook_detail_page.dart'; | @@ -14,6 +14,7 @@ import 'package:one_key/pages/detail/notebook_detail_page.dart'; | ||
| 14 | import 'package:one_key/pages/login/web_page.dart'; | 14 | import 'package:one_key/pages/login/web_page.dart'; |
| 15 | import 'package:one_key/pages/my/book_time_set.dart'; | 15 | import 'package:one_key/pages/my/book_time_set.dart'; |
| 16 | import 'package:one_key/pages/my/receive_orders_time_set.dart'; | 16 | import 'package:one_key/pages/my/receive_orders_time_set.dart'; |
| 17 | +import 'package:one_key/pages/my/remark_manager_page.dart'; | ||
| 17 | import 'package:one_key/pages/sms/sms_page.dart'; | 18 | import 'package:one_key/pages/sms/sms_page.dart'; |
| 18 | import 'package:one_key/pages/table/select_table_page.dart'; | 19 | import 'package:one_key/pages/table/select_table_page.dart'; |
| 19 | import 'package:one_key/pages/webview/webview_page.dart'; | 20 | import 'package:one_key/pages/webview/webview_page.dart'; |
| @@ -21,6 +22,7 @@ import 'package:one_key/provider/book_set_time_model.dart'; | @@ -21,6 +22,7 @@ import 'package:one_key/provider/book_set_time_model.dart'; | ||
| 21 | import 'package:one_key/provider/choose_table_model.dart'; | 22 | import 'package:one_key/provider/choose_table_model.dart'; |
| 22 | import 'package:one_key/provider/notebook_detail_change_model.dart'; | 23 | import 'package:one_key/provider/notebook_detail_change_model.dart'; |
| 23 | import 'package:one_key/provider/notebook_detail_model.dart'; | 24 | import 'package:one_key/provider/notebook_detail_model.dart'; |
| 25 | +import 'package:one_key/provider/remark_manager_model.dart'; | ||
| 24 | import 'package:one_key/utils/fluro_convert_utils.dart'; | 26 | import 'package:one_key/utils/fluro_convert_utils.dart'; |
| 25 | import 'package:provider/provider.dart'; | 27 | import 'package:provider/provider.dart'; |
| 26 | 28 | ||
| @@ -135,7 +137,9 @@ var handleChangeDetailHandler = new Handler( | @@ -135,7 +137,9 @@ var handleChangeDetailHandler = new Handler( | ||
| 135 | String rid = params['rid'].first; | 137 | String rid = params['rid'].first; |
| 136 | return ChangeNotifierProvider<NotebookDetailChangeModel>( | 138 | return ChangeNotifierProvider<NotebookDetailChangeModel>( |
| 137 | create: (_) => NotebookDetailChangeModel(detailEntity), | 139 | create: (_) => NotebookDetailChangeModel(detailEntity), |
| 138 | - child: NoteBookChangePage(detailEntity: detailEntity, rid: rid)); | 140 | + child: ChangeNotifierProvider<RemarkManagerModel>( |
| 141 | + create: (_) => RemarkManagerModel(), | ||
| 142 | + child: NoteBookChangePage(detailEntity: detailEntity, rid: rid))); | ||
| 139 | }); | 143 | }); |
| 140 | 144 | ||
| 141 | // 跳转可订时段管理页面 | 145 | // 跳转可订时段管理页面 |
| @@ -151,3 +155,10 @@ var handleReceiveOrdersTimeSetHandler = new Handler( | @@ -151,3 +155,10 @@ var handleReceiveOrdersTimeSetHandler = new Handler( | ||
| 151 | return ChangeNotifierProvider<BookSetTimeModel>( | 155 | return ChangeNotifierProvider<BookSetTimeModel>( |
| 152 | create: (_) => BookSetTimeModel(), child: ReceiveOrdersTimeSetPage()); | 156 | create: (_) => BookSetTimeModel(), child: ReceiveOrdersTimeSetPage()); |
| 153 | }); | 157 | }); |
| 158 | + | ||
| 159 | +// 常用备注管理 | ||
| 160 | +var handleRemarkManagerHandler = new Handler( | ||
| 161 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 162 | + return ChangeNotifierProvider<RemarkManagerModel>( | ||
| 163 | + create: (_) => RemarkManagerModel(), child: RemarkManagerPage()); | ||
| 164 | +}); |
| @@ -17,6 +17,7 @@ class Routes { | @@ -17,6 +17,7 @@ class Routes { | ||
| 17 | static String change_detail = "/change_detail"; //变更预订 | 17 | static String change_detail = "/change_detail"; //变更预订 |
| 18 | static String book_time_set = "/book_time_set"; //可订时段管理 | 18 | static String book_time_set = "/book_time_set"; //可订时段管理 |
| 19 | static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理 | 19 | static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理 |
| 20 | + static String remark_manager = "/remark_manager"; //常用备注管理 | ||
| 20 | 21 | ||
| 21 | static void configureRoutes(Router router) { | 22 | static void configureRoutes(Router router) { |
| 22 | router.notFoundHandler = new Handler( | 23 | router.notFoundHandler = new Handler( |
| @@ -37,5 +38,7 @@ class Routes { | @@ -37,5 +38,7 @@ class Routes { | ||
| 37 | router.define(book_time_set, handler: handleBookTimeSetHandler); | 38 | router.define(book_time_set, handler: handleBookTimeSetHandler); |
| 38 | router.define(receive_orders_time_set, | 39 | router.define(receive_orders_time_set, |
| 39 | handler: handleReceiveOrdersTimeSetHandler); | 40 | handler: handleReceiveOrdersTimeSetHandler); |
| 41 | + router.define(remark_manager, | ||
| 42 | + handler: handleRemarkManagerHandler); | ||
| 40 | } | 43 | } |
| 41 | } | 44 | } |
| @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; | @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; | ||
| 5 | import 'package:flutter_picker/flutter_picker.dart'; | 5 | import 'package:flutter_picker/flutter_picker.dart'; |
| 6 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 6 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 7 | import 'package:one_key/constant/constant.dart'; | 7 | import 'package:one_key/constant/constant.dart'; |
| 8 | +import 'package:one_key/models/remark.dart'; | ||
| 8 | import 'package:one_key/pages/message/message_dialog_item.dart'; | 9 | import 'package:one_key/pages/message/message_dialog_item.dart'; |
| 9 | import 'package:one_key/provider/message_dialog_model.dart'; | 10 | import 'package:one_key/provider/message_dialog_model.dart'; |
| 10 | import 'package:one_key/res/colors.dart'; | 11 | import 'package:one_key/res/colors.dart'; |
| @@ -19,7 +20,98 @@ import 'package:provider/provider.dart'; | @@ -19,7 +20,98 @@ import 'package:provider/provider.dart'; | ||
| 19 | import 'package:table_calendar/table_calendar.dart'; | 20 | import 'package:table_calendar/table_calendar.dart'; |
| 20 | import 'package:one_key/models/table.dart' as t; | 21 | import 'package:one_key/models/table.dart' as t; |
| 21 | 22 | ||
| 23 | +typedef CustomCallBack = void Function(Object object); | ||
| 22 | class DialogUtil { | 24 | class DialogUtil { |
| 25 | + //备注弹框 | ||
| 26 | + static showRemarkDialog( | ||
| 27 | + BuildContext context, List<Remark> remarks, CustomCallBack callback, | ||
| 28 | + {GestureTapCallback onTapLeft, GestureTapCallback onTapRight}) { | ||
| 29 | + return showModalBottomSheet( | ||
| 30 | + context: context, | ||
| 31 | + isScrollControlled: true, | ||
| 32 | + isDismissible: false, | ||
| 33 | + backgroundColor: Colors.transparent, | ||
| 34 | + builder: (context) { | ||
| 35 | + return StatefulBuilder(builder: (context, state) { | ||
| 36 | + // locationState = state; | ||
| 37 | + return Container( | ||
| 38 | + decoration: BoxDecoration( | ||
| 39 | + color: MyColours.color_ffffff, | ||
| 40 | + borderRadius: BorderRadius.only( | ||
| 41 | + topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 42 | + topRight: Radius.circular(ScreenUtil().setWidth(24)))), | ||
| 43 | + child: Column( | ||
| 44 | + mainAxisSize: MainAxisSize.min, | ||
| 45 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 46 | + children: <Widget>[ | ||
| 47 | + VEmptyView(40), | ||
| 48 | + Center( | ||
| 49 | + child: Text( | ||
| 50 | + '更多标签', | ||
| 51 | + style: TextStyle( | ||
| 52 | + fontSize: ScreenUtil().setSp(32), | ||
| 53 | + color: MyColours.color_353535, | ||
| 54 | + ), | ||
| 55 | + softWrap: true, | ||
| 56 | + textAlign: TextAlign.center, | ||
| 57 | + ), | ||
| 58 | + ), | ||
| 59 | + VEmptyView(60), | ||
| 60 | + Container( | ||
| 61 | + padding: EdgeInsets.symmetric( | ||
| 62 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 63 | + child: Wrap( | ||
| 64 | + children: listWidget(remarks, state, callback), | ||
| 65 | + spacing: ScreenUtil().setWidth(20), | ||
| 66 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 67 | + // alignment: WrapAlignment.start, | ||
| 68 | + // runAlignment: WrapAlignment.end, | ||
| 69 | + ), | ||
| 70 | + ), | ||
| 71 | + VEmptyView(60) | ||
| 72 | + ])); | ||
| 73 | + }); | ||
| 74 | + }); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + static listWidget( | ||
| 78 | + List<Remark> remarks, StateSetter state, CustomCallBack callback) { | ||
| 79 | + List<Widget> lists = remarks.map((item) { | ||
| 80 | + return remarkButton( | ||
| 81 | + content: item.custom, | ||
| 82 | + isSelect: item.selected, | ||
| 83 | + onPress: () { | ||
| 84 | + state(() { | ||
| 85 | + item.selected = !item.selected; | ||
| 86 | + }); | ||
| 87 | + callback(item); | ||
| 88 | + }); | ||
| 89 | + }).toList(); | ||
| 90 | + return lists; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + static Widget remarkButton( | ||
| 94 | + {GestureTapCallback onPress, content, isSelect = false}) { | ||
| 95 | + return InkWell( | ||
| 96 | + onTap: onPress, | ||
| 97 | + child: Container( | ||
| 98 | + height: ScreenUtil().setHeight(50), | ||
| 99 | + padding: EdgeInsets.symmetric( | ||
| 100 | + horizontal: ScreenUtil().setWidth(20), | ||
| 101 | + vertical: ScreenUtil().setWidth(12)), | ||
| 102 | + decoration: BoxDecoration( | ||
| 103 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 104 | + color: isSelect ? MyColours.color_199095 : MyColours.color_f5f5f5, | ||
| 105 | + ), | ||
| 106 | + child: Text( | ||
| 107 | + content, | ||
| 108 | + style: TextStyle( | ||
| 109 | + color: isSelect ? Colors.white : MyColours.color_353535, | ||
| 110 | + fontSize: ScreenUtil().setSp(28)), | ||
| 111 | + ), | ||
| 112 | + )); | ||
| 113 | + } | ||
| 114 | + | ||
| 23 | //显示消息弹框 | 115 | //显示消息弹框 |
| 24 | static showMessageDialog(BuildContext context) async { | 116 | static showMessageDialog(BuildContext context) async { |
| 25 | MessageDialogModel messageModel = | 117 | MessageDialogModel messageModel = |
| @@ -115,4 +115,9 @@ class NavigatorUtil { | @@ -115,4 +115,9 @@ class NavigatorUtil { | ||
| 115 | static void goReceiveOrdersTimeSetPage(BuildContext context) { | 115 | static void goReceiveOrdersTimeSetPage(BuildContext context) { |
| 116 | _navigateTo(context, "${Routes.receive_orders_time_set}"); | 116 | _navigateTo(context, "${Routes.receive_orders_time_set}"); |
| 117 | } | 117 | } |
| 118 | + | ||
| 119 | + /// 常用备注管理 | ||
| 120 | + static void goRemarkManagerPage(BuildContext context) { | ||
| 121 | + _navigateTo(context, "${Routes.remark_manager}"); | ||
| 122 | + } | ||
| 118 | } | 123 | } |
-
Please register or login to post a comment