Commit 590a37e78061f2708255c929f5968df19e40b7b1

Authored by wdn127929
1 parent 72b88052

min and max

... ... @@ -63,14 +63,26 @@ class _MyContactListPageState extends State<MyContactListPage> {
// ItemPosition itemPosition = positon.itemPositions.value.first;
print('${positon.itemPositions.value.last.index}');
// positon.itemPositions.value
if (positon.itemPositions.value.last.index == 1 &&
widget.contacts.length >= 10) {
int max = positon.itemPositions.value
.where((ItemPosition position) => position.itemLeadingEdge < 1)
.reduce((ItemPosition max, ItemPosition position) =>
position.itemLeadingEdge > max.itemLeadingEdge ? position : max)
.index;
int min = positon.itemPositions.value
.where((ItemPosition position) => position.itemTrailingEdge > 0)
.reduce((ItemPosition min, ItemPosition position) =>
position.itemTrailingEdge < min.itemTrailingEdge ? position : min)
.index;
print(min);
print(max);
if (min == 0 && widget.contacts.length > 10) {
bus.emit(
'onrefresh_guest_list_my',
);
}
if (positon.itemPositions.value.last.index == widget.contacts.length - 1 &&
widget.contacts.length >= 10) {
if (max == widget.contacts.length - 1 && widget.contacts.length >= 10) {
//上拉加载方法,最底部
bus.emit(
... ... @@ -79,6 +91,22 @@ class _MyContactListPageState extends State<MyContactListPage> {
? 1
: (widget.contacts.length / 10).toInt());
}
// if (positon.itemPositions.value.last.index == 1 &&
// widget.contacts.length >= 10) {
// bus.emit(
// 'onrefresh_guest_list_my',
// );
// }
// if (positon.itemPositions.value.last.index == widget.contacts.length - 1 &&
// widget.contacts.length >= 10) {
// //上拉加载方法,最底部
// bus.emit(
// 'onload_guest_list_my',
// (widget.contacts.length / 10) < 1
// ? 1
// : (widget.contacts.length / 10).toInt());
// }
}
// void loadData() async {
... ...
... ... @@ -164,7 +164,7 @@ class _MyCustomerListPageState extends State<MyCustomerListPage>
_onrefresh() {
page = 1;
customerProvider.pageDataMy = [0];
_getContantData(showLoading: false);
_getContantData(showLoading: false, load: true);
}
_filterLabelList() async {
... ...
... ... @@ -43,6 +43,7 @@ class _ContactListPageState extends State<ContactListPage> {
void initState() {
super.initState();
widget.provider.handleList(widget.contacts);
positon.itemPositions.addListener(_itemPositonChanaged
// print('${positon.itemPositions.value.last.index}');
// // positon.itemPositions.value
... ... @@ -64,15 +65,26 @@ class _ContactListPageState extends State<ContactListPage> {
_itemPositonChanaged() {
// ItemPosition itemPosition = positon.itemPositions.value.first;
print('${positon.itemPositions.value.last.index}');
// positon.itemPositions.value
if (positon.itemPositions.value.last.index == 1 &&
widget.contacts.length >= 10) {
int max = positon.itemPositions.value
.where((ItemPosition position) => position.itemLeadingEdge < 1)
.reduce((ItemPosition max, ItemPosition position) =>
position.itemLeadingEdge > max.itemLeadingEdge ? position : max)
.index;
int min = positon.itemPositions.value
.where((ItemPosition position) => position.itemTrailingEdge > 0)
.reduce((ItemPosition min, ItemPosition position) =>
position.itemTrailingEdge < min.itemTrailingEdge ? position : min)
.index;
print(min);
print(max);
if (min == 0 && widget.contacts.length > 10) {
bus.emit(
'onrefresh_guest_list',
);
}
if (positon.itemPositions.value.last.index == widget.contacts.length - 1 &&
widget.contacts.length >= 10) {
if (max == widget.contacts.length - 1 && widget.contacts.length >= 10) {
//上拉加载方法,最底部
bus.emit(
... ... @@ -81,6 +93,24 @@ class _ContactListPageState extends State<ContactListPage> {
? 1
: (widget.contacts.length / 10).toInt());
}
// positon.itemPositions.value
// if (positon.itemPositions.value.last.index == 1 &&
// widget.contacts.length >= 10) {
// bus.emit(
// 'onrefresh_guest_list',
// );
// }
// if (positon.itemPositions.value.last.index == widget.contacts.length - 1 &&
// widget.contacts.length >= 10) {
// //上拉加载方法,最底部
// bus.emit(
// 'onload_guest_list',
// (widget.contacts.length / 10) < 1
// ? 1
// : (widget.contacts.length / 10).toInt());
// }
}
// void loadData() async {
... ...
... ... @@ -186,7 +186,7 @@ class _CustomerListPageState extends State<CustomerListPage>
_onrefresh() {
page = 1;
customerProvider.pageData = [0];
_getContantData(showLoading: false);
_getContantData(showLoading: false, load: true);
}
// _getAuthUserLists() async {
... ...