Commit e292a7c11f10da34ef54acec42218e1399c97de6

Authored by wdn127929
1 parent c06fcd52

自定义标签多选OK

... ... @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
... ...
... ... @@ -38,6 +38,7 @@ class CustomerLabelSunModel extends Object {
@JsonKey(name: 'cdate')
String cdate;
bool select = false;
CustomerLabelSunModel(
this.id,
... ...
... ... @@ -453,10 +453,11 @@ class _MyContactListPageState extends State<MyContactListPage> {
Widget flatBtn(String tilte, Color color) {
return Container(
height: w(18),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: w(4)),
margin: EdgeInsets.only(left: w(10)),
// constraints: BoxConstraints(maxWidth: w(50)),
// height: w(18),
// alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: w(4), vertical: w(0.5)),
// margin: EdgeInsets.only(left: w(10)),
decoration: BoxDecoration(
border: Border.all(color: color, width: w(1)),
borderRadius: BorderRadius.circular(r(5))),
... ... @@ -467,6 +468,55 @@ class _MyContactListPageState extends State<MyContactListPage> {
);
}
List<Widget> labelsWidget(model) {
List<Widget> data = [];
data.add(Container(
width: w(30),
height: w(16),
alignment: Alignment.center,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(10),
// vertical: ScreenUtil().setWidth(2),
// ),
decoration: BoxDecoration(
color: model.attr != null && model.attr != ''
? model.attr == '沉睡'
? MyColours.color_999999
: model.attr == '活跃'
? MyColours.color_00715F
: model.attr == '流失'
? MyColours.color_E34D59
: Color.fromRGBO(239, 143, 49, 1)
: Colors.transparent,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10),
),
),
child: Text(model.attr == null || model.attr == '' ? '' : model.attr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20)))));
if (model.label != null) {
List<String> labels = model.label.split(',');
labels.forEach((element) {
data.add(flatBtn(element, MyColours.color_B39437));
});
}
if (model.isMember == '1' || model.isMember == '0') {
data.add(flatBtn(
model.isMember == '1' ? '会员' : '非会员', MyColours.color_438E93));
}
if ('${model.storeDay}' != '0' && model.storeDay != null) {
data.add(flatBtn('存酒${model.storeDay}天', MyColours.color_438E93));
}
return data;
}
///改版item样式
Widget _buildListNewItem(CustomerListSunModel model, int index) {
String susTag = model.getSuspensionTag();
... ... @@ -515,6 +565,7 @@ class _MyContactListPageState extends State<MyContactListPage> {
blurRadius: ScreenUtil().setWidth(8))
]),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: w(35),
... ... @@ -590,51 +641,58 @@ class _MyContactListPageState extends State<MyContactListPage> {
),
),
Padding(
padding: EdgeInsets.all(w(15)),
child: Row(
children: [
Container(
width: w(30),
height: w(16),
alignment: Alignment.center,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(10),
// vertical: ScreenUtil().setWidth(2),
// ),
decoration: BoxDecoration(
color: model.attr != null && model.attr != ''
? model.attr == '沉睡'
? MyColours.color_999999
: model.attr == '活跃'
? MyColours.color_00715F
: model.attr == '流失'
? MyColours.color_E34D59
: Color.fromRGBO(
239, 143, 49, 1)
: Colors.transparent,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10),
),
),
child: Text(
model.attr == null || model.attr == ''
? ''
: model.attr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20)))),
model.label != null
? flatBtn(model.label, MyColours.color_B39437)
: SizedBox(),
if (model.isMember == '1' || model.isMember == '0')
flatBtn(model.isMember == '1' ? '会员' : '非会员',
MyColours.color_438E93),
'${model.storeDay}' != '0' && model.storeDay != null
? flatBtn('存酒${model.storeDay}天',
MyColours.color_438E93)
: SizedBox()
],
)),
padding: EdgeInsets.all(w(15)),
child: Wrap(
runSpacing: w(10),
spacing: w(10),
children: labelsWidget(model),
),
// Row(
// children: [
// Container(
// width: w(30),
// height: w(16),
// alignment: Alignment.center,
// // padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(10),
// // vertical: ScreenUtil().setWidth(2),
// // ),
// decoration: BoxDecoration(
// color: model.attr != null && model.attr != ''
// ? model.attr == '沉睡'
// ? MyColours.color_999999
// : model.attr == '活跃'
// ? MyColours.color_00715F
// : model.attr == '流失'
// ? MyColours.color_E34D59
// : Color.fromRGBO(
// 239, 143, 49, 1)
// : Colors.transparent,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(10),
// ),
// ),
// child: Text(
// model.attr == null || model.attr == ''
// ? ''
// : model.attr,
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(20)))),
// Wrap(children: labelsWidget(model)),
// model.label != null
// ? flatBtn(model.label, MyColours.color_B39437)
// : SizedBox(),
// if (model.isMember == '1' || model.isMember == '0')
// flatBtn(model.isMember == '1' ? '会员' : '非会员',
// MyColours.color_438E93),
// '${model.storeDay}' != '0' && model.storeDay != null
// ? flatBtn('存酒${model.storeDay}天',
// MyColours.color_438E93)
// : SizedBox()
// ],
// )
),
Padding(
padding: EdgeInsets.only(
left: w(15), right: w(15), bottom: w(10)),
... ...
... ... @@ -400,10 +400,10 @@ class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> {
if (label != null && label.length > 0) {
List<String> labels = label.split(',');
labels.forEach((element) {
Text(
data.add(Text(
element,
style: TextStyle(fontSize: font(16), color: MyColours.color_999999),
);
style: TextStyle(fontSize: font(14), color: MyColours.color_999999),
));
});
}
... ... @@ -602,36 +602,69 @@ class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> {
'职位', '填写职位', positionController, positionFocus),
InkWell(
onTap: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //隐藏键盘
// DialogUtil.showSelectCusmanDialog(
// context,
// customerProvider.labelList.map((item) {
// return item.label;
// }).toList(), (value) {
// if (value != null) {
// setState(() {
// customerProvider.labelSelIndex =
// value.first;
// labelShow = customerProvider
// .labelList[
// customerProvider.labelSelIndex]
// .label;
// });
// }
// },
// selecteds:
// customerProvider.labelSelIndex == null
// ? []
// : [
// customerProvider.labelSelIndex
// ])
// .then((value) {});
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(
context,
customerProvider.labelList.map((item) {
return item.label;
}).toList(), (value) {
// 存储
DialogUtil.openLabelSelectModalBottomSheet(
context,
customerProvider.labelList,
labelShow, rCallback: (value) async {
if (value != null) {
setState(() {
customerProvider.labelSelIndex =
value.first;
labelShow = customerProvider
.labelList[
customerProvider.labelSelIndex]
.label;
});
labelShow = value;
// customerProvider.labelSelIndex =
// value.first;
// labelShow = customerProvider
// .labelList[
// customerProvider.labelSelIndex]
// .label;
}
},
selecteds:
customerProvider.labelSelIndex == null
? []
: [
customerProvider.labelSelIndex
])
.then((value) {});
setState(() {});
// bool sucess = await detailModel.upReserveInfo(
// context, widget.rid,
// reserveType: reserveType,
// needToast: false);
// if (sucess) {
// EventBus()
// .emit("refresh_tablemanager"); //刷新桌位
// bus.emit("refresh_book_list"); //刷新已预订列表
// bus.emit("refresh_detail");
// // await _getReserveDetail(
// // showCicle: false);
// }
// }
});
},
child: Container(
// height: ScreenUtil().setWidth(60),
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(50)),
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(50),
bottom: w(12)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
... ... @@ -639,6 +672,7 @@ class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> {
color: Color.fromRGBO(
220, 220, 220, 1)))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
... ... @@ -658,17 +692,18 @@ class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> {
color: MyColours.color_333333),
),
),
Expanded(
child: Text(
labelShow,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color:
Color.fromRGBO(193, 194, 63, 1),
fontSize: ScreenUtil().setSp(28),
),
)),
HEmptyView(10),
// Expanded(
// child: Text(
// labelShow,
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color:
// Color.fromRGBO(193, 194, 63, 1),
// fontSize: ScreenUtil().setSp(28),
// ),
// )),
// HEmptyView(10),
Spacer(),
Image.asset(
"assets/arrow_right_new.png",
width: ScreenUtil().setWidth(14),
... ... @@ -676,9 +711,14 @@ class _MyCustomerDetailEditPageState extends State<MyCustomerDetailEditPage> {
)
],
),
VEmptyView(10),
Wrap(
children: [],
VEmptyView(15),
Padding(
padding: EdgeInsets.only(left: w(25)),
child: Wrap(
runSpacing: w(10),
spacing: w(10),
children: labelsWidget(labelShow),
),
)
],
))),
... ...
... ... @@ -255,6 +255,108 @@ class _MyCustomerDetailPageState extends State<MyCustomerDetailPage> {
);
}
List<Widget> labelsWidget() {
List<Widget> data = [];
if (customerProvider.guestInfoSunModel.guest.attr != null &&
customerProvider.guestInfoSunModel.guest.attr != '') {
data.add(Container(
width: w(30),
height: w(16),
alignment: Alignment.center,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(10),
// vertical: ScreenUtil().setWidth(2),
// ),
decoration: BoxDecoration(
color: customerProvider.guestInfoSunModel.guest.attr != null &&
customerProvider.guestInfoSunModel.guest.attr != ''
? customerProvider.guestInfoSunModel.guest.attr == '沉睡'
? MyColours.color_999999
: customerProvider.guestInfoSunModel.guest.attr == '活跃'
? MyColours.color_00715F
: customerProvider.guestInfoSunModel.guest.attr == '流失'
? MyColours.color_E34D59
: Color.fromRGBO(239, 143, 49, 1)
: Colors.transparent,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10),
),
),
child: Text(customerProvider.guestInfoSunModel.guest.attr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20)))));
}
if (customerProvider.guestInfoSunModel.guest.label != null) {
List<String> labels =
customerProvider.guestInfoSunModel.guest.label.split(',');
labels.forEach((element) {
data.add(flatBtn(element, MyColours.color_B39437));
});
}
if (customerProvider.guestInfoSunModel.guest.isMember == '1' ||
customerProvider.guestInfoSunModel.guest.isMember == '0') {
data.add(flatBtn(
customerProvider.guestInfoSunModel.guest.isMember == '1'
? '会员'
: '非会员',
MyColours.color_438E93));
}
if ('${customerProvider.guestInfoSunModel.store.storeDay}' != '0') {
data.add(flatBtn(
'存酒${customerProvider.guestInfoSunModel.store.storeDay}天',
MyColours.color_438E93));
}
// data.add(Container(
// width: w(30),
// height: w(16),
// alignment: Alignment.center,
// // padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(10),
// // vertical: ScreenUtil().setWidth(2),
// // ),
// decoration: BoxDecoration(
// color: model.attr != null && model.attr != ''
// ? model.attr == '沉睡'
// ? MyColours.color_999999
// : model.attr == '活跃'
// ? MyColours.color_00715F
// : model.attr == '流失'
// ? MyColours.color_E34D59
// : Color.fromRGBO(239, 143, 49, 1)
// : Colors.transparent,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(10),
// ),
// ),
// child: Text(model.attr == null || model.attr == '' ? '' : model.attr,
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(20)))));}
// if (model.label != null) {
// List<String> labels = model.label.split(',');
// labels.forEach((element) {
// data.add(flatBtn(element, MyColours.color_B39437));
// });
// }
// if (model.isMember == '1' || model.isMember == '0') {
// data.add(flatBtn(
// model.isMember == '1' ? '会员' : '非会员', MyColours.color_438E93));
// }
// if ('${model.storeDay}' != '0' && model.storeDay != null) {
// data.add(flatBtn('存酒${model.storeDay}天', MyColours.color_438E93));
// }
return data;
}
Widget _lineItemWidget(String title, String content) {
return Container(
padding: EdgeInsets.symmetric(
... ... @@ -335,69 +437,74 @@ class _MyCustomerDetailPageState extends State<MyCustomerDetailPage> {
],
),
VEmptyView(20),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (customerProvider.guestInfoSunModel.guest.attr != null &&
customerProvider.guestInfoSunModel.guest.attr != '')
Container(
width: w(30),
height: w(16),
alignment: Alignment.center,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(10),
// vertical: ScreenUtil().setWidth(2),
// ),
decoration: BoxDecoration(
color: customerProvider
.guestInfoSunModel.guest.attr !=
null &&
customerProvider
.guestInfoSunModel.guest.attr !=
''
? customerProvider
.guestInfoSunModel.guest.attr ==
'沉睡'
? MyColours.color_999999
: customerProvider
.guestInfoSunModel.guest.attr ==
'活跃'
? MyColours.color_00715F
: customerProvider.guestInfoSunModel
.guest.attr ==
'流失'
? MyColours.color_E34D59
: Color.fromRGBO(239, 143, 49, 1)
: Colors.transparent,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10),
),
),
child: Text(
customerProvider.guestInfoSunModel.guest.attr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20)))),
if (customerProvider.guestInfoSunModel.guest.label != null)
flatBtn(customerProvider.guestInfoSunModel.guest.label,
MyColours.color_B39437),
if (customerProvider.guestInfoSunModel.guest.isMember ==
'1' ||
customerProvider.guestInfoSunModel.guest.isMember ==
'0')
flatBtn(
customerProvider.guestInfoSunModel.guest.isMember ==
'1'
? '会员'
: '非会员',
MyColours.color_438E93),
if ('${customerProvider.guestInfoSunModel.store.storeDay}' !=
'0')
flatBtn(
'存酒${customerProvider.guestInfoSunModel.store.storeDay}天',
MyColours.color_438E93)
],
Wrap(
runSpacing: w(10),
spacing: w(10),
children: labelsWidget(),
),
// Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// if (customerProvider.guestInfoSunModel.guest.attr != null &&
// customerProvider.guestInfoSunModel.guest.attr != '')
// Container(
// width: w(30),
// height: w(16),
// alignment: Alignment.center,
// // padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(10),
// // vertical: ScreenUtil().setWidth(2),
// // ),
// decoration: BoxDecoration(
// color: customerProvider
// .guestInfoSunModel.guest.attr !=
// null &&
// customerProvider
// .guestInfoSunModel.guest.attr !=
// ''
// ? customerProvider
// .guestInfoSunModel.guest.attr ==
// '沉睡'
// ? MyColours.color_999999
// : customerProvider
// .guestInfoSunModel.guest.attr ==
// '活跃'
// ? MyColours.color_00715F
// : customerProvider.guestInfoSunModel
// .guest.attr ==
// '流失'
// ? MyColours.color_E34D59
// : Color.fromRGBO(239, 143, 49, 1)
// : Colors.transparent,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(10),
// ),
// ),
// child: Text(
// customerProvider.guestInfoSunModel.guest.attr,
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(20)))),
// if (customerProvider.guestInfoSunModel.guest.label != null)
// flatBtn(customerProvider.guestInfoSunModel.guest.label,
// MyColours.color_B39437),
// if (customerProvider.guestInfoSunModel.guest.isMember ==
// '1' ||
// customerProvider.guestInfoSunModel.guest.isMember ==
// '0')
// flatBtn(
// customerProvider.guestInfoSunModel.guest.isMember ==
// '1'
// ? '会员'
// : '非会员',
// MyColours.color_438E93),
// if ('${customerProvider.guestInfoSunModel.store.storeDay}' !=
// '0')
// flatBtn(
// '存酒${customerProvider.guestInfoSunModel.store.storeDay}天',
// MyColours.color_438E93)
// ],
// ),
VEmptyView(20),
// Text(
// customerProvider.guestInfoSunModel.guest.nickName == null
... ... @@ -635,10 +742,10 @@ class _MyCustomerDetailPageState extends State<MyCustomerDetailPage> {
Widget flatBtn(String tilte, Color color) {
return Container(
height: w(18),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: w(4)),
margin: EdgeInsets.only(left: w(10)),
// height: w(18),
// alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: w(4), vertical: w(0.5)),
// margin: EdgeInsets.only(left: w(10)),
decoration: BoxDecoration(
border: Border.all(color: color, width: w(1)),
borderRadius: BorderRadius.circular(r(5))),
... ...
... ... @@ -438,10 +438,11 @@ class _ContactListPageState extends State<ContactListPage> {
Widget flatBtn(String tilte, Color color) {
return Container(
height: w(18),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: w(4)),
margin: EdgeInsets.only(left: w(10)),
// constraints: BoxConstraints(maxWidth: w(50)),
// height: w(18),
// alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: w(4), vertical: w(0.5)),
// margin: EdgeInsets.only(left: w(10)),
decoration: BoxDecoration(
border: Border.all(color: color, width: w(1)),
borderRadius: BorderRadius.circular(r(5))),
... ... @@ -452,6 +453,55 @@ class _ContactListPageState extends State<ContactListPage> {
);
}
List<Widget> labelsWidget(model) {
List<Widget> data = [];
data.add(Container(
width: w(30),
height: w(16),
alignment: Alignment.center,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(10),
// vertical: ScreenUtil().setWidth(2),
// ),
decoration: BoxDecoration(
color: model.attr != null && model.attr != ''
? model.attr == '沉睡'
? MyColours.color_999999
: model.attr == '活跃'
? MyColours.color_00715F
: model.attr == '流失'
? MyColours.color_E34D59
: Color.fromRGBO(239, 143, 49, 1)
: Colors.transparent,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10),
),
),
child: Text(model.attr == null || model.attr == '' ? '' : model.attr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20)))));
if (model.label != null) {
List<String> labels = model.label.split(',');
labels.forEach((element) {
data.add(flatBtn(element, MyColours.color_B39437));
});
}
if (model.isMember == '1' || model.isMember == '0') {
data.add(flatBtn(
model.isMember == '1' ? '会员' : '非会员', MyColours.color_438E93));
}
if ('${model.storeDay}' != '0' && model.storeDay != null) {
data.add(flatBtn('存酒${model.storeDay}天', MyColours.color_438E93));
}
return data;
}
///改版item样式
Widget _buildListNewItem(CustomerBySellerSunModel model, int index) {
String susTag = model.getSuspensionTag();
... ... @@ -501,6 +551,7 @@ class _ContactListPageState extends State<ContactListPage> {
blurRadius: ScreenUtil().setWidth(8))
]),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: w(35),
... ... @@ -577,52 +628,59 @@ class _ContactListPageState extends State<ContactListPage> {
),
Padding(
padding: EdgeInsets.all(w(15)),
child: Row(
children: [
Container(
width: w(30),
height: w(16),
alignment: Alignment.center,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(10),
// vertical: ScreenUtil().setWidth(2),
// ),
decoration: BoxDecoration(
color: model.attr != null && model.attr != ''
? model.attr == '沉睡'
? MyColours.color_999999
: model.attr == '活跃'
? MyColours.color_00715F
: model.attr == '流失'
? MyColours.color_E34D59
: Color.fromRGBO(
239, 143, 49, 1)
: Colors.transparent,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10),
),
),
child: Text(
model.attr == null || model.attr == ''
? ''
: model.attr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20)))),
model.label != null
? flatBtn(model.label, MyColours.color_B39437)
: SizedBox(),
model.isMember == '1'
? flatBtn('会员', MyColours.color_438E93)
: model.isMember == '0'
? flatBtn('非会员', MyColours.color_438E93)
: SizedBox(),
'${model.storeDay}' != '0'
? flatBtn('存酒${model.storeDay}天',
MyColours.color_438E93)
: SizedBox()
],
child: Wrap(
runSpacing: w(10),
spacing: w(10),
children: labelsWidget(model),
)),
// Padding(
// padding: EdgeInsets.all(w(15)),
// child: Row(
// children: [
// Container(
// width: w(30),
// height: w(16),
// alignment: Alignment.center,
// // padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(10),
// // vertical: ScreenUtil().setWidth(2),
// // ),
// decoration: BoxDecoration(
// color: model.attr != null && model.attr != ''
// ? model.attr == '沉睡'
// ? MyColours.color_999999
// : model.attr == '活跃'
// ? MyColours.color_00715F
// : model.attr == '流失'
// ? MyColours.color_E34D59
// : Color.fromRGBO(
// 239, 143, 49, 1)
// : Colors.transparent,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(10),
// ),
// ),
// child: Text(
// model.attr == null || model.attr == ''
// ? ''
// : model.attr,
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(20)))),
// model.label != null
// ? flatBtn(model.label, MyColours.color_B39437)
// : SizedBox(),
// model.isMember == '1'
// ? flatBtn('会员', MyColours.color_438E93)
// : model.isMember == '0'
// ? flatBtn('非会员', MyColours.color_438E93)
// : SizedBox(),
// '${model.storeDay}' != '0'
// ? flatBtn('存酒${model.storeDay}天',
// MyColours.color_438E93)
// : SizedBox()
// ],
// )),
Padding(
padding: EdgeInsets.only(
left: w(15), right: w(15), bottom: w(10)),
... ...
... ... @@ -17,6 +17,8 @@ import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../../../utils/screen_util.dart';
class CustomerDetailEditPage extends StatefulWidget {
final Guest guest;
final FromPage fromPage;
... ... @@ -343,6 +345,22 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> {
);
}
List<Widget> labelsWidget(String label) {
List<Widget> data = [];
if (label != null && label.length > 0) {
List<String> labels = label.split(',');
labels.forEach((element) {
data.add(Text(
element,
style: TextStyle(fontSize: font(14), color: MyColours.color_999999),
));
});
}
return data;
}
///忌口和喜好
Widget _textMulLine(
String title, String hintText, TextEditingController controller) {
... ... @@ -600,78 +618,200 @@ class _CustomerDetailEditPageState extends State<CustomerDetailEditPage> {
'职位', '填写职位', positionController, positionFocus),
InkWell(
onTap: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //隐藏键盘
// DialogUtil.showSelectCusmanDialog(
// context,
// customerProvider.labelList.map((item) {
// return item.label;
// }).toList(), (value) {
// if (value != null) {
// setState(() {
// customerProvider.labelSelIndex =
// value.first;
// labelShow = customerProvider
// .labelList[
// customerProvider.labelSelIndex]
// .label;
// });
// }
// },
// selecteds:
// customerProvider.labelSelIndex == null
// ? []
// : [
// customerProvider.labelSelIndex
// ])
// .then((value) {});
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(
context,
customerProvider.labelList.map((item) {
return item.label;
}).toList(), (value) {
// 存储
DialogUtil.openLabelSelectModalBottomSheet(
context,
customerProvider.labelList,
labelShow, rCallback: (value) async {
if (value != null) {
setState(() {
customerProvider.labelSelIndex =
value.first;
labelShow = customerProvider
.labelList[
customerProvider.labelSelIndex]
.label;
});
labelShow = value;
// customerProvider.labelSelIndex =
// value.first;
// labelShow = customerProvider
// .labelList[
// customerProvider.labelSelIndex]
// .label;
}
},
selecteds:
customerProvider.labelSelIndex == null
? []
: [
customerProvider.labelSelIndex
])
.then((value) {});
setState(() {});
// bool sucess = await detailModel.upReserveInfo(
// context, widget.rid,
// reserveType: reserveType,
// needToast: false);
// if (sucess) {
// EventBus()
// .emit("refresh_tablemanager"); //刷新桌位
// bus.emit("refresh_book_list"); //刷新已预订列表
// bus.emit("refresh_detail");
// // await _getReserveDetail(
// // showCicle: false);
// }
// }
});
},
child: Container(
// height: ScreenUtil().setWidth(60),
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(50)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: Color.fromRGBO(
220, 220, 220, 1)))),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
// color: Colors.red,
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setWidth(35),
child: Text(
'自定义标签',
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_333333),
),
),
Expanded(
child: Text(
labelShow,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color.fromRGBO(193, 194, 63, 1),
fontSize: ScreenUtil().setSp(28),
// height: ScreenUtil().setWidth(60),
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(50),
bottom: w(12)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: Color.fromRGBO(
220, 220, 220, 1)))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Container(
// color: Colors.red,
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setWidth(35),
child: Text(
'自定义标签',
style: TextStyle(
fontSize:
ScreenUtil().setSp(28),
color: MyColours.color_333333),
),
),
// Expanded(
// child: Text(
// labelShow,
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color:
// Color.fromRGBO(193, 194, 63, 1),
// fontSize: ScreenUtil().setSp(28),
// ),
// )),
// HEmptyView(10),
Spacer(),
Image.asset(
"assets/arrow_right_new.png",
width: ScreenUtil().setWidth(14),
height: ScreenUtil().setWidth(22),
)
],
),
)),
HEmptyView(10),
Image.asset(
Utils.getImgPath(showLabel
? 'c_arrow_up'
: 'c_arrow_down'),
width: ScreenUtil().setWidth(24),
// height: ScreenUtil().setWidth(10),
)
],
),
)),
VEmptyView(15),
Padding(
padding: EdgeInsets.only(left: w(25)),
child: Wrap(
runSpacing: w(10),
spacing: w(10),
children: labelsWidget(labelShow),
),
)
],
))),
// InkWell(
// onTap: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //隐藏键盘
// DialogUtil.showSelectCusmanDialog(
// context,
// customerProvider.labelList.map((item) {
// return item.label;
// }).toList(), (value) {
// if (value != null) {
// setState(() {
// customerProvider.labelSelIndex =
// value.first;
// labelShow = customerProvider
// .labelList[
// customerProvider.labelSelIndex]
// .label;
// });
// }
// },
// selecteds:
// customerProvider.labelSelIndex == null
// ? []
// : [
// customerProvider.labelSelIndex
// ])
// .then((value) {});
// },
// child: Container(
// // height: ScreenUtil().setWidth(60),
// padding: EdgeInsets.symmetric(
// vertical: ScreenUtil().setWidth(50)),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// width: ScreenUtil().setWidth(2),
// color: Color.fromRGBO(
// 220, 220, 220, 1)))),
// child: Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Container(
// // color: Colors.red,
// width: ScreenUtil().setWidth(150),
// height: ScreenUtil().setWidth(35),
// child: Text(
// '自定义标签',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(28),
// color: MyColours.color_333333),
// ),
// ),
// Expanded(
// child: Text(
// labelShow,
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: Color.fromRGBO(193, 194, 63, 1),
// fontSize: ScreenUtil().setSp(28),
// ),
// )),
// HEmptyView(10),
// Image.asset(
// Utils.getImgPath(showLabel
// ? 'c_arrow_up'
// : 'c_arrow_down'),
// width: ScreenUtil().setWidth(24),
// // height: ScreenUtil().setWidth(10),
// )
// ],
// ),
// )),
InkWell(
onTap: () {
FocusScope.of(context)
... ...
... ... @@ -346,69 +346,74 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
],
),
VEmptyView(20),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (customerProvider.guestInfoSunModel.guest.attr != null &&
customerProvider.guestInfoSunModel.guest.attr != '')
Container(
width: w(30),
height: w(16),
alignment: Alignment.center,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(10),
// vertical: ScreenUtil().setWidth(2),
// ),
decoration: BoxDecoration(
color: customerProvider
.guestInfoSunModel.guest.attr !=
null &&
customerProvider
.guestInfoSunModel.guest.attr !=
''
? customerProvider
.guestInfoSunModel.guest.attr ==
'沉睡'
? MyColours.color_999999
: customerProvider
.guestInfoSunModel.guest.attr ==
'活跃'
? MyColours.color_00715F
: customerProvider.guestInfoSunModel
.guest.attr ==
'流失'
? MyColours.color_E34D59
: Color.fromRGBO(239, 143, 49, 1)
: Colors.transparent,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10),
),
),
child: Text(
customerProvider.guestInfoSunModel.guest.attr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20)))),
if (customerProvider.guestInfoSunModel.guest.label != null)
flatBtn(customerProvider.guestInfoSunModel.guest.label,
MyColours.color_B39437),
if (customerProvider.guestInfoSunModel.guest.isMember ==
'1' ||
customerProvider.guestInfoSunModel.guest.isMember ==
'0')
flatBtn(
customerProvider.guestInfoSunModel.guest.isMember ==
'1'
? '会员'
: '非会员',
MyColours.color_438E93),
if ('${customerProvider.guestInfoSunModel.store.storeDay}' !=
'0')
flatBtn(
'存酒${customerProvider.guestInfoSunModel.store.storeDay}天',
MyColours.color_438E93)
],
Wrap(
runSpacing: w(10),
spacing: w(10),
children: labelsWidget(),
),
// Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// if (customerProvider.guestInfoSunModel.guest.attr != null &&
// customerProvider.guestInfoSunModel.guest.attr != '')
// Container(
// width: w(30),
// height: w(16),
// alignment: Alignment.center,
// // padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(10),
// // vertical: ScreenUtil().setWidth(2),
// // ),
// decoration: BoxDecoration(
// color: customerProvider
// .guestInfoSunModel.guest.attr !=
// null &&
// customerProvider
// .guestInfoSunModel.guest.attr !=
// ''
// ? customerProvider
// .guestInfoSunModel.guest.attr ==
// '沉睡'
// ? MyColours.color_999999
// : customerProvider
// .guestInfoSunModel.guest.attr ==
// '活跃'
// ? MyColours.color_00715F
// : customerProvider.guestInfoSunModel
// .guest.attr ==
// '流失'
// ? MyColours.color_E34D59
// : Color.fromRGBO(239, 143, 49, 1)
// : Colors.transparent,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(10),
// ),
// ),
// child: Text(
// customerProvider.guestInfoSunModel.guest.attr,
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(20)))),
// if (customerProvider.guestInfoSunModel.guest.label != null)
// flatBtn(customerProvider.guestInfoSunModel.guest.label,
// MyColours.color_B39437),
// if (customerProvider.guestInfoSunModel.guest.isMember ==
// '1' ||
// customerProvider.guestInfoSunModel.guest.isMember ==
// '0')
// flatBtn(
// customerProvider.guestInfoSunModel.guest.isMember ==
// '1'
// ? '会员'
// : '非会员',
// MyColours.color_438E93),
// if ('${customerProvider.guestInfoSunModel.store.storeDay}' !=
// '0')
// flatBtn(
// '存酒${customerProvider.guestInfoSunModel.store.storeDay}天',
// MyColours.color_438E93)
// ],
// ),
VEmptyView(20),
Text(
customerProvider.guestInfoSunModel.guest.nickName == null
... ... @@ -646,10 +651,10 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
Widget flatBtn(String tilte, Color color) {
return Container(
height: w(18),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: w(4)),
margin: EdgeInsets.only(left: w(10)),
// height: w(18),
// alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: w(4), vertical: w(0.5)),
// margin: EdgeInsets.only(left: w(10)),
decoration: BoxDecoration(
border: Border.all(color: color, width: w(1)),
borderRadius: BorderRadius.circular(r(5))),
... ... @@ -660,6 +665,108 @@ class _CustomerDetailPageState extends State<CustomerDetailPage> {
);
}
List<Widget> labelsWidget() {
List<Widget> data = [];
if (customerProvider.guestInfoSunModel.guest.attr != null &&
customerProvider.guestInfoSunModel.guest.attr != '') {
data.add(Container(
width: w(30),
height: w(16),
alignment: Alignment.center,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(10),
// vertical: ScreenUtil().setWidth(2),
// ),
decoration: BoxDecoration(
color: customerProvider.guestInfoSunModel.guest.attr != null &&
customerProvider.guestInfoSunModel.guest.attr != ''
? customerProvider.guestInfoSunModel.guest.attr == '沉睡'
? MyColours.color_999999
: customerProvider.guestInfoSunModel.guest.attr == '活跃'
? MyColours.color_00715F
: customerProvider.guestInfoSunModel.guest.attr == '流失'
? MyColours.color_E34D59
: Color.fromRGBO(239, 143, 49, 1)
: Colors.transparent,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10),
),
),
child: Text(customerProvider.guestInfoSunModel.guest.attr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(20)))));
}
if (customerProvider.guestInfoSunModel.guest.label != null) {
List<String> labels =
customerProvider.guestInfoSunModel.guest.label.split(',');
labels.forEach((element) {
data.add(flatBtn(element, MyColours.color_B39437));
});
}
if (customerProvider.guestInfoSunModel.guest.isMember == '1' ||
customerProvider.guestInfoSunModel.guest.isMember == '0') {
data.add(flatBtn(
customerProvider.guestInfoSunModel.guest.isMember == '1'
? '会员'
: '非会员',
MyColours.color_438E93));
}
if ('${customerProvider.guestInfoSunModel.store.storeDay}' != '0') {
data.add(flatBtn(
'存酒${customerProvider.guestInfoSunModel.store.storeDay}天',
MyColours.color_438E93));
}
// data.add(Container(
// width: w(30),
// height: w(16),
// alignment: Alignment.center,
// // padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(10),
// // vertical: ScreenUtil().setWidth(2),
// // ),
// decoration: BoxDecoration(
// color: model.attr != null && model.attr != ''
// ? model.attr == '沉睡'
// ? MyColours.color_999999
// : model.attr == '活跃'
// ? MyColours.color_00715F
// : model.attr == '流失'
// ? MyColours.color_E34D59
// : Color.fromRGBO(239, 143, 49, 1)
// : Colors.transparent,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(10),
// ),
// ),
// child: Text(model.attr == null || model.attr == '' ? '' : model.attr,
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(20)))));}
// if (model.label != null) {
// List<String> labels = model.label.split(',');
// labels.forEach((element) {
// data.add(flatBtn(element, MyColours.color_B39437));
// });
// }
// if (model.isMember == '1' || model.isMember == '0') {
// data.add(flatBtn(
// model.isMember == '1' ? '会员' : '非会员', MyColours.color_438E93));
// }
// if ('${model.storeDay}' != '0' && model.storeDay != null) {
// data.add(flatBtn('存酒${model.storeDay}天', MyColours.color_438E93));
// }
return data;
}
@override
Widget build(BuildContext context) {
customerProvider = Provider.of<CustomerProvider>(context, listen: true);
... ...
... ... @@ -38,6 +38,7 @@ import 'package:one_key/models/table.dart' as t;
import 'package:url_launcher/url_launcher.dart';
import '../models/cookbook_model.dart';
import '../models/customer_label_model.dart';
import '../models/get_reserve_type_field_model.dart';
import '../models/radio_model.dart';
import '../models/seller_template_color_list_model.dart';
... ... @@ -51,6 +52,7 @@ typedef CustomCallBackMap = void Function(Map<String, String> object);
typedef ClickCallback = void Function(String value);
typedef ClickkListCallbac = void Function(List<String> value);
// Example holidays
// final Map<DateTime, List> _holidays = {
// DateTime(2021, 1, 1): ['元旦节'],
... ... @@ -61,6 +63,84 @@ typedef ClickCallback = void Function(String value);
// };
class DialogUtil {
static List<Widget> labelSelectBtn(List<CustomerLabelSunModel> labelList,
state, List<String> datas, ClickkListCallbac callback) {
List<Widget> temp = [];
for (int i = 0; i < labelList.length; i++) {
CustomerLabelSunModel practiceModel = labelList[i];
temp.add(InkWell(
onTap: () {
// for (int j = 0; j < labelList.length; j++) {
// labelList[j].select = false;
// }
// labelList[i].select = true;
labelList[i].select = !labelList[i].select;
if (labelList[i].select) {
datas.add(labelList[i].label);
} else {
datas.remove(labelList[i].label);
}
callback(datas);
state(() {});
},
child: Container(
// height: w(34),
padding:
EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)),
decoration: BoxDecoration(
border: Border.all(
color: practiceModel.select
? MyColours.color_438E93
: MyColours.color_515151,
width: w(1)),
borderRadius: BorderRadius.circular(r(5)),
color: practiceModel.select
? MyColours.color_438E93
: MyColours.color_ffffff,
),
child: Text(practiceModel.label,
style: TextStyle(
fontSize: font(14),
color: practiceModel.select
? MyColours.color_ffffff
: MyColours.color_515151,
)),
))
// RoundButton(
// text: practiceModel.name,
// // bgColor: MyColours.color_ffffff,
// gradientStart: practiceModel.select
// ? MyColours.color_438E93
// : MyColours.color_ffffff,
// gradientEnd: practiceModel.select
// ? MyColours.color_438E93
// : MyColours.color_ffffff,
// // width: w(80),
// padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)),
// height: w(34),
// isBold: false,
// radius: r(5),
// textColor: practiceModel.select
// ? MyColours.color_ffffff
// : MyColours.color_515151,
// borderColor: practiceModel.select
// ? MyColours.color_438E93
// : MyColours.color_515151,
// onPressed: () {
// for (int j = 0; j < menuSunModel.length; j++) {
// menuSunModel[j].select = false;
// }
// menuSunModel[i].select = true;
// callback(menuSunModel[i].name);
// state(() {});
// },
// )
);
}
return temp;
}
static List<Widget> dishSelectBtn(
List<GetReserveTypeFieldsSunModel> menuSunModel,
state,
... ... @@ -135,6 +215,110 @@ class DialogUtil {
return temp;
}
///自定义标签选择
static openLabelSelectModalBottomSheet(
context, List<CustomerLabelSunModel> labelList, String labelShow,
{VoidCallback lCallback, ClickCallback rCallback}) async {
String selectType = labelShow;
List<String> datas = [];
if (selectType != '') {
datas = selectType.split(',');
labelList.forEach((element) {
element.select = false;
if (datas.contains(element.label)) {
element.select = true;
}
});
}
final option = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
isDismissible: false,
isScrollControlled: true,
builder: (BuildContext context) {
return StatefulBuilder(builder: (context, state) {
return Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(10)),
topRight: Radius.circular(ScreenUtil().setWidth(10)))),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pop();
},
child: Container(
// width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
horizontal: w(15),
vertical: ScreenUtil().setWidth(40)),
child: Text(
"取消",
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_438E93),
),
)),
Container(
// width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(40)),
child: Text(
"选择自定义标签",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_E6000000),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pop();
rCallback(selectType);
},
child: Container(
// width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
horizontal: w(15),
vertical: ScreenUtil().setWidth(40)),
child: Text("确定",
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_438E93)),
)),
]),
VEmptyView(50),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(15)),
child: Wrap(
spacing: w(12),
runSpacing: w(12),
children: labelSelectBtn(labelList, state, datas,
(value) {
selectType = value.join(',');
})),
),
VEmptyView(50),
]));
});
});
labelList.forEach((element) {
element.select = false;
});
}
///用餐类型
static openDishTypeSelectModalBottomSheet(context,
List<GetReserveTypeFieldsSunModel> reserveTypes, String reserveType,
... ... @@ -8317,10 +8501,9 @@ class DialogUtil {
color: rColor)),
onPressed: () {
Navigator.of(context).pop();
if(rCallback !=null){
rCallback();
if (rCallback != null) {
rCallback();
}
},
),
],
... ...