Commit 8e12166e931352e8eab9e4e8d08d7757df6dc323

Authored by wdn127929
1 parent f95f9874

ff

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/user_history_entity.dart';
import 'package:one_key/provider/customer_provider.dart';
import 'package:one_key/provider/contant_show_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
... ... @@ -9,7 +9,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
class ContantItemPage extends StatefulWidget {
final int index;
final CustomerProvider model;
final ContantShowModel model;
final GestureTapCallback onTap;
final List<UserHistoryEntity> data;
ContantItemPage({Key key, this.index, this.model, this.onTap, this.data})
... ... @@ -193,13 +193,13 @@ class _ContantItemPageState extends State<ContantItemPage> {
return InkWell(
onTap: widget.onTap,
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
// widget.index == 0
// ? MyDivider(
// double.infinity,
// ScreenUtil().setWidth(20),
// color: MyColours.color_f5f5f5,
// )
// : SizedBox(),
widget.index == 0
? MyDivider(
double.infinity,
ScreenUtil().setWidth(20),
color: MyColours.color_f5f5f5,
)
: Container(),
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(
... ...
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/screenutil.dart';
// import 'package:one_key/models/user_history_entity.dart';
// import 'package:one_key/provider/customer_provider.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/utils/utils.dart';
// import 'package:one_key/widgets/MyDivider.dart';
// import 'package:one_key/widgets/v_empty_view.dart';
// class ContantItemPage extends StatefulWidget {
// final int index;
// final CustomerProvider model;
// final GestureTapCallback onTap;
// final List<UserHistoryEntity> data;
// ContantItemPage({Key key, this.index, this.model, this.onTap, this.data})
// : super(key: key);
// @override
// _ContantItemPageState createState() => _ContantItemPageState();
// }
// class _ContantItemPageState extends State<ContantItemPage> {
// _getWidget(String title, String key, {fontSize = 32}) {
// return RichText(
// text: TextSpan(
// children: getTextSpanList(title,
// searchContent: key, fontSize: fontSize)));
// }
// ///关键字在前面布局
// _startPlaceWidget(
// String title, String key, UserHistoryEntity userHistoryEntity,
// {fontSize = 32}) {
// String keyTemp = '';
// if (Utils.isChinese(key)) {
// keyTemp = key;
// } else {
// String name =
// userHistoryEntity.rname == null || userHistoryEntity.rname == ''
// ? ''
// : userHistoryEntity.rname;
// String pinyinFirst = userHistoryEntity.pinyinFirst;
// List<String> pinyinList = userHistoryEntity.pinyinList;
// String pinyin = userHistoryEntity.pinyin;
// // if (pinyinList.indexOf(key) != -1) {
// // //全拼音检索一个字
// // keyTemp = name.substring(
// // pinyinList.indexOf(key), pinyinList.indexOf(key) + 1);
// // } else
// if (pinyinFirst.contains(key)) {
// keyTemp = name.substring(
// pinyinFirst.indexOf(key), pinyinFirst.indexOf(key) + key.length);
// } else if (pinyin.indexOf(key) != -1) {
// if (pinyinList.indexOf(key) != -1) {
// //全拼音检索 lilao
// keyTemp = name.substring(0, pinyinList.indexOf(key) + 1);
// } else if (pinyinFirst.contains(key)) {
// keyTemp = name.substring(
// pinyinFirst.indexOf(key), pinyinFirst.indexOf(key) + key.length);
// }
// }
// print(keyTemp);
// }
// return _getWidget(title, keyTemp, fontSize: fontSize);
// }
// List<TextSpan> getTextSpanList(String textContent,
// {String searchContent = '',
// String frontContent = '',
// int fontSize = 32,
// Color fontColor = MyColours.color_333333,
// Color selectFontColor = MyColours.color_199095}) {
// List<TextSpan> textSpanList = [];
// if (frontContent.isEmpty == false) {
// textSpanList.add(TextSpan(
// text: frontContent,
// style: TextStyle(
// fontSize: ScreenUtil().setSp(fontSize), color: fontColor)));
// }
// ///搜索内容不为空并且 显示内容中存在与搜索内容相同的文字
// if (searchContent != null &&
// searchContent.isEmpty == false &&
// textContent.contains(searchContent)) {
// List<Map> _strMapList = [];
// bool _isContains = true;
// while (_isContains) {
// int startIndex = textContent.indexOf(searchContent);
// String showStr = textContent.substring(
// startIndex, startIndex + searchContent.length);
// Map _strMap;
// if (startIndex > 0) {
// String normalStr = textContent.substring(0, startIndex);
// _strMap = Map();
// _strMap['content'] = normalStr;
// _strMap['isHighlight'] = false;
// _strMapList.add(_strMap);
// }
// _strMap = Map();
// _strMap['content'] = showStr;
// _strMap['isHighlight'] = true;
// _strMapList.add(_strMap);
// textContent = textContent.substring(
// startIndex + searchContent.length, textContent.length);
// _isContains = textContent.contains(searchContent);
// if (!_isContains && textContent != '') {
// _strMap = Map();
// _strMap['content'] = textContent;
// _strMap['isHighlight'] = false;
// _strMapList.add(_strMap);
// }
// }
// _strMapList.forEach((map) {
// textSpanList.add(TextSpan(
// text: map['content'],
// style: TextStyle(
// fontSize: ScreenUtil().setSp(fontSize),
// color: map['isHighlight'] ? selectFontColor : fontColor)));
// });
// } else {
// ///正常显示所有文字
// textSpanList.add(TextSpan(
// text: textContent,
// style:
// TextStyle(fontSize: ScreenUtil().setSp(fontSize), color: fontColor),
// ));
// }
// return textSpanList;
// }
// ///姓名widget
// Widget _getNameWidget(UserHistoryEntity userHistoryEntity) {
// String name =
// userHistoryEntity.rname == null || userHistoryEntity.rname == ''
// ? ''
// : userHistoryEntity.rname;
// String key = widget.model.controller.text;
// String pinyinFirst = userHistoryEntity.pinyinFirst;
// List<String> pinyinList = userHistoryEntity.pinyinList;
// if (key == '') {
// return Text(name,
// style: TextStyle(
// color: MyColours.color_333333, fontSize: ScreenUtil().setSp(32)));
// } else {
// return (name.contains(key) && name.length != key.length) ||
// (pinyinFirst.contains(key) && pinyinFirst.length != key.length) ||
// (pinyinList.contains(key) && pinyinList.length != key.length)
// ? _startPlaceWidget(name, key, userHistoryEntity)
// : Text(name,
// style: TextStyle(
// color: ((name.contains(key) && name.length == key.length) ||
// (pinyinFirst.contains(key) &&
// pinyinFirst.length == key.length) ||
// (pinyinList.contains(key) &&
// pinyinList.length == key.length))
// ? MyColours.color_199095
// : MyColours.color_333333,
// fontSize: ScreenUtil().setSp(32)));
// }
// }
// ///电话widget
// Widget _getPhoneWidget(UserHistoryEntity userHistoryEntity) {
// String phone =
// userHistoryEntity.phone == null || userHistoryEntity.phone == ''
// ? ''
// : userHistoryEntity.phone;
// String key = widget.model.controller.text;
// if (key == '') {
// return Text(phone,
// style: TextStyle(
// color: MyColours.color_333333, fontSize: ScreenUtil().setSp(32)));
// } else {
// return (phone.contains(key) && phone.length != key.length)
// ? _getWidget(phone, key, fontSize: 30)
// : Text(phone,
// style: TextStyle(
// color: phone.contains(key) && phone.length == key.length
// ? MyColours.color_199095
// : MyColours.color_333333,
// fontSize: ScreenUtil().setSp(30)));
// }
// }
// @override
// Widget build(BuildContext context) {
// return InkWell(
// onTap: widget.onTap,
// child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
// // widget.index == 0
// // ? MyDivider(
// // double.infinity,
// // ScreenUtil().setWidth(20),
// // color: MyColours.color_f5f5f5,
// // )
// // : SizedBox(),
// Container(
// width: double.infinity,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// vertical: ScreenUtil().setWidth(30)),
// // height: ScreenUtil().setWidth(76 * 2),
// decoration: BoxDecoration(
// border: Border(
// top: widget.index == 0
// ? BorderSide(
// width: ScreenUtil().setWidth(2),
// color: MyColours.color_E0E0E0)
// : BorderSide(width: 0, color: Colors.transparent),
// bottom: BorderSide(
// width: ScreenUtil().setWidth(2),
// color: MyColours.color_E0E0E0))),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// _getNameWidget(widget.data[widget.index]),
// VEmptyView(10),
// _getPhoneWidget(widget.data[widget.index])
// ],
// ),
// )
// ]));
// }
// }
... ...
// import 'package:flutter/material.dart';
// import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
// import 'package:one_key/constant/state.dart';
import 'package:one_key/constant/state.dart';
// import 'package:one_key/pages/my/contant_item_page.dart';
// import 'package:one_key/provider/contant_show_model.dart';
// import 'package:one_key/provider/user_model.dart';
// import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/pages/my/contant_item_page.dart';
import 'package:one_key/provider/contant_show_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/dialog_util.dart';
// import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/page_exception.dart';
// import 'package:provider/provider.dart';
import 'package:provider/provider.dart';
// class ContantLeftPage extends StatefulWidget {
// ContantLeftPage({Key key}) : super(key: key);
class ContantLeftPage extends StatefulWidget {
ContantLeftPage({Key key}) : super(key: key);
// @override
// _ContantLeftPageState createState() => _ContantLeftPageState();
// }
@override
_ContantLeftPageState createState() => _ContantLeftPageState();
}
// class _ContantLeftPageState extends State<ContantLeftPage> {
// EasyRefreshController _controller;
// ContantShowModel contantShowModel;
class _ContantLeftPageState extends State<ContantLeftPage> {
EasyRefreshController _controller;
ContantShowModel contantShowModel;
// @override
// void initState() {
// super.initState();
// _controller = EasyRefreshController();
@override
void initState() {
super.initState();
_controller = EasyRefreshController();
// WidgetsBinding.instance.addPostFrameCallback((_) {
// _getContantData();
// });
// }
WidgetsBinding.instance.addPostFrameCallback((_) {
_getContantData();
});
}
// _getContantData() async {
// Map<String, String> params = {
// "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
// };
// await contantShowModel.getUserHistorys(context, params);
// await contantShowModel.searchData(contantShowModel.controller.text);
// }
_getContantData() async {
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
};
await contantShowModel.getUserHistorys(context, params);
await contantShowModel.searchData(contantShowModel.controller.text);
}
// @override
// Widget build(BuildContext context) {
// contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
// return Consumer<ContantShowModel>(
// builder: (context, model, _) {
// if (model.pageStateLeft != PageState.Success) {
// return ExceptionPage(
// pageState: model.pageStateLeft,
// callback: () {
// model.pageStateLeft = PageState.Loading;
// model.notifyListeners();
// _getContantData();
// },
// emptyMsg: "暂时没有联系人哦",
// emptyImg: "empty_search",
// showMsg: "加载中,请稍后...",
// );
// } else {
// return ListView.builder(
// itemCount: model.userHistorysShow.length,
// itemBuilder: (BuildContext context, int index) {
// String phone = model.userHistorysShow[index].phone == null ||
// model.userHistorysShow[index].phone == ''
// ? ''
// : model.userHistorysShow[index].phone;
// return ContantItemPage(
// onTap: () {
// if (model.userHistorysShow[index].phone != null &&
// model.userHistorysShow[index].phone != '') {
// DialogUtil.goPhone(model.userHistorysShow[index].phone);
// }
// },
// index: index,
// model: contantShowModel,
// data: model.userHistorysShow,
// );
// });
// }
// },
// );
// }
// }
@override
Widget build(BuildContext context) {
contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
return Consumer<ContantShowModel>(
builder: (context, model, _) {
if (model.pageStateLeft != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateLeft,
callback: () {
model.pageStateLeft = PageState.Loading;
model.notifyListeners();
_getContantData();
},
emptyMsg: "暂时没有联系人哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return ListView.builder(
itemCount: model.userHistorysShow.length,
itemBuilder: (BuildContext context, int index) {
String phone = model.userHistorysShow[index].phone == null ||
model.userHistorysShow[index].phone == ''
? ''
: model.userHistorysShow[index].phone;
return ContantItemPage(
onTap: () {
if (model.userHistorysShow[index].phone != null &&
model.userHistorysShow[index].phone != '') {
DialogUtil.goPhone(model.userHistorysShow[index].phone);
}
},
index: index,
model: contantShowModel,
data: model.userHistorysShow,
);
});
}
},
);
}
}
... ...
// import 'package:flutter/material.dart';
import 'package:flutter/material.dart';
// import 'package:contacts_service/contacts_service.dart';
// import 'package:flutter_screenutil/screenutil.dart';
import 'package:contacts_service/contacts_service.dart';
import 'package:flutter_screenutil/screenutil.dart';
// import 'package:one_key/pages/my/contant_left_page.dart';
// import 'package:one_key/pages/my/contant_right_page.dart';
// import 'package:one_key/provider/contant_show_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/utils/event_bus.dart';
// import 'package:one_key/utils/utils.dart';
import 'package:one_key/pages/my/contant_left_page.dart';
import 'package:one_key/pages/my/contant_right_page.dart';
import 'package:one_key/provider/contant_show_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
// import 'package:one_key/widgets/custom_tab_indicator.dart';
// import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/custom_tab_indicator.dart';
import 'package:one_key/widgets/system_app_bar.dart';
// import 'package:provider/provider.dart';
import 'package:provider/provider.dart';
// class ContactListPage extends StatefulWidget {
// @override
// _ContactListPageState createState() => _ContactListPageState();
// }
class ContactListPage extends StatefulWidget {
@override
_ContactListPageState createState() => _ContactListPageState();
}
// class _ContactListPageState extends State<ContactListPage>
// with TickerProviderStateMixin {
// List<Contact> _contacts;
// List _tabBarTitle;
// TabController tabController;
class _ContactListPageState extends State<ContactListPage>
with TickerProviderStateMixin {
List<Contact> _contacts;
List _tabBarTitle;
TabController tabController;
// ContantShowModel contantShowModel;
// @override
// void initState() {
// _tabBarTitle = ['预订联系人', '手机联系人'];
// super.initState();
// tabController = TabController(length: 2, vsync: this);
// }
ContantShowModel contantShowModel;
@override
void initState() {
_tabBarTitle = ['预订联系人', '手机联系人'];
super.initState();
tabController = TabController(length: 2, vsync: this);
}
// @override
// Widget build(BuildContext context) {
// contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
// return Material(
// child: InkWell(
// onTap: () {
// // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Scaffold(
// resizeToAvoidBottomInset: false,
// backgroundColor: MyColours.color_ffffff,
// appBar: SystemAppBar(
// '联系人',
// onTap: () {
// EventBus().emit('changeStatusColor');
// Navigator.of(context).pop();
// },
// ),
// body: WillPopScope(
// child: SafeArea(
// child: Column(
// children: <Widget>[
// Container(
// // color: Colors.red,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// vertical: ScreenUtil().setWidth(10)),
// height: ScreenUtil().setWidth(45 * 2),
// // alignment: Alignment.center,
// child: Stack(
// children: [
// Container(
// alignment: Alignment.center,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(20 * 2),
// vertical: ScreenUtil().setWidth(14)),
// decoration: BoxDecoration(
// color: MyColours.color_F0F0F0,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(24 * 2))),
// child: TextField(
// maxLines: 1,
// controller: contantShowModel.controller,
// // focusNode: _focusNode,
// // autofocus: true,
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(30)),
// // textAlignVertical: TextAlignVertical.center,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(
// right: ScreenUtil().setWidth(40 * 2)),
// hintText: "搜索联系人",
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(30),
// ),
// isCollapsed:
// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// // 左边图标设置
// icon: Image.asset(
// Utils.getImgPath('search'),
// width: ScreenUtil().setWidth(30),
// ),
// //右边图标设置
// // suffixIcon:
// ),
// keyboardType: TextInputType.text,
// textInputAction: TextInputAction.done,
@override
Widget build(BuildContext context) {
contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
return Material(
child: InkWell(
onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'联系人',
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
),
body: WillPopScope(
child: SafeArea(
child: Column(
children: <Widget>[
Container(
// color: Colors.red,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(10)),
height: ScreenUtil().setWidth(45 * 2),
// alignment: Alignment.center,
child: Stack(
children: [
Container(
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20 * 2),
vertical: ScreenUtil().setWidth(14)),
decoration: BoxDecoration(
color: MyColours.color_F0F0F0,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(24 * 2))),
child: TextField(
maxLines: 1,
controller: contantShowModel.controller,
// focusNode: _focusNode,
// autofocus: true,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(30)),
// textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
right: ScreenUtil().setWidth(40 * 2)),
hintText: "搜索联系人",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(30),
),
isCollapsed:
true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
border: OutlineInputBorder(
borderSide: BorderSide.none),
// 左边图标设置
icon: Image.asset(
Utils.getImgPath('search'),
width: ScreenUtil().setWidth(30),
),
//右边图标设置
// suffixIcon:
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.done,
// onChanged: (value) {
// // setState(() {});
// // _searchSellerLocation();
// contantShowModel.searchData(value);
// },
// onEditingComplete: () {
// FocusScope.of(context).requestFocus(
// FocusNode()); //点击空白处隐藏键盘
// // contantShowModel.searchData(
// // contantShowModel.controller.text);
// // _searchSellerLocation();
// // _focusNode.unfocus();
// },
// ),
// ),
// Positioned(
// right: 0,
// top: 0,
// bottom: 0,
// child: Offstage(
// offstage:
// contantShowModel.controller.text ==
// '',
// child: GestureDetector(
// child: Container(
// padding: EdgeInsets.only(
// right: ScreenUtil()
// .setWidth(20 * 2)),
// // color: Colors.orange,
// height:
// ScreenUtil().setWidth(45 * 2),
// width:
// ScreenUtil().setWidth(100 * 2),
// alignment: Alignment.centerRight,
// child: Image.asset(
// Utils.getImgPath('clear'),
// width: ScreenUtil().setWidth(30),
// height: ScreenUtil().setWidth(30),
// ),
// ),
// onTap: () {
// WidgetsBinding.instance
// .addPostFrameCallback(((_) {
// contantShowModel.controller
// .clear();
// contantShowModel.searchData('');
// }));
// },
// )))
// ],
// )),
// Container(
// padding: EdgeInsets.only(
// bottom: ScreenUtil().setWidth(10)),
// margin: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(30)),
// child: TabBar(
// controller: tabController,
// indicator: CustomTabIndicator(
// radius: 0,
// ),
// indicatorColor: MyColours.color_199095,
// indicatorSize: TabBarIndicatorSize.tab,
// // indicatorPadding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(12)),
// labelColor: MyColours.color_199095,
// labelStyle: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// fontWeight: FontWeight.bold),
// labelPadding: EdgeInsets.zero,
// unselectedLabelStyle:
// TextStyle(fontWeight: FontWeight.normal),
// unselectedLabelColor: MyColours.color_999999,
// tabs: _tabBarTitle.map((value) {
// return Tab(
// child: Text(value),
// );
// }).toList()),
// ),
// Expanded(
// child: TabBarView(
// controller: tabController,
// // physics: NeverScrollableScrollPhysics(),
// children: <Widget>[
// ContantLeftPage(),
// ContantRightPage(),
// ],
// )),
// ],
// )),
// onWillPop: () async {
// EventBus().emit('changeStatusColor');
// return true;
// }))));
// }
// }
onChanged: (value) {
// setState(() {});
// _searchSellerLocation();
contantShowModel.searchData(value);
},
onEditingComplete: () {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
// contantShowModel.searchData(
// contantShowModel.controller.text);
// _searchSellerLocation();
// _focusNode.unfocus();
},
),
),
Positioned(
right: 0,
top: 0,
bottom: 0,
child: Offstage(
offstage:
contantShowModel.controller.text ==
'',
child: GestureDetector(
child: Container(
padding: EdgeInsets.only(
right: ScreenUtil()
.setWidth(20 * 2)),
// color: Colors.orange,
height:
ScreenUtil().setWidth(45 * 2),
width:
ScreenUtil().setWidth(100 * 2),
alignment: Alignment.centerRight,
child: Image.asset(
Utils.getImgPath('clear'),
width: ScreenUtil().setWidth(30),
height: ScreenUtil().setWidth(30),
),
),
onTap: () {
WidgetsBinding.instance
.addPostFrameCallback(((_) {
contantShowModel.controller
.clear();
contantShowModel.searchData('');
}));
},
)))
],
)),
Container(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(10)),
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30)),
child: TabBar(
controller: tabController,
indicator: CustomTabIndicator(
radius: 0,
),
indicatorColor: MyColours.color_199095,
indicatorSize: TabBarIndicatorSize.tab,
// indicatorPadding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(12)),
labelColor: MyColours.color_199095,
labelStyle: TextStyle(
fontSize: ScreenUtil().setSp(32),
fontWeight: FontWeight.bold),
labelPadding: EdgeInsets.zero,
unselectedLabelStyle:
TextStyle(fontWeight: FontWeight.normal),
unselectedLabelColor: MyColours.color_999999,
tabs: _tabBarTitle.map((value) {
return Tab(
child: Text(value),
);
}).toList()),
),
Expanded(
child: TabBarView(
controller: tabController,
// physics: NeverScrollableScrollPhysics(),
children: <Widget>[
ContantLeftPage(),
ContantRightPage(),
],
)),
],
)),
onWillPop: () async {
EventBus().emit('changeStatusColor');
return true;
}))));
}
}
... ...
// import 'package:flutter/material.dart';
import 'package:flutter/material.dart';
// import 'package:lpinyin/lpinyin.dart';
// import 'package:one_key/constant/state.dart';
// import 'package:one_key/models/user_history_entity.dart';
// import 'package:one_key/pages/my/contant_item_page.dart';
// import 'package:one_key/provider/contant_show_model.dart';
import 'package:lpinyin/lpinyin.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/user_history_entity.dart';
import 'package:one_key/pages/my/contant_item_page.dart';
import 'package:one_key/provider/contant_show_model.dart';
// import 'package:one_key/utils/dialog_util.dart';
// import 'package:one_key/utils/misc.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/misc.dart';
// import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/page_exception.dart';
// import 'package:contacts_service/contacts_service.dart';
// import 'package:permission_handler/permission_handler.dart';
// import 'package:provider/provider.dart';
import 'package:contacts_service/contacts_service.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
// class ContantRightPage extends StatefulWidget {
// ContantRightPage({Key key}) : super(key: key);
class ContantRightPage extends StatefulWidget {
ContantRightPage({Key key}) : super(key: key);
// @override
// _ContantRightPageState createState() => _ContantRightPageState();
// }
@override
_ContantRightPageState createState() => _ContantRightPageState();
}
// class _ContantRightPageState extends State<ContantRightPage> {
// List<Contact> _contacts;
// bool isNeed = false;
// bool goSetting = false;
// bool userNo = false;
// ContantShowModel contantShowModel;
// @override
// void initState() {
// super.initState();
// WidgetsBinding.instance.addPostFrameCallback((_) {
// _openAddressBook();
// });
// }
class _ContantRightPageState extends State<ContantRightPage> {
List<Contact> _contacts;
bool isNeed = false;
bool goSetting = false;
bool userNo = false;
ContantShowModel contantShowModel;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
_openAddressBook();
});
}
// _openAddressBook() async {
// if (!(await checkContactPermission())) {
// PermissionStatus permissionStatus = await contactPermissionStatus();
// if (permissionStatus == PermissionStatus.permanentlyDenied) {
// //用户选择不在弹出权限提示框
// print('never');
// userNo = true;
// setState(() {
// contantShowModel.pageStateRight = PageState.NoPermission;
// });
// // DialogUtil.openAlertDialog(
// // context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0,
// // onTap: () {
// // goSetting = true;
// // openSetting();
// // Navigator.pop(context, '');
// // });
// } else {
// // 申请权限
// bool canContacts = await requestContactPermission();
// if (canContacts) {
// refreshContacts();
// } else {
// setState(() {
// contantShowModel.pageStateRight = PageState.NoPermission;
// });
// //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
// // DialogUtil.openAlertDialog(
// // context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0,
// // onTap: () {
// // goSetting = true;
// // openSetting();
// // Navigator.pop(context, '');
// // });
// }
// }
// } else {
// refreshContacts();
// }
// }
_openAddressBook() async {
if (!(await checkContactPermission())) {
PermissionStatus permissionStatus = await contactPermissionStatus();
if (permissionStatus == PermissionStatus.permanentlyDenied) {
//用户选择不在弹出权限提示框
print('never');
userNo = true;
setState(() {
contantShowModel.pageStateRight = PageState.NoPermission;
});
// DialogUtil.openAlertDialog(
// context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0,
// onTap: () {
// goSetting = true;
// openSetting();
// Navigator.pop(context, '');
// });
} else {
// 申请权限
bool canContacts = await requestContactPermission();
if (canContacts) {
refreshContacts();
} else {
setState(() {
contantShowModel.pageStateRight = PageState.NoPermission;
});
//拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
// DialogUtil.openAlertDialog(
// context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0,
// onTap: () {
// goSetting = true;
// openSetting();
// Navigator.pop(context, '');
// });
}
}
} else {
refreshContacts();
}
}
// Future<void> refreshContacts() async {
// List<Contact> contacts = (await ContactsService.getContacts(
// withThumbnails: false, iOSLocalizedLabels: false))
// .toList();
Future<void> refreshContacts() async {
List<Contact> contacts = (await ContactsService.getContacts(
withThumbnails: false, iOSLocalizedLabels: false))
.toList();
// setState(() {
// _contacts = contacts;
// if (_contacts.length > 0) {
// contantShowModel.contacts = [];
// for (int i = 0; i < _contacts.length; i++) {
// UserHistoryEntity item = UserHistoryEntity(
// '',
// '',
// _contacts[i].displayName == null ? '' : _contacts[i].displayName,
// '',
// _contacts[i].phones == null
// ? ''
// : _contacts[i].phones.first.value.replaceAll(' ', ''),
// '');
// item.pinyin = _contacts[i].displayName == null
// ? ''
// : PinyinHelper.getPinyin(_contacts[i].displayName)
// .replaceAll(' ', '');
// List<String> pinyinList = _contacts[i].displayName == null
// ? []
// : PinyinHelper.getPinyin(_contacts[i].displayName).split(' ');
// item.pinyinFirst = '';
// item.pinyinList = [];
// String pinyinAll = ''; //组装全拼组合
// for (int j = 0; j < pinyinList.length; j++) {
// String letter = pinyinList[j];
// pinyinAll += pinyinList[j];
// item.pinyinList.add(pinyinAll);
// if (letter.length > 0) {
// item.pinyinFirst += pinyinList[j].substring(0, 1);
// } else {
// item.pinyinFirst += '';
// }
// }
// contantShowModel.contacts.add(item);
// }
// contantShowModel.contactsShow = contantShowModel.contacts;
// contantShowModel.pageStateRight = PageState.Success;
// } else {
// contantShowModel.pageStateRight = PageState.Empty;
// }
// });
// await contantShowModel.searchData(contantShowModel.controller.text);
// }
setState(() {
_contacts = contacts;
if (_contacts.length > 0) {
contantShowModel.contacts = [];
for (int i = 0; i < _contacts.length; i++) {
UserHistoryEntity item = UserHistoryEntity(
'',
'',
_contacts[i].displayName == null ? '' : _contacts[i].displayName,
'',
_contacts[i].phones == null
? ''
: _contacts[i].phones.first.value.replaceAll(' ', ''),
'');
item.pinyin = _contacts[i].displayName == null
? ''
: PinyinHelper.getPinyin(_contacts[i].displayName)
.replaceAll(' ', '');
List<String> pinyinList = _contacts[i].displayName == null
? []
: PinyinHelper.getPinyin(_contacts[i].displayName).split(' ');
item.pinyinFirst = '';
item.pinyinList = [];
String pinyinAll = ''; //组装全拼组合
for (int j = 0; j < pinyinList.length; j++) {
String letter = pinyinList[j];
pinyinAll += pinyinList[j];
item.pinyinList.add(pinyinAll);
if (letter.length > 0) {
item.pinyinFirst += pinyinList[j].substring(0, 1);
} else {
item.pinyinFirst += '';
}
}
contantShowModel.contacts.add(item);
}
contantShowModel.contactsShow = contantShowModel.contacts;
contantShowModel.pageStateRight = PageState.Success;
} else {
contantShowModel.pageStateRight = PageState.Empty;
}
});
await contantShowModel.searchData(contantShowModel.controller.text);
}
// @override
// Widget build(BuildContext context) {
// contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
// return Consumer<ContantShowModel>(builder: (context, model, _) {
// if (model.pageStateRight != PageState.Success) {
// return ExceptionPage(
// pageState: model.pageStateRight,
// callback: () async {
// if (await checkContactPermission()) {
// _openAddressBook();
// } else {
// goSetting = true;
// openSetting();
// }
// },
// emptyMsg: "暂时没有联系人哦",
// emptyImg: "empty_search",
// showMsg: "加载中,请稍后...",
// );
// } else {
// return ListView.builder(
// itemCount: contantShowModel.contactsShow?.length ?? 0,
// itemBuilder: (BuildContext context, int index) {
// UserHistoryEntity c = contantShowModel.contactsShow[index];
// return ContantItemPage(
// onTap: () {
// if (c.phone != null && c.phone != '') {
// DialogUtil.goPhone(c.phone);
// }
// },
// index: index,
// model: contantShowModel,
// data: contantShowModel.contactsShow,
// );
// });
// }
// });
// }
// }
@override
Widget build(BuildContext context) {
contantShowModel = Provider.of<ContantShowModel>(context, listen: true);
return Consumer<ContantShowModel>(builder: (context, model, _) {
if (model.pageStateRight != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateRight,
callback: () async {
if (await checkContactPermission()) {
_openAddressBook();
} else {
goSetting = true;
openSetting();
}
},
emptyMsg: "暂时没有联系人哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return ListView.builder(
itemCount: contantShowModel.contactsShow?.length ?? 0,
itemBuilder: (BuildContext context, int index) {
UserHistoryEntity c = contantShowModel.contactsShow[index];
return ContantItemPage(
onTap: () {
if (c.phone != null && c.phone != '') {
DialogUtil.goPhone(c.phone);
}
},
index: index,
model: contantShowModel,
data: contantShowModel.contactsShow,
);
});
}
});
}
}
... ...
import 'package:azlistview/azlistview.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:azlistview/azlistview.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/user_history_entity.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';
// import 'package:one_key/models/user_history_entity.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<UserHistoryEntity> contacts;
final CustomerProvider provider;
// class ContactListPage extends StatefulWidget {
// final List<UserHistoryEntity> contacts;
// final CustomerProvider provider;
const ContactListPage({Key key, this.contacts, this.provider})
: super(key: key);
@override
State<StatefulWidget> createState() {
return new _ContactListPageState();
}
}
// const ContactListPage({Key key, this.contacts, this.provider})
// : super(key: key);
// @override
// State<StatefulWidget> createState() {
// return new _ContactListPageState();
// }
// }
class _ContactListPageState extends State<ContactListPage> {
// List<contan> _contacts = [];
double susItemHeight = ScreenUtil().setWidth(10);
// class _ContactListPageState extends State<ContactListPage> {
// // List<contan> _contacts = [];
// double susItemHeight = ScreenUtil().setWidth(10);
@override
void initState() {
super.initState();
// loadData();
widget.provider.handleList(widget.contacts);
}
// @override
// void initState() {
// super.initState();
// // loadData();
// 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);
// });
// }
// // 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 _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 _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(UserHistoryEntity model) {
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: [
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('select'),
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: Color.fromRGBO(223, 33, 81, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10),
),
),
child: Text('沉睡',
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28)))))
],
),
HEmptyView(20),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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),
Text(
model.sexStr != '' ? '[${model.sexStr}]' : '',
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(22),
),
),
HEmptyView(10),
Container(
constraints: BoxConstraints(
maxWidth: ScreenUtil().setWidth(150)),
child: Text(
'低频高消费',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color.fromRGBO(193, 194, 63, 1),
fontSize: ScreenUtil().setSp(22),
),
))
],
),
VEmptyView(10),
Row(
// crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'28天前',
style: TextStyle(
color: Color.fromRGBO(208, 31, 37, 1),
fontSize: ScreenUtil().setSp(24),
fontWeight: FontWeight.bold),
),
HEmptyView(10),
Text(
'午餐',
style: TextStyle(
color: Color.fromRGBO(208, 31, 37, 1),
fontSize: ScreenUtil().setSp(24),
),
),
HEmptyView(10),
Text(
'累计80单',
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(24),
),
)
],
),
VEmptyView(10),
Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(12),
),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10))),
child: Text(
'xx经理',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_333333),
),
)
],
))
],
),
)
// ListTile(
// leading: ,
// title: Text(model.rname),
// onTap: () {
// print("OnItemClick: $model");
// Navigator.pop(context, model);
// },
// )
],
);
}
// Widget _buildListItem(UserHistoryEntity model) {
// 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: [
// 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('select'),
// 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: Color.fromRGBO(223, 33, 81, 1),
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(10),
// ),
// ),
// child: Text('沉睡',
// style: TextStyle(
// color: MyColours.color_ffffff,
// fontSize: ScreenUtil().setSp(28)))))
// ],
// ),
// HEmptyView(20),
// Expanded(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// 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),
// Text(
// model.sexStr != '' ? '[${model.sexStr}]' : '',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(22),
// ),
// ),
// HEmptyView(10),
// Container(
// constraints: BoxConstraints(
// maxWidth: ScreenUtil().setWidth(150)),
// child: Text(
// '低频高消费',
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// color: Color.fromRGBO(193, 194, 63, 1),
// fontSize: ScreenUtil().setSp(22),
// ),
// ))
// ],
// ),
// VEmptyView(10),
// Row(
// // crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Text(
// '28天前',
// style: TextStyle(
// color: Color.fromRGBO(208, 31, 37, 1),
// fontSize: ScreenUtil().setSp(24),
// fontWeight: FontWeight.bold),
// ),
// HEmptyView(10),
// Text(
// '午餐',
// style: TextStyle(
// color: Color.fromRGBO(208, 31, 37, 1),
// fontSize: ScreenUtil().setSp(24),
// ),
// ),
// HEmptyView(10),
// Text(
// '累计80单',
// style: TextStyle(
// color: MyColours.color_199095,
// fontSize: ScreenUtil().setSp(24),
// ),
// )
// ],
// ),
// VEmptyView(10),
// Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(12),
// ),
// decoration: BoxDecoration(
// border: Border.all(
// color: MyColours.color_199095,
// width: ScreenUtil().setWidth(2)),
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(10))),
// child: Text(
// 'xx经理',
// 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));
}
// 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();
UserHistoryEntity model = widget.contacts[index];
return InkWell(
onTap: () {
NavigatorUtil.goCustomerDetailPage(context, model);
},
child: _buildListItem(model),
);
},
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),
),
);
}
}
// @override
// Widget build(BuildContext context) {
// return AzListView(
// data: widget.contacts,
// itemCount: widget.contacts.length,
// itemBuilder: (BuildContext context, int index) {
// // if (index == 0) return _buildHeader();
// UserHistoryEntity model = widget.contacts[index];
// return InkWell(
// onTap: () {
// NavigatorUtil.goCustomerDetailPage(context, model);
// },
// child: _buildListItem(model),
// );
// },
// 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),
// ),
// );
// }
// }
... ...
import 'package:flutter/material.dart';
// import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/constant/state.dart';
// import 'package:flutter_screenutil/screenutil.dart';
// import 'package:one_key/constant/state.dart';
import 'package:one_key/pages/my/customer_type/contant_list_page.dart';
// import 'package:one_key/pages/my/customer_type/contant_list_page.dart';
import 'package:one_key/provider/customer_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
// import 'package:one_key/provider/customer_provider.dart';
// import 'package:one_key/provider/user_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/common_button_flat.dart';
// import 'package:one_key/utils/event_bus.dart';
// import 'package:one_key/utils/utils.dart';
// import 'package:one_key/widgets/common_button_flat.dart';
import 'package:one_key/widgets/custom_tab_indicator.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/page_exception.dart';
// import 'package:one_key/widgets/custom_tab_indicator.dart';
// import 'package:one_key/widgets/h_empty_view.dart';
// import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
// import 'package:one_key/widgets/system_app_bar.dart';
// import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
// import 'package:provider/provider.dart';
typedef ClickCallback = void Function(dynamic value);
// typedef ClickCallback = void Function(dynamic value);
class CustomerListPage extends StatefulWidget {
@override
_CustomerListPageState createState() => _CustomerListPageState();
}
// class CustomerListPage extends StatefulWidget {
// @override
// _CustomerListPageState createState() => _CustomerListPageState();
// }
class _CustomerListPageState extends State<CustomerListPage>
with TickerProviderStateMixin {
List _tabBarTitle;
TabController tabController;
// class _CustomerListPageState extends State<CustomerListPage>
// with TickerProviderStateMixin {
// List _tabBarTitle;
// TabController tabController;
CustomerProvider customerProvider;
bool showFilter = false;
ScrollController _scrollCrl = ScrollController();
int dropValue = 0;
bool showDrop = true;
List<String> timeTilte = ['大于', '等于', '小于'];
// CustomerProvider customerProvider;
// bool showFilter = false;
// ScrollController _scrollCrl = ScrollController();
// int dropValue = 0;
// bool showDrop = true;
// List<String> timeTilte = ['大于', '等于', '小于'];
@override
void initState() {
_tabBarTitle = ['全部', '活跃', '沉睡', '流失'];
// timeTilte = ['大于', '等于', '小于'];
super.initState();
tabController = TabController(length: 4, vsync: this);
WidgetsBinding.instance.addPostFrameCallback((_) async {
_getContantData();
});
}
// @override
// void initState() {
// _tabBarTitle = ['全部', '活跃', '沉睡', '流失'];
// // timeTilte = ['大于', '等于', '小于'];
// super.initState();
// tabController = TabController(length: 4, vsync: this);
// WidgetsBinding.instance.addPostFrameCallback((_) async {
// _getContantData();
// });
// }
_getContantData() async {
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
};
await customerProvider.getUserHistorys(context, params);
await customerProvider.searchData(customerProvider.controller.text);
}
// _getContantData() async {
// Map<String, String> params = {
// "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
// };
// await customerProvider.getUserHistorys(context, params);
// await customerProvider.searchData(customerProvider.controller.text);
// }
///选中的联系人widget
Widget _selectContantWidget() {
return Container(
// constraints: BoxConstraints(maxHeight: ScreenUtil().setWidth(760)),
// height: ScreenUtil().setWidth(400),
width: double.infinity,
padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
color: MyColours.color_333333,
blurRadius: ScreenUtil().setWidth(14))
],
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(30)),
topRight: Radius.circular(ScreenUtil().setWidth(30)),
)),
child: Row(
children: [
Image.asset(Utils.getImgPath('select'),
width: ScreenUtil().setWidth(30)),
HEmptyView(10),
Text(
'全选',
style: TextStyle(
fontSize: ScreenUtil().setSp(26),
color: MyColours.color_333333),
),
HEmptyView(20),
Expanded(
child: InkWell(
onTap: () {
NavigatorUtil.goMakeMarkingPage(context);
},
child: Container(
alignment: Alignment.center,
padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(40)),
color: MyColours.color_199095),
child: Text(
'已选[全部]10000位顾客,下发营销任务',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_ffffff,
),
)),
)),
// Expanded(
// child: RoundButton(
// // width: ScreenUtil().setWidth(600),
// height: ScreenUtil().setWidth(80),
// radius: ScreenUtil().setWidth(40),
// text: '已选 [全部] 80位顾客,下发营销任务frfrfrfrfrffrfrfr',
// fontSize: 28,
// textColor: MyColours.color_ffffff,
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// onPressed: () {},
// ))
],
),
);
}
// ///选中的联系人widget
// Widget _selectContantWidget() {
// return Container(
// // constraints: BoxConstraints(maxHeight: ScreenUtil().setWidth(760)),
// // height: ScreenUtil().setWidth(400),
// width: double.infinity,
// padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
// decoration: BoxDecoration(
// color: MyColours.color_ffffff,
// boxShadow: [
// BoxShadow(
// color: MyColours.color_333333,
// blurRadius: ScreenUtil().setWidth(14))
// ],
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(ScreenUtil().setWidth(30)),
// topRight: Radius.circular(ScreenUtil().setWidth(30)),
// )),
// child: Row(
// children: [
// Image.asset(Utils.getImgPath('select'),
// width: ScreenUtil().setWidth(30)),
// HEmptyView(10),
// Text(
// '全选',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(26),
// color: MyColours.color_333333),
// ),
// HEmptyView(20),
// Expanded(
// child: InkWell(
// onTap: () {
// NavigatorUtil.goMakeMarkingPage(context);
// },
// child: Container(
// alignment: Alignment.center,
// padding: EdgeInsets.all(ScreenUtil().setWidth(20)),
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(40)),
// color: MyColours.color_199095),
// child: Text(
// '已选[全部]10000位顾客,下发营销任务',
// overflow: TextOverflow.ellipsis,
// maxLines: 1,
// style: TextStyle(
// fontSize: ScreenUtil().setSp(28),
// color: MyColours.color_ffffff,
// ),
// )),
// )),
// // Expanded(
// // child: RoundButton(
// // // width: ScreenUtil().setWidth(600),
// // height: ScreenUtil().setWidth(80),
// // radius: ScreenUtil().setWidth(40),
// // text: '已选 [全部] 80位顾客,下发营销任务frfrfrfrfrffrfrfr',
// // fontSize: 28,
// // textColor: MyColours.color_ffffff,
// // gradientStart: MyColours.color_199095,
// // gradientEnd: MyColours.color_199095,
// // onPressed: () {},
// // ))
// ],
// ),
// );
// }
/// 搜索框
Widget _searchWidget() {
return Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
height: ScreenUtil().setWidth(45 * 2),
// alignment: Alignment.center,
// /// 搜索框
// Widget _searchWidget() {
// return Container(
// color: MyColours.color_ffffff,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// ),
// height: ScreenUtil().setWidth(45 * 2),
// // alignment: Alignment.center,
child: Container(
alignment: Alignment.center,
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(20 * 2),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(24 * 2)),
border: Border.all(color: Color.fromRGBO(228, 228, 228, 1)),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(220, 220, 220, 1), //投影颜色
offset: Offset(2, 3), //x,y轴
blurRadius: ScreenUtil().setWidth(6) //投影距离
)
]),
child: Row(children: [
Expanded(
child: TextField(
maxLines: 1,
controller: customerProvider.controller,
// focusNode: _focusNode,
// autofocus: true,
// child: Container(
// alignment: Alignment.center,
// padding: EdgeInsets.only(
// left: ScreenUtil().setWidth(20 * 2),
// ),
// decoration: BoxDecoration(
// color: MyColours.color_ffffff,
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(24 * 2)),
// border: Border.all(color: Color.fromRGBO(228, 228, 228, 1)),
// boxShadow: [
// BoxShadow(
// color: Color.fromRGBO(220, 220, 220, 1), //投影颜色
// offset: Offset(2, 3), //x,y轴
// blurRadius: ScreenUtil().setWidth(6) //投影距离
// )
// ]),
// child: Row(children: [
// Expanded(
// child: TextField(
// maxLines: 1,
// controller: customerProvider.controller,
// // focusNode: _focusNode,
// // autofocus: true,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(26)),
// textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
hintText: "输入手机号或姓名",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(26),
),
// isCollapsed:
// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
border: OutlineInputBorder(borderSide: BorderSide.none),
contentPadding: EdgeInsets.zero,
// 左边图标设置
icon: Image.asset(
Utils.getImgPath('search'),
width: ScreenUtil().setWidth(30),
),
//右边图标设置
// suffixIcon:
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.done,
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(26)),
// // textAlignVertical: TextAlignVertical.center,
// decoration: InputDecoration(
// hintText: "输入手机号或姓名",
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(26),
// ),
// // isCollapsed:
// // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
// border: OutlineInputBorder(borderSide: BorderSide.none),
// contentPadding: EdgeInsets.zero,
// // 左边图标设置
// icon: Image.asset(
// Utils.getImgPath('search'),
// width: ScreenUtil().setWidth(30),
// ),
// //右边图标设置
// // suffixIcon:
// ),
// keyboardType: TextInputType.text,
// textInputAction: TextInputAction.done,
onChanged: (value) {
// setState(() {});
// _searchSellerLocation();
customerProvider.searchData(value);
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
// contantShowModel.searchData(
// contantShowModel.controller.text);
// _searchSellerLocation();
// _focusNode.unfocus();
},
),
),
Offstage(
offstage: customerProvider.controller.text == '',
child: GestureDetector(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(20),
),
// color: Colors.orange,
alignment: Alignment.centerRight,
child: Image.asset(
Utils.getImgPath('clear'),
width: ScreenUtil().setWidth(30),
height: ScreenUtil().setWidth(30),
),
),
onTap: () {
WidgetsBinding.instance.addPostFrameCallback(((_) {
customerProvider.controller.clear();
customerProvider.searchData('');
}));
},
)),
// Offstage(
// offstage: false,
// child: GestureDetector(
// child: Container(
// padding: EdgeInsets.only(
// right: ScreenUtil().setWidth(30),
// bottom: ScreenUtil().setWidth(20),
// top: ScreenUtil().setWidth(20),
// ),
// child: Text(
// '搜索',
// style: TextStyle(
// color: MyColours.color_199095,
// fontSize: ScreenUtil().setSp(28)),
// ),
// ),
// onTap: () {
// customerProvider.searchData(
// customerProvider.controller.text);
// },
// ))
])));
}
// onChanged: (value) {
// // setState(() {});
// // _searchSellerLocation();
// customerProvider.searchData(value);
// },
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// // contantShowModel.searchData(
// // contantShowModel.controller.text);
// // _searchSellerLocation();
// // _focusNode.unfocus();
// },
// ),
// ),
// Offstage(
// offstage: customerProvider.controller.text == '',
// child: GestureDetector(
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// vertical: ScreenUtil().setWidth(20),
// ),
// // color: Colors.orange,
// alignment: Alignment.centerRight,
// child: Image.asset(
// Utils.getImgPath('clear'),
// width: ScreenUtil().setWidth(30),
// height: ScreenUtil().setWidth(30),
// ),
// ),
// onTap: () {
// WidgetsBinding.instance.addPostFrameCallback(((_) {
// customerProvider.controller.clear();
// customerProvider.searchData('');
// }));
// },
// )),
// // Offstage(
// // offstage: false,
// // child: GestureDetector(
// // child: Container(
// // padding: EdgeInsets.only(
// // right: ScreenUtil().setWidth(30),
// // bottom: ScreenUtil().setWidth(20),
// // top: ScreenUtil().setWidth(20),
// // ),
// // child: Text(
// // '搜索',
// // style: TextStyle(
// // color: MyColours.color_199095,
// // fontSize: ScreenUtil().setSp(28)),
// // ),
// // ),
// // onTap: () {
// // customerProvider.searchData(
// // customerProvider.controller.text);
// // },
// // ))
// ])));
// }
Widget _menuWidget() {
return Container(
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(20)),
decoration: BoxDecoration(color: MyColours.color_ffffff, boxShadow: [
BoxShadow(
// color: Colors.red,
color: Color.fromRGBO(220, 220, 220, 1), //投影颜色
offset: Offset(2, 2), //x,y轴
blurRadius: ScreenUtil().setWidth(6) //投影距离
)
]),
child: Row(
children: [
Expanded(
child: Container(
padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(10)),
margin:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(30)),
child: TabBar(
controller: tabController,
indicator: CustomTabIndicator(
radius: 0,
),
indicatorColor: MyColours.color_199095,
indicatorSize: TabBarIndicatorSize.tab,
// indicatorPadding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(12)),
labelColor: MyColours.color_199095,
labelStyle: TextStyle(
fontSize: ScreenUtil().setSp(32),
fontWeight: FontWeight.bold),
labelPadding: EdgeInsets.zero,
unselectedLabelStyle: TextStyle(
fontWeight: FontWeight.normal,
fontSize: ScreenUtil().setSp(28),
),
unselectedLabelColor: MyColours.color_999999,
tabs: _tabBarTitle.map((value) {
return Tab(
child: Text(value),
);
}).toList()),
)),
InkWell(
onTap: () {
setState(() {
showFilter = !showFilter;
});
if (showFilter) {
_showFilterDialogFromTop(context, onPressedReset: () {
Navigator.of(context).pop();
setState(() {
showFilter = false;
});
}, onPressedComplete: () {
Navigator.of(context).pop();
setState(() {
showFilter = false;
});
}, tapWhiteBack: () {
// Navigator.of(context).pop();
// setState(() {
// showFilter = false;
// });
});
}
},
child: Container(
padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(10)),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(30)),
width: ScreenUtil().setWidth(100),
// height: ScreenUtil().setWidth(50),
child: Row(
children: [
Text(
'筛选',
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_999999),
),
HEmptyView(10),
Image.asset(
Utils.getImgPath(
showFilter ? 'c_arrow_up' : 'c_arrow_down'),
width: ScreenUtil().setWidth(24),
// height: ScreenUtil().setWidth(10),
)
],
)),
)
],
));
}
// Widget _menuWidget() {
// return Container(
// margin: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// vertical: ScreenUtil().setWidth(20)),
// decoration: BoxDecoration(color: MyColours.color_ffffff, boxShadow: [
// BoxShadow(
// // color: Colors.red,
// color: Color.fromRGBO(220, 220, 220, 1), //投影颜色
// offset: Offset(2, 2), //x,y轴
// blurRadius: ScreenUtil().setWidth(6) //投影距离
// )
// ]),
// child: Row(
// children: [
// Expanded(
// child: Container(
// padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(10)),
// margin:
// EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(30)),
// child: TabBar(
// controller: tabController,
// indicator: CustomTabIndicator(
// radius: 0,
// ),
// indicatorColor: MyColours.color_199095,
// indicatorSize: TabBarIndicatorSize.tab,
// // indicatorPadding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(12)),
// labelColor: MyColours.color_199095,
// labelStyle: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// fontWeight: FontWeight.bold),
// labelPadding: EdgeInsets.zero,
// unselectedLabelStyle: TextStyle(
// fontWeight: FontWeight.normal,
// fontSize: ScreenUtil().setSp(28),
// ),
// unselectedLabelColor: MyColours.color_999999,
// tabs: _tabBarTitle.map((value) {
// return Tab(
// child: Text(value),
// );
// }).toList()),
// )),
// InkWell(
// onTap: () {
// setState(() {
// showFilter = !showFilter;
// });
// if (showFilter) {
// _showFilterDialogFromTop(context, onPressedReset: () {
// Navigator.of(context).pop();
// setState(() {
// showFilter = false;
// });
// }, onPressedComplete: () {
// Navigator.of(context).pop();
// setState(() {
// showFilter = false;
// });
// }, tapWhiteBack: () {
// // Navigator.of(context).pop();
// // setState(() {
// // showFilter = false;
// // });
// });
// }
// },
// child: Container(
// padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(10)),
// margin: EdgeInsets.only(right: ScreenUtil().setWidth(30)),
// width: ScreenUtil().setWidth(100),
// // height: ScreenUtil().setWidth(50),
// child: Row(
// children: [
// Text(
// '筛选',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(28),
// color: MyColours.color_999999),
// ),
// HEmptyView(10),
// Image.asset(
// Utils.getImgPath(
// showFilter ? 'c_arrow_up' : 'c_arrow_down'),
// width: ScreenUtil().setWidth(24),
// // height: ScreenUtil().setWidth(10),
// )
// ],
// )),
// )
// ],
// ));
// }
///筛选弹框
_showFilterDialogFromTop(BuildContext context,
{VoidCallback onPressedReset,
VoidCallback onPressedComplete,
GestureTapCallback tapWhiteBack}) {
showGeneralDialog(
context: context,
barrierDismissible: false,
barrierColor: Colors.transparent,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
pageBuilder: (BuildContext context, Animation animation,
Animation secondaryAnimation) {
return Scaffold(
backgroundColor: Colors.transparent,
// resizeToAvoidBottomInset: false,
body: StatefulBuilder(builder: (context, state) {
return GestureDetector(
// behavior: HitTestBehavior.opaque,
onTap: tapWhiteBack,
child: _filterWidget(
state,
onPressedReset,
onPressedComplete,
));
}));
});
}
// ///筛选弹框
// _showFilterDialogFromTop(BuildContext context,
// {VoidCallback onPressedReset,
// VoidCallback onPressedComplete,
// GestureTapCallback tapWhiteBack}) {
// showGeneralDialog(
// context: context,
// barrierDismissible: false,
// barrierColor: Colors.transparent,
// barrierLabel:
// MaterialLocalizations.of(context).modalBarrierDismissLabel,
// transitionDuration: const Duration(milliseconds: 150),
// pageBuilder: (BuildContext context, Animation animation,
// Animation secondaryAnimation) {
// return Scaffold(
// backgroundColor: Colors.transparent,
// // resizeToAvoidBottomInset: false,
// body: StatefulBuilder(builder: (context, state) {
// return GestureDetector(
// // behavior: HitTestBehavior.opaque,
// onTap: tapWhiteBack,
// child: _filterWidget(
// state,
// onPressedReset,
// onPressedComplete,
// ));
// }));
// });
// }
///弹框text
_textWidget(String title, Color textColor, FontWeight fontWeight, int size) {
return Text(title,
style: TextStyle(
color: textColor,
decoration: TextDecoration.none,
fontWeight: fontWeight,
fontSize: ScreenUtil().setSp(size)));
}
// ///弹框text
// _textWidget(String title, Color textColor, FontWeight fontWeight, int size) {
// return Text(title,
// style: TextStyle(
// color: textColor,
// decoration: TextDecoration.none,
// fontWeight: fontWeight,
// fontSize: ScreenUtil().setSp(size)));
// }
///客户经理
Widget _managerWidget() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_textWidget('客户经理', MyColours.color_333333, FontWeight.bold, 28),
GestureDetector(
onTap: () {},
child: _textWidget(
'全选', MyColours.color_199095, FontWeight.normal, 24),
)
],
),
VEmptyView(30),
Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildFilterItem([
{'title': 'kkkk', 'select': false},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kdsfjsfsdfhjsdfh', 'select': true},
{'title': 'kkkk', 'select': true},
], false)),
],
);
}
// ///客户经理
// Widget _managerWidget() {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// _textWidget('客户经理', MyColours.color_333333, FontWeight.bold, 28),
// GestureDetector(
// onTap: () {},
// child: _textWidget(
// '全选', MyColours.color_199095, FontWeight.normal, 24),
// )
// ],
// ),
// VEmptyView(30),
// Wrap(
// spacing: ScreenUtil().setWidth(20),
// runSpacing: ScreenUtil().setWidth(20),
// children: _buildFilterItem([
// {'title': 'kkkk', 'select': false},
// {'title': 'kkkk', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'k', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'k', 'select': true},
// {'title': 'kdsfjsfsdfhjsdfh', 'select': true},
// {'title': 'kkkk', 'select': true},
// ], false)),
// ],
// );
// }
///活跃度
Widget _activityWidget() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_textWidget('活跃度', MyColours.color_333333, FontWeight.bold, 28),
GestureDetector(
onTap: () {},
child: _textWidget(
'全选', MyColours.color_199095, FontWeight.normal, 24),
)
],
),
VEmptyView(30),
Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildFilterItem([
{'title': 'kkkk', 'select': false},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kdsfjsfsdfhjsdfh', 'select': true},
{'title': 'kkkk', 'select': true},
], false)),
],
);
}
// ///活跃度
// Widget _activityWidget() {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// _textWidget('活跃度', MyColours.color_333333, FontWeight.bold, 28),
// GestureDetector(
// onTap: () {},
// child: _textWidget(
// '全选', MyColours.color_199095, FontWeight.normal, 24),
// )
// ],
// ),
// VEmptyView(30),
// Wrap(
// spacing: ScreenUtil().setWidth(20),
// runSpacing: ScreenUtil().setWidth(20),
// children: _buildFilterItem([
// {'title': 'kkkk', 'select': false},
// {'title': 'kkkk', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'k', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'k', 'select': true},
// {'title': 'kdsfjsfsdfhjsdfh', 'select': true},
// {'title': 'kkkk', 'select': true},
// ], false)),
// ],
// );
// }
///自定义标签
Widget _labelWidget() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_textWidget('自定义标签', MyColours.color_333333, FontWeight.bold, 28),
GestureDetector(
onTap: () {},
child: _textWidget(
'全选', MyColours.color_199095, FontWeight.normal, 24),
)
],
),
VEmptyView(30),
Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildFilterItem([
{'title': 'kkkk', 'select': false},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'kkkk', 'select': true},
{'title': 'k', 'select': true},
{'title': 'kdsfjsfsdfhjsdfh', 'select': false},
{'title': 'kkkk', 'select': true},
], true)),
],
);
}
// ///自定义标签
// Widget _labelWidget() {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// _textWidget('自定义标签', MyColours.color_333333, FontWeight.bold, 28),
// GestureDetector(
// onTap: () {},
// child: _textWidget(
// '全选', MyColours.color_199095, FontWeight.normal, 24),
// )
// ],
// ),
// VEmptyView(30),
// Wrap(
// spacing: ScreenUtil().setWidth(20),
// runSpacing: ScreenUtil().setWidth(20),
// children: _buildFilterItem([
// {'title': 'kkkk', 'select': false},
// {'title': 'kkkk', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'k', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'kkkk', 'select': true},
// {'title': 'k', 'select': true},
// {'title': 'kdsfjsfsdfhjsdfh', 'select': false},
// {'title': 'kkkk', 'select': true},
// ], true)),
// ],
// );
// }
///大于、等于、小于
List<DropdownMenuItem> _dropdownMenuItem() {
List<DropdownMenuItem> list = [];
for (int i = 0; i < timeTilte.length; i++) {
list.add(DropdownMenuItem(
child: _textWidget(
timeTilte[i], MyColours.color_199095, FontWeight.normal, 24),
value: i));
}
return list;
}
// ///大于、等于、小于
// List<DropdownMenuItem> _dropdownMenuItem() {
// List<DropdownMenuItem> list = [];
// for (int i = 0; i < timeTilte.length; i++) {
// list.add(DropdownMenuItem(
// child: _textWidget(
// timeTilte[i], MyColours.color_199095, FontWeight.normal, 24),
// value: i));
// }
// return list;
// }
_selectWidget(List<String> data, ClickCallback onTap) {
return Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
border: Border.all(
color: MyColours.color_cccccc,
width: ScreenUtil().setWidth(2))),
width: ScreenUtil().setWidth(130 * 2),
// constraints: BoxConstraints(
// maxHeight: ScreenUtil().setWidth(130 * 2),
// ),
child: ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(8)),
itemCount: data.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () {
onTap(index);
},
child: Container(
padding:
EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: MyColours.color_efefef,
width: data.length - 1 == index
? 0
: ScreenUtil().setWidth(2)))),
child: Text(data[index],
style: TextStyle(
color: MyColours.color_199095,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(28))),
),
);
}));
}
// _selectWidget(List<String> data, ClickCallback onTap) {
// return Container(
// decoration: BoxDecoration(
// color: MyColours.color_ffffff,
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
// border: Border.all(
// color: MyColours.color_cccccc,
// width: ScreenUtil().setWidth(2))),
// width: ScreenUtil().setWidth(130 * 2),
// // constraints: BoxConstraints(
// // maxHeight: ScreenUtil().setWidth(130 * 2),
// // ),
// child: ListView.builder(
// shrinkWrap: true,
// padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(8)),
// itemCount: data.length,
// itemBuilder: (context, index) {
// return InkWell(
// onTap: () {
// onTap(index);
// },
// child: Container(
// padding:
// EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: MyColours.color_efefef,
// width: data.length - 1 == index
// ? 0
// : ScreenUtil().setWidth(2)))),
// child: Text(data[index],
// style: TextStyle(
// color: MyColours.color_199095,
// fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(28))),
// ),
// );
// }));
// }
///高级筛选
Widget _advancedFilterWidget(state) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_textWidget('高级筛选', MyColours.color_333333, FontWeight.bold, 28),
GestureDetector(
onTap: () {},
child: _textWidget(
'清空', MyColours.color_199095, FontWeight.normal, 24),
)
],
),
VEmptyView(30),
Row(
children: [
Expanded(child: _textFeildWidget()),
HEmptyView(10),
_textWidget('至', MyColours.color_199095, FontWeight.normal, 24),
HEmptyView(10),
Expanded(child: _textFeildWidget()),
],
),
VEmptyView(30),
Wrap(
spacing: ScreenUtil().setWidth(20),
runSpacing: ScreenUtil().setWidth(20),
children: _buildFilterItem([
{'title': '7天', 'select': true},
{'title': '30天', 'select': true},
{'title': '60天', 'select': true},
{'title': '120天', 'select': true},
], true, grayBack: true)),
VEmptyView(30),
_textWidget('时间内预订次数', MyColours.color_333333, FontWeight.normal, 24),
VEmptyView(30),
/**
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Material(
child: Container(
height: ScreenUtil().setWidth(50),
width: ScreenUtil().setWidth(130),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(30)),
color: Color.fromRGBO(239, 239, 239, 1)),
child: _buttonChoose(dropValue, (value) {
state(() {
showDrop = !showDrop;
_scrollCrl.jumpTo(_scrollCrl.position.maxScrollExtent);
});
// ///高级筛选
// Widget _advancedFilterWidget(state) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// _textWidget('高级筛选', MyColours.color_333333, FontWeight.bold, 28),
// GestureDetector(
// onTap: () {},
// child: _textWidget(
// '清空', MyColours.color_199095, FontWeight.normal, 24),
// )
// ],
// ),
// VEmptyView(30),
// Row(
// children: [
// Expanded(child: _textFeildWidget()),
// HEmptyView(10),
// _textWidget('至', MyColours.color_199095, FontWeight.normal, 24),
// HEmptyView(10),
// Expanded(child: _textFeildWidget()),
// ],
// ),
// VEmptyView(30),
// Wrap(
// spacing: ScreenUtil().setWidth(20),
// runSpacing: ScreenUtil().setWidth(20),
// children: _buildFilterItem([
// {'title': '7天', 'select': true},
// {'title': '30天', 'select': true},
// {'title': '60天', 'select': true},
// {'title': '120天', 'select': true},
// ], true, grayBack: true)),
// VEmptyView(30),
// _textWidget('时间内预订次数', MyColours.color_333333, FontWeight.normal, 24),
// VEmptyView(30),
// /**
// Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
// Material(
// child: Container(
// height: ScreenUtil().setWidth(50),
// width: ScreenUtil().setWidth(130),
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(30)),
// color: Color.fromRGBO(239, 239, 239, 1)),
// child: _buttonChoose(dropValue, (value) {
// state(() {
// showDrop = !showDrop;
// _scrollCrl.jumpTo(_scrollCrl.position.maxScrollExtent);
// });
// _scrollCrl.position
// .didUpdateScrollPositionBy(2); //这里触发更新滚动条
}))),
VEmptyView(10),
Material(
child: Offstage(
offstage: showDrop,
child: _selectWidget(timeTilte, (index) {
print(timeTilte[index]);
state(() {
showDrop = !showDrop;
// _provider.currentIndex = index;
dropValue = timeTilte[index];
});
}),
)),
]),
VEmptyView(50),
*/
Row(children: [
Material(
child: Container(
height: ScreenUtil().setWidth(50),
// width: ScreenUtil().setWidth(100),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(30)),
color: Color.fromRGBO(239, 239, 239, 1)),
child: DropdownButton(
underline: SizedBox(),
value: dropValue,
isDense: true,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28)),
focusColor: MyColours.color_199095,
items: _dropdownMenuItem(),
icon: Row(
children: [
HEmptyView(10),
Image.asset(
Utils.getImgPath('c_arrow_down'),
width: ScreenUtil().setWidth(24),
// height: ScreenUtil().setWidth(10),
)
],
),
onChanged: (value) {
print(value);
state(() => dropValue = value);
}))),
HEmptyView(20),
Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(20),
// ),
width: ScreenUtil().setWidth(160),
height: ScreenUtil().setWidth(50),
// alignment: Alignment.center,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Color.fromRGBO(180, 180, 180, 1),
width: ScreenUtil().setWidth(2))),
),
child: Material(
color: MyColours.color_ffffff,
child: TextField(
maxLines: 1,
controller: customerProvider.controller,
// focusNode: _focusNode,
// autofocus: true,
// // _scrollCrl.position
// // .didUpdateScrollPositionBy(2); //这里触发更新滚动条
// }))),
// VEmptyView(10),
// Material(
// child: Offstage(
// offstage: showDrop,
// child: _selectWidget(timeTilte, (index) {
// print(timeTilte[index]);
// state(() {
// showDrop = !showDrop;
// // _provider.currentIndex = index;
// dropValue = timeTilte[index];
// });
// }),
// )),
// ]),
// VEmptyView(50),
// */
// Row(children: [
// Material(
// child: Container(
// height: ScreenUtil().setWidth(50),
// // width: ScreenUtil().setWidth(100),
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(20)),
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(ScreenUtil().setWidth(30)),
// color: Color.fromRGBO(239, 239, 239, 1)),
// child: DropdownButton(
// underline: SizedBox(),
// value: dropValue,
// isDense: true,
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(28)),
// focusColor: MyColours.color_199095,
// items: _dropdownMenuItem(),
// icon: Row(
// children: [
// HEmptyView(10),
// Image.asset(
// Utils.getImgPath('c_arrow_down'),
// width: ScreenUtil().setWidth(24),
// // height: ScreenUtil().setWidth(10),
// )
// ],
// ),
// onChanged: (value) {
// print(value);
// state(() => dropValue = value);
// }))),
// HEmptyView(20),
// Container(
// // padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(20),
// // ),
// width: ScreenUtil().setWidth(160),
// height: ScreenUtil().setWidth(50),
// // alignment: Alignment.center,
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Color.fromRGBO(180, 180, 180, 1),
// width: ScreenUtil().setWidth(2))),
// ),
// child: Material(
// color: MyColours.color_ffffff,
// child: TextField(
// maxLines: 1,
// controller: customerProvider.controller,
// // focusNode: _focusNode,
// // autofocus: true,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(26)),
// textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
// hintText: "xxx",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(26),
),
// isCollapsed:
// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
border: OutlineInputBorder(borderSide: BorderSide.none),
contentPadding: EdgeInsets.zero,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.done,
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(26)),
// // textAlignVertical: TextAlignVertical.center,
// decoration: InputDecoration(
// // hintText: "xxx",
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(26),
// ),
// // isCollapsed:
// // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
// border: OutlineInputBorder(borderSide: BorderSide.none),
// contentPadding: EdgeInsets.zero,
// ),
// keyboardType: TextInputType.text,
// textInputAction: TextInputAction.done,
onChanged: (value) {
// setState(() {});
// _searchSellerLocation();
customerProvider.searchData(value);
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
// contantShowModel.searchData(
// contantShowModel.controller.text);
// _searchSellerLocation();
// _focusNode.unfocus();
},
),
)),
HEmptyView(20),
_textWidget('次预订', MyColours.color_333333, FontWeight.normal, 24),
]),
VEmptyView(30),
],
);
}
// onChanged: (value) {
// // setState(() {});
// // _searchSellerLocation();
// customerProvider.searchData(value);
// },
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// // contantShowModel.searchData(
// // contantShowModel.controller.text);
// // _searchSellerLocation();
// // _focusNode.unfocus();
// },
// ),
// )),
// HEmptyView(20),
// _textWidget('次预订', MyColours.color_333333, FontWeight.normal, 24),
// ]),
// VEmptyView(30),
// ],
// );
// }
_buttonChoose(String title, ClickCallback callback) {
return InkWell(
onTap: () {
callback(title);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(10)),
height: ScreenUtil().setWidth(60),
decoration: BoxDecoration(
// border: Border.all(
// width: ScreenUtil().setWidth(2),
// color: MyColours.color_199095),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
child: Row(
children: [
Text(
title,
style: TextStyle(
color: title == '时间(选填)' || title == '(选填)'
? MyColours.color_999999
: MyColours.color_199095,
fontSize: ScreenUtil().setWidth(28)),
),
HEmptyView(10),
Image.asset(
Utils.getImgPath('enter_order_arrow'),
width: ScreenUtil().setWidth(20),
height: ScreenUtil().setWidth(10),
)
],
)));
}
// _buttonChoose(String title, ClickCallback callback) {
// return InkWell(
// onTap: () {
// callback(title);
// },
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(20),
// vertical: ScreenUtil().setWidth(10)),
// height: ScreenUtil().setWidth(60),
// decoration: BoxDecoration(
// // border: Border.all(
// // width: ScreenUtil().setWidth(2),
// // color: MyColours.color_199095),
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
// child: Row(
// children: [
// Text(
// title,
// style: TextStyle(
// color: title == '时间(选填)' || title == '(选填)'
// ? MyColours.color_999999
// : MyColours.color_199095,
// fontSize: ScreenUtil().setWidth(28)),
// ),
// HEmptyView(10),
// Image.asset(
// Utils.getImgPath('enter_order_arrow'),
// width: ScreenUtil().setWidth(20),
// height: ScreenUtil().setWidth(10),
// )
// ],
// )));
// }
/// 高级筛选输入框
Widget _textFeildWidget() {
return Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
),
height: ScreenUtil().setWidth(50),
// alignment: Alignment.center,
decoration: BoxDecoration(
color: Color.fromRGBO(239, 239, 239, 1),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
child: Material(
color: Color.fromRGBO(239, 239, 239, 1),
child: Row(children: [
Expanded(
child: TextField(
maxLines: 1,
controller: customerProvider.controller,
// focusNode: _focusNode,
// autofocus: true,
// /// 高级筛选输入框
// Widget _textFeildWidget() {
// return Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(20),
// ),
// height: ScreenUtil().setWidth(50),
// // alignment: Alignment.center,
// decoration: BoxDecoration(
// color: Color.fromRGBO(239, 239, 239, 1),
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
// child: Material(
// color: Color.fromRGBO(239, 239, 239, 1),
// child: Row(children: [
// Expanded(
// child: TextField(
// maxLines: 1,
// controller: customerProvider.controller,
// // focusNode: _focusNode,
// // autofocus: true,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(26)),
// textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
hintText: "xxx",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(26),
),
// isCollapsed:
// true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
border: OutlineInputBorder(borderSide: BorderSide.none),
contentPadding: EdgeInsets.zero,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.done,
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(26)),
// // textAlignVertical: TextAlignVertical.center,
// decoration: InputDecoration(
// hintText: "xxx",
// hintStyle: TextStyle(
// color: MyColours.color_999999,
// fontSize: ScreenUtil().setSp(26),
// ),
// // isCollapsed:
// // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
// border: OutlineInputBorder(borderSide: BorderSide.none),
// contentPadding: EdgeInsets.zero,
// ),
// keyboardType: TextInputType.text,
// textInputAction: TextInputAction.done,
onChanged: (value) {
// setState(() {});
// _searchSellerLocation();
customerProvider.searchData(value);
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
// contantShowModel.searchData(
// contantShowModel.controller.text);
// _searchSellerLocation();
// _focusNode.unfocus();
},
),
),
_textWidget('天', MyColours.color_333333, FontWeight.normal, 24),
])));
}
// onChanged: (value) {
// // setState(() {});
// // _searchSellerLocation();
// customerProvider.searchData(value);
// },
// onEditingComplete: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //点击空白处隐藏键盘
// // contantShowModel.searchData(
// // contantShowModel.controller.text);
// // _searchSellerLocation();
// // _focusNode.unfocus();
// },
// ),
// ),
// _textWidget('天', MyColours.color_333333, FontWeight.normal, 24),
// ])));
// }
///筛选布局
Widget _filterWidget(
StateSetter state,
VoidCallback onPressedReset,
VoidCallback onPressedComplete,
) {
return Container(
padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(30),
),
// height: ScreenUtil().setWidth(100),
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(92 + 52 + 30 * 3 + 90) +
ScreenUtil.statusBarHeight),
color: Color.fromRGBO(00, 00, 00, 0.49),
child: Align(
alignment: Alignment.topCenter,
child: Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(ScreenUtil().setWidth(20)),
bottomLeft: Radius.circular(ScreenUtil().setWidth(20)))),
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
bottom: ScreenUtil().setWidth(140),
right: ScreenUtil().setWidth(40)),
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
child: Column(
children: [
Expanded(
child: Scrollbar(
isAlwaysShown: true, //设置滚动条常亮
controller: _scrollCrl, //必须设置一个controller
// ///筛选布局
// Widget _filterWidget(
// StateSetter state,
// VoidCallback onPressedReset,
// VoidCallback onPressedComplete,
// ) {
// return Container(
// padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(30),
// ),
// // height: ScreenUtil().setWidth(100),
// margin: EdgeInsets.only(
// top: ScreenUtil().setWidth(92 + 52 + 30 * 3 + 90) +
// ScreenUtil.statusBarHeight),
// color: Color.fromRGBO(00, 00, 00, 0.49),
// child: Align(
// alignment: Alignment.topCenter,
// child: Container(
// decoration: BoxDecoration(
// color: MyColours.color_ffffff,
// borderRadius: BorderRadius.only(
// bottomRight: Radius.circular(ScreenUtil().setWidth(20)),
// bottomLeft: Radius.circular(ScreenUtil().setWidth(20)))),
// margin: EdgeInsets.only(
// left: ScreenUtil().setWidth(40),
// bottom: ScreenUtil().setWidth(140),
// right: ScreenUtil().setWidth(40)),
// padding:
// EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
// child: Column(
// children: [
// Expanded(
// child: Scrollbar(
// isAlwaysShown: true, //设置滚动条常亮
// controller: _scrollCrl, //必须设置一个controller
///添加进度条
child: SingleChildScrollView(
controller: _scrollCrl,
// primary: true,
// reverse: true,
// physics: BouncingScrollPhysics(),
// padding: EdgeInsets.only(
// bottom:
// MediaQuery.of(context).viewInsets.bottom),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(20),
_managerWidget(),
VEmptyView(30),
_activityWidget(),
VEmptyView(30),
_labelWidget(),
VEmptyView(30),
_advancedFilterWidget(state)
],
),
))),
Row(
children: [
Container(
width: ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(40 * 4),
height: ScreenUtil().setWidth(100),
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40)),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: MyColours.color_E0E0E0,
blurRadius: ScreenUtil().setWidth(14))
],
color: MyColours.color_ffffff,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(20),
)),
child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
flex: 1,
child: Material(
child: InkWell(
onTap: onPressedReset,
child: Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
ScreenUtil().setWidth(20)),
topLeft: Radius.circular(
ScreenUtil().setWidth(20)),
)),
child: Align(
alignment: Alignment.center,
child: _textWidget(
'重置',
MyColours.color_333333,
FontWeight.normal,
30),
),
),
))),
Expanded(
flex: 1,
child: Material(
child: InkWell(
onTap: onPressedComplete,
child: Container(
decoration: BoxDecoration(
color: MyColours.color_199095,
borderRadius: BorderRadius.only(
topRight: Radius.circular(
ScreenUtil().setWidth(20)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(20)),
)),
child: Align(
alignment: Alignment.center,
child: _textWidget(
'确定',
MyColours.color_ffffff,
FontWeight.normal,
30),
),
),
)))
],
),
),
],
),
VEmptyView(30)
],
),
)));
}
// ///添加进度条
// child: SingleChildScrollView(
// controller: _scrollCrl,
// // primary: true,
// // reverse: true,
// // physics: BouncingScrollPhysics(),
// // padding: EdgeInsets.only(
// // bottom:
// // MediaQuery.of(context).viewInsets.bottom),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// VEmptyView(20),
// _managerWidget(),
// VEmptyView(30),
// _activityWidget(),
// VEmptyView(30),
// _labelWidget(),
// VEmptyView(30),
// _advancedFilterWidget(state)
// ],
// ),
// ))),
// Row(
// children: [
// Container(
// width: ScreenUtil.screenWidthDp -
// ScreenUtil().setWidth(40 * 4),
// height: ScreenUtil().setWidth(100),
// // padding: EdgeInsets.symmetric(
// // horizontal: ScreenUtil().setWidth(40)),
// decoration: BoxDecoration(
// boxShadow: [
// BoxShadow(
// color: MyColours.color_E0E0E0,
// blurRadius: ScreenUtil().setWidth(14))
// ],
// color: MyColours.color_ffffff,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(20),
// )),
// child: Row(
// // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// // crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// Expanded(
// flex: 1,
// child: Material(
// child: InkWell(
// onTap: onPressedReset,
// child: Container(
// decoration: BoxDecoration(
// color: MyColours.color_ffffff,
// borderRadius: BorderRadius.only(
// bottomLeft: Radius.circular(
// ScreenUtil().setWidth(20)),
// topLeft: Radius.circular(
// ScreenUtil().setWidth(20)),
// )),
// child: Align(
// alignment: Alignment.center,
// child: _textWidget(
// '重置',
// MyColours.color_333333,
// FontWeight.normal,
// 30),
// ),
// ),
// ))),
// Expanded(
// flex: 1,
// child: Material(
// child: InkWell(
// onTap: onPressedComplete,
// child: Container(
// decoration: BoxDecoration(
// color: MyColours.color_199095,
// borderRadius: BorderRadius.only(
// topRight: Radius.circular(
// ScreenUtil().setWidth(20)),
// bottomRight: Radius.circular(
// ScreenUtil().setWidth(20)),
// )),
// child: Align(
// alignment: Alignment.center,
// child: _textWidget(
// '确定',
// MyColours.color_ffffff,
// FontWeight.normal,
// 30),
// ),
// ),
// )))
// ],
// ),
// ),
// ],
// ),
// VEmptyView(30)
// ],
// ),
// )));
// }
//构建筛选按钮
List<Widget> _buildFilterItem(List<Map> data, bool round,
{bool grayBack = false}) {
List<Widget> items = [];
// //构建筛选按钮
// List<Widget> _buildFilterItem(List<Map> data, bool round,
// {bool grayBack = false}) {
// List<Widget> items = [];
for (Map item in data) {
items.add(Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(6)),
decoration: BoxDecoration(
color: grayBack
? Color.fromRGBO(239, 239, 239, 1)
: item['select']
? MyColours.color_199095
: MyColours.color_ffffff,
border: Border.all(
color: grayBack
? Color.fromRGBO(239, 239, 239, 1)
: item['select']
? MyColours.color_199095
: round
? Color.fromRGBO(155, 155, 155, 1)
: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(round ? 30 : 10))),
child: _textWidget(
item['title'],
grayBack
? MyColours.color_333333
: item['select']
? MyColours.color_ffffff
: round
? MyColours.color_333333
: MyColours.color_199095,
FontWeight.normal,
24)));
}
return items;
}
// for (Map item in data) {
// items.add(Container(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(20),
// vertical: ScreenUtil().setWidth(6)),
// decoration: BoxDecoration(
// color: grayBack
// ? Color.fromRGBO(239, 239, 239, 1)
// : item['select']
// ? MyColours.color_199095
// : MyColours.color_ffffff,
// border: Border.all(
// color: grayBack
// ? Color.fromRGBO(239, 239, 239, 1)
// : item['select']
// ? MyColours.color_199095
// : round
// ? Color.fromRGBO(155, 155, 155, 1)
// : MyColours.color_199095,
// width: ScreenUtil().setWidth(2)),
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(round ? 30 : 10))),
// child: _textWidget(
// item['title'],
// grayBack
// ? MyColours.color_333333
// : item['select']
// ? MyColours.color_ffffff
// : round
// ? MyColours.color_333333
// : MyColours.color_199095,
// FontWeight.normal,
// 24)));
// }
// return items;
// }
@override
Widget build(BuildContext context) {
customerProvider = Provider.of<CustomerProvider>(context, listen: true);
return Material(
child: InkWell(
onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'全店客户',
onTap: () {
Navigator.of(context).pop();
},
),
body: SafeArea(
child: Column(children: [
_searchWidget(), _menuWidget(),
Expanded(child:
Consumer<CustomerProvider>(builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
model.pageState = PageState.Loading;
model.notifyListeners();
_getContantData();
},
emptyMsg: "暂时没有联系人哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Column(children: [
Expanded(
child: TabBarView(
controller: tabController,
physics: NeverScrollableScrollPhysics(),
children: <Widget>[
ContactListPage(
contacts: model.userHistorysShow,
provider: customerProvider),
ContactListPage(
contacts: model.userHistorysShow,
provider: customerProvider),
ContactListPage(
contacts: model.userHistorysShow,
provider: customerProvider),
ContactListPage(
contacts: model.userHistorysShow,
provider: customerProvider),
])),
customerProvider.pageState == PageState.Success
? _selectContantWidget()
: SizedBox(),
]);
}
})),
// _searchWidget(),
// Positioned(
// top: 0,
// left: ScreenUtil().setWidth(40),
// right: ScreenUtil().setWidth(40),
// child: _filterWidget())
// ],
])),
)));
}
}
// @override
// Widget build(BuildContext context) {
// customerProvider = Provider.of<CustomerProvider>(context, listen: true);
// return Material(
// child: InkWell(
// onTap: () {
// // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
// },
// child: Scaffold(
// resizeToAvoidBottomInset: false,
// backgroundColor: MyColours.color_ffffff,
// appBar: SystemAppBar(
// '全店客户',
// onTap: () {
// Navigator.of(context).pop();
// },
// ),
// body: SafeArea(
// child: Column(children: [
// _searchWidget(), _menuWidget(),
// Expanded(child:
// Consumer<CustomerProvider>(builder: (context, model, _) {
// if (model.pageState != PageState.Success) {
// return ExceptionPage(
// pageState: model.pageState,
// callback: () {
// model.pageState = PageState.Loading;
// model.notifyListeners();
// _getContantData();
// },
// emptyMsg: "暂时没有联系人哦",
// emptyImg: "empty_search",
// showMsg: "加载中,请稍后...",
// );
// } else {
// return Column(children: [
// Expanded(
// child: TabBarView(
// controller: tabController,
// physics: NeverScrollableScrollPhysics(),
// children: <Widget>[
// ContactListPage(
// contacts: model.userHistorysShow,
// provider: customerProvider),
// ContactListPage(
// contacts: model.userHistorysShow,
// provider: customerProvider),
// ContactListPage(
// contacts: model.userHistorysShow,
// provider: customerProvider),
// ContactListPage(
// contacts: model.userHistorysShow,
// provider: customerProvider),
// ])),
// customerProvider.pageState == PageState.Success
// ? _selectContantWidget()
// : SizedBox(),
// ]);
// }
// })),
// // _searchWidget(),
// // Positioned(
// // top: 0,
// // left: ScreenUtil().setWidth(40),
// // right: ScreenUtil().setWidth(40),
// // child: _filterWidget())
// // ],
// ])),
// )));
// }
// }
... ...
... ... @@ -71,13 +71,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.14.2"
azlistview:
dependency: "direct main"
description:
name: azlistview
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
boolean_selector:
dependency: transitive
description:
... ...