Commit bedc8edb5c23c0fd0cd3362de37255bf2680cedb

Authored by “gaiyaguang”
1 parent bf4ca5d6

合并

... ... @@ -11,6 +11,7 @@ import 'package:one_key/provider/notebook_detail_change_model.dart';
import 'package:one_key/provider/notebook_detail_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';
... ... @@ -21,6 +22,7 @@ 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/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';
... ... @@ -102,7 +104,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
_topWidget() {
return Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(20)),
child: Column(
children: [
//第一行 日期选择
... ... @@ -173,7 +177,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
);
}).toList()),
VEmptyView(60),
VEmptyView(40),
//早市、午市、晚市
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
... ... @@ -233,7 +237,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
),
);
}).toList()),
VEmptyView(60),
VEmptyView(40),
///人数选择
Row(
... ... @@ -293,7 +297,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
model: _notebookDetailChangeModel,
);
}).toList(),
)
),
VEmptyView(20),
],
),
);
... ... @@ -469,9 +474,46 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
margin: EdgeInsets.only(top: ScreenUtil().setWidth(72)),
// margin: EdgeInsets.only(top: ScreenUtil().setWidth(72)),
child: Column(
children: [
InkWell(
onTap: () {
_openAddressBook();
},
child: Container(
height: ScreenUtil().setWidth(120),
child: Row(
children: [
Image.asset(
Utils.getImgPath('phone_list'),
width: ScreenUtil().setWidth(26 * 2),
height: ScreenUtil().setWidth(26 * 2),
),
HEmptyView(20),
Container(
height: ScreenUtil().setWidth(48),
alignment: Alignment.center,
child: Text(
'一键录入',
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(34)),
),
),
Spacer(),
Image.asset(
'assets/arr_right_gray.png',
width: ScreenUtil().setWidth(12),
height: ScreenUtil().setWidth(22),
)
],
),
),
),
MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_F1F0F4),
VEmptyView(52),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
... ... @@ -479,15 +521,16 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
Expanded(
child: TextField(
maxLines: 1,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_353535),
controller: _notebookDetailChangeModel.phoneController,
focusNode: _phoneNode,
controller: _notebookDetailChangeModel.nameController,
focusNode: _nameNode,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: "客户电话",
hintText: "客户姓名(必填)",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(34),
... ... @@ -496,50 +539,39 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
border: InputBorder.none,
),
onChanged: (value) {},
onChanged: (value) {
print('ggg');
},
onEditingComplete: () {
print('fff');
_phoneNode.unfocus();
_nameNode.unfocus();
},
keyboardType: TextInputType.number,
),
),
HEmptyView(40),
InkWell(
onTap: () {
_openAddressBook();
},
child: Text(
'打开通讯录',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(34),
),
keyboardType: TextInputType.text,
),
),
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),
),
),
),
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),
VEmptyView(52),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
... ... @@ -547,16 +579,15 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
Expanded(
child: TextField(
maxLines: 1,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_353535),
controller: _notebookDetailChangeModel.nameController,
focusNode: _nameNode,
controller: _notebookDetailChangeModel.phoneController,
focusNode: _phoneNode,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: "客户姓名(必填)",
hintText: "客户电话",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(34),
... ... @@ -565,39 +596,49 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
border: InputBorder.none,
),
onChanged: (value) {
print('ggg');
},
onChanged: (value) {},
onEditingComplete: () {
print('fff');
_nameNode.unfocus();
_phoneNode.unfocus();
},
keyboardType: TextInputType.text,
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()),
Container(
height: ScreenUtil().setWidth(48),
width: ScreenUtil().setWidth(84 * 2),
child: RoundButton(
height: ScreenUtil().setWidth(80),
width: ScreenUtil().setWidth(300),
radius: ScreenUtil().setWidth(0),
fontSize: 28,
isBold: false,
text: int.parse(widget.detailEntity.is_set_ddate) == 0
? '设置时间'
: _notebookDetailChangeModel.ddateStr,
onPressed: () {
_showDateChooseWidget(context);
}
// 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),
VEmptyView(52),
TextField(
maxLines: 1,
inputFormatters: [LengthLimitingTextInputFormatter(25)],
... ... @@ -797,6 +838,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
if (permissionStatus == PermissionStatus.neverAskAgain) {
//用户选择不在弹出权限提示框
print('never');
DialogUtil.openAlertDialog(context);
} else {
// 申请权限
bool canContacts = await requestContactPermission();
... ... @@ -804,7 +846,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
_getContactData();
} else {
//拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
print(canContacts);
DialogUtil.openAlertDialog(context);
}
}
} else {
... ...
... ... @@ -47,4 +47,5 @@ class MyColours {
static const Color color_E95750 = Color(0xffE95750);
static const Color color_A9E3E6 = Color(0xffA9E3E6);
static const Color color_e5e5e5 = Color(0xffe5e5e5);
static const Color color_efefef = Color(0xffefefef);
}
... ...
... ... @@ -8,8 +8,10 @@ import 'package:one_key/constant/constant.dart';
import 'package:one_key/pages/message/message_dialog_item.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/misc.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/widgets/v_empty_view.dart';
... ... @@ -199,7 +201,7 @@ class DialogUtil {
TableCalendar(
calendarController: _calendarController,
initialSelectedDay: selectDateTime,
onDaySelected: (day, events,holidays) {
onDaySelected: (day, events, holidays) {
Navigator.of(dialogContext).pop(day);
},
availableGestures: AvailableGestures.none,
... ... @@ -677,4 +679,106 @@ class DialogUtil {
return value;
});
}
static Future openAlertDialog(BuildContext context) async {
final action = await showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Center(
child: Container(
height: ScreenUtil().setWidth(160 * 2 + 20),
width: ScreenUtil().setWidth(280 * 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(30)))), //设置圆角
child: Column(
children: [
VEmptyView(40),
Container(
height: ScreenUtil().setWidth(48),
alignment: Alignment.center,
child: Text('未获得通讯录权限',
style: TextStyle(
fontSize: ScreenUtil().setSp(36),
color: MyColours.color_353535)),
),
VEmptyView(20),
Container(
// height: ScreenUtil().setWidth(80),
// color: Colors.red,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(68)),
alignment: Alignment.center,
child: Transform.translate(
offset: Offset(
0,
ScreenUtil().setWidth(2) /
ScreenUtil()
.setWidth(2)), //1为 StrutStyle 的 leading的值
child: Text(
"请在手机的权限管理里,将联系人权限开启",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28),
),
strutStyle: StrutStyle(
forceStrutHeight: true,
height: ScreenUtil().setWidth(0.8),
leading: ScreenUtil().setWidth(2)),
),
)),
VEmptyView(28),
MyDivider(
ScreenUtil().setWidth(280 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_efefef),
FlatButton(
child: Text(
'去设置',
style: TextStyle(
color: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setWidth(34)),
),
onPressed: () {
openSetting();
// Navigator.pop(context, '确认');
},
)
],
),
),
),
);
// return AlertDialog(
// title: Text('未获得通讯录权限'),
// content: Text('请在手机的权限管理里,将联系人权限开启'),
// actions: <Widget>[
// FlatButton(
// child: Text('去设置'),
// onPressed: () {
// Navigator.pop(context, '确认');
// },
// ),
// ],
// );
},
);
switch (action) {
// case Action.Ok:
// setState(() {
// _choice = 'Ok';
// });
// break;
// case Action.Cancel:
// setState(() {
// _choice = 'Cancel';
// });
// break;
// default:
}
}
}
... ...