|
|
@@ -37,7 +37,7 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
getOrderList(value, lineIdStr, page).then((resp) {
|
|
|
if (resp.success && resp.code == 1) {
|
|
|
setState(() {
|
|
|
- orderList = resp.data.items;
|
|
|
+ orderList = resp.data.items;
|
|
|
hasNextPage = resp.data.hasNextPage;
|
|
|
});
|
|
|
}
|
|
|
@@ -51,12 +51,20 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
});
|
|
|
}
|
|
|
if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {
|
|
|
- print("滑到底部了");
|
|
|
- // getOrderList().then((resp) {
|
|
|
- // setState(() {
|
|
|
- // listObj.addAll(resp.orderList);
|
|
|
- // });
|
|
|
- // });
|
|
|
+ print('滑动到底部了');
|
|
|
+ if(hasNextPage){
|
|
|
+ setState(() {
|
|
|
+ page=++page;
|
|
|
+ });
|
|
|
+ getOrderList(stationId, lineIdStr, page).then((resp) {
|
|
|
+ if (resp.success && resp.code == 1) {
|
|
|
+ setState(() {
|
|
|
+ orderList.addAll(resp.data.items);
|
|
|
+ hasNextPage = resp.data.hasNextPage;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -123,10 +131,9 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
decoration: BoxDecoration(
|
|
|
color: Color.fromRGBO(246, 246, 254, 1)
|
|
|
),
|
|
|
-
|
|
|
-
|
|
|
child: ListView.builder(
|
|
|
controller: _scrollController,
|
|
|
+ physics: AlwaysScrollableScrollPhysics(),
|
|
|
itemCount: orderList.length + 1,
|
|
|
itemBuilder: (BuildContext context, int index) { //itemBuilder实际上就是一个map的循环
|
|
|
if (index < orderList.length) {
|
|
|
@@ -134,10 +141,11 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
}
|
|
|
if (hasNextPage) {
|
|
|
return _getMoreWidget();
|
|
|
+ }else{
|
|
|
+ return _noMoreWidegt();
|
|
|
}
|
|
|
},
|
|
|
)
|
|
|
-
|
|
|
),
|
|
|
onTap: () {
|
|
|
setState(() {
|
|
|
@@ -233,8 +241,20 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Widget _noMoreWidegt(){
|
|
|
+ return Center(
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.all(10.0),
|
|
|
+ child: Text(
|
|
|
+ '没有更多数据了...',
|
|
|
+ style: TextStyle(fontSize: 16.0),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
Future < Null > _onRefresh() async {
|
|
|
- getKey('stationId').then((value) {
|
|
|
+ await getKey('stationId').then((value) {
|
|
|
getOrderList(value, lineIdStr, 1).then((resp) {
|
|
|
setState(() {
|
|
|
orderList = resp.data.items;
|