Add liked tenders functionality to HomeRepository and ViewModel

- Integrated LikedTendersService into HomeRepository to fetch the count of user-liked tenders.
- Updated HomeViewModel to load and manage the userLikedTendersCount.
- Adjusted UI components across home pages to display the liked tenders count.
- Refactored date handling in date_utils.dart to improve timestamp parsing and validation.
- Enhanced unit tests for date utilities to cover new edge cases.
This commit is contained in:
AmirReza Jamali
2026-05-24 18:23:37 +03:30
parent 2515190576
commit 35af3e94ea
9 changed files with 114 additions and 44 deletions
+3 -4
View File
@@ -41,8 +41,7 @@ class DesktopHomePage extends StatelessWidget {
}
if (homeViewModel.tenderApprovalsStateResponse != null &&
homeViewModel.data != null &&
homeViewModel.feedbackStats != null) {
homeViewModel.data != null) {
return Expanded(
child: SingleChildScrollView(
child: SizedBox(
@@ -181,9 +180,9 @@ class DesktopHomePage extends StatelessWidget {
backgroundColor: AppColors.grey10,
iconPath: AssetsManager.thumbLike,
title: HomeStrings.likedTenders,
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
amount: homeViewModel.userLikedTendersCount.toString(),
textColor: AppColors.grey50,
enableTap: (homeViewModel.feedbackStats?.totalLikes ?? 0) != 0,
enableTap: homeViewModel.userLikedTendersCount != 0,
width: 178,
height: 148,
onTap: () {
+3 -4
View File
@@ -33,8 +33,7 @@ class MobileHomePage extends StatelessWidget {
}
if (homeViewModel.tenderApprovalsStateResponse != null &&
homeViewModel.data != null &&
homeViewModel.feedbackStats != null) {
homeViewModel.data != null) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -156,9 +155,9 @@ class MobileHomePage extends StatelessWidget {
backgroundColor: AppColors.grey10,
iconPath: AssetsManager.thumbLike,
title: HomeStrings.likedTenders,
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
amount: homeViewModel.userLikedTendersCount.toString(),
textColor: AppColors.grey50,
enableTap: (homeViewModel.feedbackStats?.totalLikes ?? 0) != 0,
enableTap: homeViewModel.userLikedTendersCount != 0,
onTap: () {
const LikedTendersRouteData().push(context).then((value) {
homeViewModel.init();
+3 -4
View File
@@ -41,8 +41,7 @@ class TabletHomePage extends StatelessWidget {
}
if (homeViewModel.tenderApprovalsStateResponse != null &&
homeViewModel.data != null &&
homeViewModel.feedbackStats != null) {
homeViewModel.data != null) {
return SingleChildScrollView(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
@@ -186,9 +185,9 @@ class TabletHomePage extends StatelessWidget {
backgroundColor: AppColors.grey10,
iconPath: AssetsManager.thumbLike,
title: HomeStrings.likedTenders,
amount: homeViewModel.feedbackStats?.totalLikes.toString() ?? '0',
amount: homeViewModel.userLikedTendersCount.toString(),
textColor: AppColors.grey50,
enableTap: (homeViewModel.feedbackStats?.totalLikes ?? 0) != 0,
enableTap: homeViewModel.userLikedTendersCount != 0,
width: double.infinity,
height: 148,
onTap: () {