fix home problem

This commit is contained in:
amirrezaghabeli
2025-09-07 12:29:25 +03:30
parent 6ad3fe723f
commit 79d986c12d
3 changed files with 101 additions and 110 deletions
+14 -17
View File
@@ -190,30 +190,24 @@ class DesktopHomePage extends StatelessWidget {
} }
Widget _bottomListView(HomeViewModel homeViewModel) { Widget _bottomListView(HomeViewModel homeViewModel) {
final controller = ScrollController(); return SizedBox(
width: 740,
height: 387.0,
child: NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollInfo) {
if (scrollInfo.metrics.pixels >=
scrollInfo.metrics.maxScrollExtent - 200) {
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
if (!homeViewModel.isRecommendedMode) { if (!homeViewModel.isRecommendedMode) {
// YourTenders
if (controller.position.pixels >=
controller.position.maxScrollExtent - 200) {
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
homeViewModel.getYourTenders(); homeViewModel.getYourTenders();
}
}
} else { } else {
// Recommended
if (controller.position.pixels >=
controller.position.maxScrollExtent - 200) {
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
homeViewModel.getHomeRecommendTenders(); homeViewModel.getHomeRecommendTenders();
} }
} }
} }
return false;
return SizedBox( },
width: 740,
height: 387.0,
child: ListView.builder( child: ListView.builder(
controller: controller,
padding: EdgeInsets.only(bottom: 20), padding: EdgeInsets.only(bottom: 20),
itemCount: itemCount:
homeViewModel.tenders.length + homeViewModel.tenders.length +
@@ -226,12 +220,15 @@ class DesktopHomePage extends StatelessWidget {
return Center( return Center(
child: Padding( child: Padding(
padding: EdgeInsets.all(16.0), padding: EdgeInsets.all(16.0),
child: CircularProgressIndicator(color: AppColors.secondary50), child: CircularProgressIndicator(
color: AppColors.secondary50,
),
), ),
); );
} }
}, },
), ),
),
); );
} }
} }
+18 -21
View File
@@ -181,34 +181,28 @@ class MobileHomePage extends StatelessWidget {
} }
Widget _bottomListView(HomeViewModel homeViewModel) { Widget _bottomListView(HomeViewModel homeViewModel) {
final controller = ScrollController(); return Container(
constraints: BoxConstraints(maxHeight: 387.0.h()),
controller.addListener(() { width: double.infinity,
child: NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollInfo) {
if (scrollInfo.metrics.pixels >=
scrollInfo.metrics.maxScrollExtent - 200) {
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
if (!homeViewModel.isRecommendedMode) { if (!homeViewModel.isRecommendedMode) {
// YourTenders
if (controller.position.pixels >=
controller.position.maxScrollExtent - 200) {
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
homeViewModel.getYourTenders(); homeViewModel.getYourTenders();
}
}
} else { } else {
// Recommended
if (controller.position.pixels >=
controller.position.maxScrollExtent - 200) {
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
homeViewModel.getHomeRecommendTenders(); homeViewModel.getHomeRecommendTenders();
} }
} }
} }
}); return false;
},
return Container(
constraints: BoxConstraints(maxHeight: 387.0.h()),
width: double.infinity,
child: ListView.builder( child: ListView.builder(
controller: controller, padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric(horizontal: 24.0.w(), vertical: 15.0.h()), horizontal: 24.0.w(),
vertical: 15.0.h(),
),
itemCount: itemCount:
homeViewModel.tenders.length + homeViewModel.tenders.length +
(homeViewModel.isLoadingMore ? 1 : 0), (homeViewModel.isLoadingMore ? 1 : 0),
@@ -220,12 +214,15 @@ class MobileHomePage extends StatelessWidget {
return Center( return Center(
child: Padding( child: Padding(
padding: EdgeInsets.all(16.0), padding: EdgeInsets.all(16.0),
child: CircularProgressIndicator(color: AppColors.secondary50), child: CircularProgressIndicator(
color: AppColors.secondary50,
),
), ),
); );
} }
}, },
), ),
),
); );
} }
} }
+14 -17
View File
@@ -208,29 +208,23 @@ class TabletHomePage extends StatelessWidget {
} }
Widget _bottomListView(HomeViewModel homeViewModel) { Widget _bottomListView(HomeViewModel homeViewModel) {
final controller = ScrollController(); return SizedBox(
width: double.infinity,
height: 387.0.h(),
child: NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification scrollInfo) {
if (scrollInfo.metrics.pixels >=
scrollInfo.metrics.maxScrollExtent - 200) {
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
if (!homeViewModel.isRecommendedMode) { if (!homeViewModel.isRecommendedMode) {
// YourTenders
if (controller.position.pixels >=
controller.position.maxScrollExtent - 200) {
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
homeViewModel.getYourTenders(); homeViewModel.getYourTenders();
}
}
} else { } else {
// Recommended
if (controller.position.pixels >=
controller.position.maxScrollExtent - 200) {
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
homeViewModel.getHomeRecommendTenders(); homeViewModel.getHomeRecommendTenders();
} }
} }
} }
return false;
return SizedBox( },
width: double.infinity,
height: 387.0.h(),
child: ListView.builder( child: ListView.builder(
itemCount: itemCount:
homeViewModel.tenders.length + homeViewModel.tenders.length +
@@ -243,12 +237,15 @@ class TabletHomePage extends StatelessWidget {
return Center( return Center(
child: Padding( child: Padding(
padding: EdgeInsets.all(16.0), padding: EdgeInsets.all(16.0),
child: CircularProgressIndicator(color: AppColors.secondary50), child: CircularProgressIndicator(
color: AppColors.secondary50,
),
), ),
); );
} }
}, },
), ),
),
); );
} }
} }