|
...
|
...
|
@@ -2,16 +2,18 @@ import 'dart:convert'; |
|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
// import 'package:contacts_service/contacts_service.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/models/remark.dart';
|
|
|
|
import 'package:one_key/models/reserve_info_model.dart';
|
|
|
|
import 'package:one_key/provider/notebook_detail_change_model.dart';
|
|
|
|
import 'package:one_key/provider/notebook_detail_model.dart';
|
|
|
|
import 'package:one_key/provider/remark_manager_model.dart';
|
|
|
|
import 'package:one_key/provider/user_model.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/res/styles.dart';
|
|
|
|
import 'package:one_key/utils/dialog_util.dart';
|
|
|
|
import 'package:one_key/utils/event_bus.dart';
|
|
|
|
import 'package:one_key/utils/misc.dart';
|
|
...
|
...
|
@@ -23,7 +25,6 @@ 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/round_button.dart';
|
|
|
|
import 'package:one_key/widgets/table_item.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
...
|
...
|
@@ -51,6 +52,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { |
|
|
|
FocusNode _needNode = FocusNode();
|
|
|
|
NotebookDetailModel detailModel = NotebookDetailModel();
|
|
|
|
EasyContactPicker _contactPicker = EasyContactPicker();
|
|
|
|
RemarkManagerModel remarkManagerModel;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -68,6 +70,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { |
|
|
|
widget.detailEntity.pnum,
|
|
|
|
widget.detailEntity.tables);
|
|
|
|
_initData();
|
|
|
|
Map<String, String> params = {
|
|
|
|
"uid": Provider.of<UserModel>(context, listen: false).user.openid
|
|
|
|
};
|
|
|
|
remarkManagerModel.getRemarks(context, params);
|
|
|
|
// //输入框焦点
|
|
|
|
// _nameNode.addListener(() {
|
|
|
|
// if (!_nameNode.hasFocus) {
|
|
...
|
...
|
@@ -144,8 +150,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { |
|
|
|
}
|
|
|
|
if (j ==
|
|
|
|
_notebookDetailChangeModel.dateList.length - 1) {
|
|
|
|
String selectStr =
|
|
|
|
_notebookDetailChangeModel.dateList[2]['title']+" 00:00:00";
|
|
|
|
String selectStr = _notebookDetailChangeModel
|
|
|
|
.dateList[2]['title'] +
|
|
|
|
" 00:00:00";
|
|
|
|
_calendWidget(DateUtil.getDateTime(selectStr));
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -307,7 +314,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { |
|
|
|
// _createDateText(day);
|
|
|
|
dateTime = day;
|
|
|
|
int dateTimeMill = day.millisecondsSinceEpoch;
|
|
|
|
String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'yyyy-MM-dd');
|
|
|
|
String dateText =
|
|
|
|
DateUtil.formatDateMs(dateTimeMill, format: 'yyyy-MM-dd');
|
|
|
|
bool isThird = true;
|
|
|
|
for (int i = 0; i < _notebookDetailChangeModel.dateList.length; i++) {
|
|
|
|
_notebookDetailChangeModel.dateList[i]['select'] = false;
|
|
...
|
...
|
@@ -632,43 +640,117 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { |
|
|
|
MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_F1F0F4),
|
|
|
|
VEmptyView(52),
|
|
|
|
TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
inputFormatters: [LengthLimitingTextInputFormatter(25)],
|
|
|
|
//输入文本的样式
|
|
|
|
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),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
inputFormatters: [LengthLimitingTextInputFormatter(25)],
|
|
|
|
//输入文本的样式
|
|
|
|
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,
|
|
|
|
)),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
DialogUtil.showRemarkDialog(
|
|
|
|
context, remarkManagerModel.remarks, (item) {
|
|
|
|
int index = remarkManagerModel.remarks.indexOf(item);
|
|
|
|
_refreshRemark(remarkManagerModel.remarks, index);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(left: ScreenUtil().setWidth(40)),
|
|
|
|
width: ScreenUtil().setWidth(122),
|
|
|
|
height: ScreenUtil().setWidth(42),
|
|
|
|
child: Text(
|
|
|
|
'快速备注',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
color: MyColours.color_199095),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// 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(30),
|
|
|
|
_remarkListWidget()
|
|
|
|
// VEmptyView(62),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_remarkListWidget() {
|
|
|
|
List<Remark> remark = [];
|
|
|
|
if (remarkManagerModel.remarks.length > 4) {
|
|
|
|
remark = remarkManagerModel.remarks.sublist(0, 5);
|
|
|
|
} else {
|
|
|
|
remark = remarkManagerModel.remarks;
|
|
|
|
}
|
|
|
|
return Container(
|
|
|
|
height: ScreenUtil().setWidth(50),
|
|
|
|
child: ListView.builder(
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: remark.length,
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
itemBuilder: (BuildContext contxt, int index) {
|
|
|
|
return remarkButton(
|
|
|
|
content: remark[index].custom,
|
|
|
|
isSelect: remark[index].selected,
|
|
|
|
onPress: () {
|
|
|
|
setState(() {
|
|
|
|
remark[index].selected = !remark[index].selected;
|
|
|
|
});
|
|
|
|
_refreshRemark(remark, index);
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_refreshRemark(List<Remark> remark, int index) {
|
|
|
|
String currentRemark = '';
|
|
|
|
for (int i = 0; i < remark.length; i++) {
|
|
|
|
if (remark[i].selected) {
|
|
|
|
if (currentRemark.length == 0) {
|
|
|
|
currentRemark += '${remark[i].custom}';
|
|
|
|
} else {
|
|
|
|
currentRemark += '、${remark[i].custom}';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentRemark.length > 25) {
|
|
|
|
Utils.showToast('备注字数超过25个字!');
|
|
|
|
remark[index].selected = !remark[index].selected;
|
|
|
|
} else {
|
|
|
|
setState(() {
|
|
|
|
_notebookDetailChangeModel.customController.text = currentRemark;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///底部弹框,设置时间30分钟间隔布局
|
|
|
|
_showDateChooseWidget(BuildContext context) async {
|
|
|
|
List tempMndList = [];
|
|
...
|
...
|
@@ -725,7 +807,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { |
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(60),vertical: ScreenUtil().setWidth(40)),
|
|
|
|
horizontal: ScreenUtil().setWidth(60),
|
|
|
|
vertical: ScreenUtil().setWidth(40)),
|
|
|
|
child: GridView.builder(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.only(top: ScreenUtil().setWidth(20)),
|
|
...
|
...
|
@@ -822,7 +905,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { |
|
|
|
//用户选择不在弹出权限提示框
|
|
|
|
print('never');
|
|
|
|
DialogUtil.openAlertDialog(
|
|
|
|
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置',340.0, onTap: () {
|
|
|
|
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0,
|
|
|
|
onTap: () {
|
|
|
|
openSetting();
|
|
|
|
Navigator.pop(context, '');
|
|
|
|
});
|
|
...
|
...
|
@@ -868,6 +952,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { |
|
|
|
Widget build(BuildContext context) {
|
|
|
|
_notebookDetailChangeModel =
|
|
|
|
Provider.of<NotebookDetailChangeModel>(context, listen: true);
|
|
|
|
remarkManagerModel = Provider.of<RemarkManagerModel>(context, listen: true);
|
|
|
|
return GestureDetector(
|
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
|
onTap: () {
|
|
...
|
...
|
@@ -1126,3 +1211,29 @@ class _ButtonState extends State<CustomButton> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget remarkButton({GestureTapCallback onPress, content, isSelect = false}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onPress,
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setHeight(48),
|
|
|
|
margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(20),
|
|
|
|
vertical: ScreenUtil().setWidth(6)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
color: isSelect ? MyColours.color_199095 : MyColours.color_f5f5f5,
|
|
|
|
),
|
|
|
|
child: Align(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
content,
|
|
|
|
style: TextStyle(
|
|
|
|
color: isSelect ? Colors.white : MyColours.color_353535,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
} |
...
|
...
|
|