|
|
|
import 'package:azlistview/azlistview.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/constant/state.dart';
|
|
|
|
import 'package:one_key/models/customer_by_seller_model.dart';
|
|
|
|
// import 'package:one_key/models/customer_list_model.dart';
|
|
|
|
|
|
|
|
import 'package:one_key/provider/customer_provider.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/route/navigator_util.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
|
|
|
|
class ContactListPage extends StatefulWidget {
|
|
|
|
final List<CustomerBySellerSunModel> contacts;
|
|
|
|
final CustomerProvider provider;
|
|
|
|
final FromPage fromPage;
|
|
|
|
|
|
|
|
const ContactListPage({Key key, this.contacts, this.provider, this.fromPage})
|
|
|
|
: super(key: key);
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return new _ContactListPageState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ContactListPageState extends State<ContactListPage> {
|
|
|
|
// List<contan> _contacts = [];
|
|
|
|
double susItemHeight = ScreenUtil().setWidth(10);
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
widget.provider.handleList(widget.contacts);
|
|
|
|
}
|
|
|
|
|
|
|
|
// void loadData() async {
|
|
|
|
// //加载联系人列表
|
|
|
|
// rootBundle.loadString('assets/data/contacts.json').then((value) {
|
|
|
|
// List list = json.decode(value);
|
|
|
|
// list.forEach((v) {
|
|
|
|
// _contacts.add(ContactInfo.fromJson(v));
|
|
|
|
// });
|
|
|
|
// _handleList(_contacts);
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
|
|
|
|
// Widget _buildHeader() {
|
|
|
|
// return Container(
|
|
|
|
// padding: EdgeInsets.all(20),
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
// children: <Widget>[
|
|
|
|
// ClipOval(
|
|
|
|
// child: Image.asset(
|
|
|
|
// "./assets/images/avatar.png",
|
|
|
|
// width: 80.0,
|
|
|
|
// )),
|
|
|
|
// Padding(
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
// child: Text(
|
|
|
|
// "远行",
|
|
|
|
// textScaleFactor: 1.2,
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// Text("+86 182-286-44678"),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
|
|
|
|
Widget _buildSusWidget(String susTag) {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(20),
|
|
|
|
vertical: ScreenUtil().setWidth(10)),
|
|
|
|
// height: susItemHeight,
|
|
|
|
// margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(20)),
|
|
|
|
width: double.infinity,
|
|
|
|
color: Color.fromRGBO(239, 239, 239, 1),
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
child: Text(
|
|
|
|
'$susTag',
|
|
|
|
style: TextStyle(fontSize: ScreenUtil().setWidth(28)),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _buildListItem(CustomerBySellerSunModel model, int index) {
|
|
|
|
String susTag = model.getSuspensionTag();
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
children: <Widget>[
|
|
|
|
Offstage(
|
|
|
|
offstage: model.isShowSuspension != true,
|
|
|
|
child: _buildSusWidget(susTag),
|
|
|
|
),
|
|
|
|
model.isShowSuspension ? VEmptyView(20) : SizedBox(),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(30),
|
|
|
|
right: ScreenUtil().setWidth(30),
|
|
|
|
bottom: ScreenUtil().setWidth(30),
|
|
|
|
top: model.isShowSuspension ? 0 : ScreenUtil().setWidth(30)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
color: Color.fromRGBO(244, 244, 244, 1),
|
|
|
|
width: ScreenUtil().setWidth(2)))),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
List<CustomerBySellerSunModel> data =
|
|
|
|
widget.provider.customerBySellerList;
|
|
|
|
data[index].select = !data[index].select;
|
|
|
|
if (data[index].select) {
|
|
|
|
widget.provider.addData(index);
|
|
|
|
} else {
|
|
|
|
widget.provider.cancelData(index);
|
|
|
|
}
|
|
|
|
widget.provider.getCheckValue();
|
|
|
|
},
|
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
clipBehavior: Clip.none,
|
|
|
|
children: [
|
|
|
|
Stack(
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
clipBehavior: Clip.none,
|
|
|
|
children: [
|
|
|
|
CircleAvatar(
|
|
|
|
radius: ScreenUtil().setWidth(60),
|
|
|
|
backgroundColor: Color.fromRGBO(239, 239, 239, 1),
|
|
|
|
child: Text(
|
|
|
|
model.rnameStr != ''
|
|
|
|
? model.rnameStr.substring(0, 1)
|
|
|
|
: '',
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromRGBO(206, 206, 206, 1),
|
|
|
|
fontSize: ScreenUtil().setSp(42)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
left: ScreenUtil().setWidth(-18),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
model.select ? 'select' : 'unselect'),
|
|
|
|
width: ScreenUtil().setWidth(36),
|
|
|
|
))
|
|
|
|
]),
|
|
|
|
Positioned(
|
|
|
|
bottom: ScreenUtil().setWidth(-20),
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(10),
|
|
|
|
vertical: ScreenUtil().setWidth(2),
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: model.attr != null && model.attr != ''
|
|
|
|
? model.attr == '沉睡'
|
|
|
|
? Color.fromRGBO(223, 33, 81, 1)
|
|
|
|
: model.attr == '活跃'
|
|
|
|
? Color.fromRGBO(81, 170, 94, 1)
|
|
|
|
: model.attr == '流失'
|
|
|
|
? Color.fromRGBO(
|
|
|
|
109, 101, 248, 1)
|
|
|
|
: 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(28)))))
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
model.rnameStr != null && model.rnameStr != ''
|
|
|
|
? Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
maxWidth: ScreenUtil().setWidth(200)),
|
|
|
|
child: Text(
|
|
|
|
model.rnameStr,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(36),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
)),
|
|
|
|
HEmptyView(10),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(4)),
|
|
|
|
child: Text(
|
|
|
|
model.sexStr != ''
|
|
|
|
? '[${model.sexStr}]'
|
|
|
|
: '',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(22),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
HEmptyView(10),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
// model.label != null
|
|
|
|
// ? Container(
|
|
|
|
// padding: EdgeInsets.only(
|
|
|
|
// bottom: ScreenUtil().setWidth(4)),
|
|
|
|
// constraints: BoxConstraints(
|
|
|
|
// maxWidth: ScreenUtil().setWidth(150)),
|
|
|
|
// child: Text(
|
|
|
|
// model.label,
|
|
|
|
// overflow: TextOverflow.ellipsis,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: Color.fromRGBO(193, 194, 63, 1),
|
|
|
|
// fontSize: ScreenUtil().setSp(22),
|
|
|
|
// ),
|
|
|
|
// ))
|
|
|
|
// : SizedBox()
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(10),
|
|
|
|
Row(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Utils.formatFromYmd(model.ddate),
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromRGBO(208, 31, 37, 1),
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
HEmptyView(10),
|
|
|
|
Text(
|
|
|
|
model.ddateSolt != null ? model.ddateSolt : '',
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromRGBO(208, 31, 37, 1),
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
model.monthCount == '0' || model.monthCount == null
|
|
|
|
? SizedBox()
|
|
|
|
: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(10)),
|
|
|
|
child: Text(
|
|
|
|
'30天内${model.monthCount}单',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(10),
|
|
|
|
Text(
|
|
|
|
'累计${model.leiji}单',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
model.nickName == null
|
|
|
|
? SizedBox()
|
|
|
|
: Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(12),
|
|
|
|
right: ScreenUtil().setWidth(12),
|
|
|
|
top: ScreenUtil().setWidth(10),
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(10))),
|
|
|
|
child: Text(
|
|
|
|
'${model.nickName}经理',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(24),
|
|
|
|
color: MyColours.color_333333),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
// ListTile(
|
|
|
|
// leading: ,
|
|
|
|
// title: Text(model.rname),
|
|
|
|
// onTap: () {
|
|
|
|
// print("OnItemClick: $model");
|
|
|
|
// Navigator.pop(context, model);
|
|
|
|
// },
|
|
|
|
// )
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Decoration getIndexBarDecoration(Color color) {
|
|
|
|
return BoxDecoration(
|
|
|
|
color: color,
|
|
|
|
borderRadius: BorderRadius.circular(20.0),
|
|
|
|
border: Border.all(color: color, width: .5));
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return AzListView(
|
|
|
|
data: widget.contacts,
|
|
|
|
itemCount: widget.contacts.length,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
// if (index == 0) return _buildHeader();
|
|
|
|
CustomerBySellerSunModel model = widget.contacts[index];
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
NavigatorUtil.goCustomerDetailPage(context, model, widget.fromPage);
|
|
|
|
},
|
|
|
|
child: _buildListItem(model, index),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
indexBarData: SuspensionUtil.getTagIndexList(widget.contacts),
|
|
|
|
indexHintBuilder: (context, hint) {
|
|
|
|
return Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: ScreenUtil().setWidth(120),
|
|
|
|
height: ScreenUtil().setWidth(120),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color.fromRGBO(239, 239, 239, 1),
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
),
|
|
|
|
child:
|
|
|
|
Text(hint, style: TextStyle(color: Colors.white, fontSize: 30.0)),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
indexBarMargin: EdgeInsets.all(10),
|
|
|
|
indexBarOptions: IndexBarOptions(
|
|
|
|
needRebuild: true,
|
|
|
|
textStyle: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(24), color: MyColours.color_199095),
|
|
|
|
decoration: getIndexBarDecoration(Colors.transparent),
|
|
|
|
downDecoration: getIndexBarDecoration(Colors.transparent),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|