fix home problem
This commit is contained in:
@@ -208,46 +208,43 @@ class TabletHomePage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _bottomListView(HomeViewModel homeViewModel) {
|
||||
final controller = ScrollController();
|
||||
|
||||
if (!homeViewModel.isRecommendedMode) {
|
||||
// YourTenders
|
||||
if (controller.position.pixels >=
|
||||
controller.position.maxScrollExtent - 200) {
|
||||
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
|
||||
homeViewModel.getYourTenders();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Recommended
|
||||
if (controller.position.pixels >=
|
||||
controller.position.maxScrollExtent - 200) {
|
||||
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
|
||||
homeViewModel.getHomeRecommendTenders();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 387.0.h(),
|
||||
child: ListView.builder(
|
||||
itemCount:
|
||||
homeViewModel.tenders.length +
|
||||
(homeViewModel.isLoadingMore ? 1 : 0),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
if (index < homeViewModel.tenders.length) {
|
||||
return TendersListItem(tender: homeViewModel.tenders[index]);
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: CircularProgressIndicator(color: AppColors.secondary50),
|
||||
),
|
||||
);
|
||||
child: NotificationListener<ScrollNotification>(
|
||||
onNotification: (ScrollNotification scrollInfo) {
|
||||
if (scrollInfo.metrics.pixels >=
|
||||
scrollInfo.metrics.maxScrollExtent - 200) {
|
||||
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
|
||||
if (!homeViewModel.isRecommendedMode) {
|
||||
homeViewModel.getYourTenders();
|
||||
} else {
|
||||
homeViewModel.getHomeRecommendTenders();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: ListView.builder(
|
||||
itemCount:
|
||||
homeViewModel.tenders.length +
|
||||
(homeViewModel.isLoadingMore ? 1 : 0),
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
if (index < homeViewModel.tenders.length) {
|
||||
return TendersListItem(tender: homeViewModel.tenders[index]);
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.secondary50,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user