fix home problem
This commit is contained in:
@@ -190,47 +190,44 @@ class DesktopHomePage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _bottomListView(HomeViewModel homeViewModel) {
|
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(
|
return SizedBox(
|
||||||
width: 740,
|
width: 740,
|
||||||
height: 387.0,
|
height: 387.0,
|
||||||
child: ListView.builder(
|
child: NotificationListener<ScrollNotification>(
|
||||||
controller: controller,
|
onNotification: (ScrollNotification scrollInfo) {
|
||||||
padding: EdgeInsets.only(bottom: 20),
|
if (scrollInfo.metrics.pixels >=
|
||||||
itemCount:
|
scrollInfo.metrics.maxScrollExtent - 200) {
|
||||||
homeViewModel.tenders.length +
|
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
|
||||||
(homeViewModel.isLoadingMore ? 1 : 0),
|
if (!homeViewModel.isRecommendedMode) {
|
||||||
scrollDirection: Axis.horizontal,
|
homeViewModel.getYourTenders();
|
||||||
itemBuilder: (context, index) {
|
} else {
|
||||||
if (index < homeViewModel.tenders.length) {
|
homeViewModel.getHomeRecommendTenders();
|
||||||
return TendersListItem(tender: homeViewModel.tenders[index]);
|
}
|
||||||
} else {
|
}
|
||||||
return Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(16.0),
|
|
||||||
child: CircularProgressIndicator(color: AppColors.secondary50),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
|
child: ListView.builder(
|
||||||
|
padding: EdgeInsets.only(bottom: 20),
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,50 +181,47 @@ class MobileHomePage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _bottomListView(HomeViewModel homeViewModel) {
|
Widget _bottomListView(HomeViewModel homeViewModel) {
|
||||||
final controller = ScrollController();
|
|
||||||
|
|
||||||
controller.addListener(() {
|
|
||||||
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 Container(
|
return Container(
|
||||||
constraints: BoxConstraints(maxHeight: 387.0.h()),
|
constraints: BoxConstraints(maxHeight: 387.0.h()),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: ListView.builder(
|
child: NotificationListener<ScrollNotification>(
|
||||||
controller: controller,
|
onNotification: (ScrollNotification scrollInfo) {
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w(), vertical: 15.0.h()),
|
if (scrollInfo.metrics.pixels >=
|
||||||
itemCount:
|
scrollInfo.metrics.maxScrollExtent - 200) {
|
||||||
homeViewModel.tenders.length +
|
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
|
||||||
(homeViewModel.isLoadingMore ? 1 : 0),
|
if (!homeViewModel.isRecommendedMode) {
|
||||||
scrollDirection: Axis.horizontal,
|
homeViewModel.getYourTenders();
|
||||||
itemBuilder: (context, index) {
|
} else {
|
||||||
if (index < homeViewModel.tenders.length) {
|
homeViewModel.getHomeRecommendTenders();
|
||||||
return TendersListItem(tender: homeViewModel.tenders[index]);
|
}
|
||||||
} else {
|
}
|
||||||
return Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(16.0),
|
|
||||||
child: CircularProgressIndicator(color: AppColors.secondary50),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
|
child: ListView.builder(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 24.0.w(),
|
||||||
|
vertical: 15.0.h(),
|
||||||
|
),
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,46 +208,43 @@ class TabletHomePage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _bottomListView(HomeViewModel homeViewModel) {
|
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(
|
return SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 387.0.h(),
|
height: 387.0.h(),
|
||||||
child: ListView.builder(
|
child: NotificationListener<ScrollNotification>(
|
||||||
itemCount:
|
onNotification: (ScrollNotification scrollInfo) {
|
||||||
homeViewModel.tenders.length +
|
if (scrollInfo.metrics.pixels >=
|
||||||
(homeViewModel.isLoadingMore ? 1 : 0),
|
scrollInfo.metrics.maxScrollExtent - 200) {
|
||||||
scrollDirection: Axis.horizontal,
|
if (!homeViewModel.isLoadingMore && homeViewModel.hasMore) {
|
||||||
itemBuilder: (context, index) {
|
if (!homeViewModel.isRecommendedMode) {
|
||||||
if (index < homeViewModel.tenders.length) {
|
homeViewModel.getYourTenders();
|
||||||
return TendersListItem(tender: homeViewModel.tenders[index]);
|
} else {
|
||||||
} else {
|
homeViewModel.getHomeRecommendTenders();
|
||||||
return Center(
|
}
|
||||||
child: Padding(
|
}
|
||||||
padding: EdgeInsets.all(16.0),
|
|
||||||
child: CircularProgressIndicator(color: AppColors.secondary50),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
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