Files
tm_app/lib/views/detail/widgets/deadline_item.dart
T
AmirReza Jamali 35af3e94ea 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.
2026-05-24 18:23:37 +03:30

168 lines
5.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/date_utils.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/views/detail/strings/tender_details_strings.dart';
import '../../../data/services/model/tender_data/tender_data.dart';
class DeadlineItem extends StatelessWidget {
final TenderData detail;
final bool isScreenBig;
const DeadlineItem({
required this.detail,
required this.isScreenBig,
super.key,
});
@override
Widget build(BuildContext context) {
if (detail.submissionDeadline == null && detail.applicationDeadline == null) {
return const SizedBox.shrink();
}
return isScreenBig
? Padding(
padding: const EdgeInsets.symmetric(vertical: 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TenderDetailsStrings.tenderDeadlineLabel,
style: TextStyle(
color: AppColors.grey80,
fontWeight: FontWeight.w600,
fontSize: 16.0.sp(),
),
),
SizedBox(height: 12.0.h()),
IntrinsicHeight(
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TenderDetailsStrings.pleaseReplyBy,
style: TextStyle(
color: AppColors.grey70,
fontWeight: FontWeight.w500,
fontSize: 14.0.sp(),
),
),
SizedBox(height: 4.0.h()),
Text(
timeConvertor(detail.submissionDeadline),
style: TextStyle(
color: AppColors.grey80,
fontWeight: FontWeight.w400,
fontSize: 14.0.sp(),
),
),
],
),
),
VerticalDivider(
color: AppColors.grey30,
thickness: 1,
width: 24,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TenderDetailsStrings.lastDayToPrepareProposal,
style: TextStyle(
color: AppColors.grey70,
fontWeight: FontWeight.w500,
fontSize: 14.0.sp(),
),
),
SizedBox(height: 4.0.h()),
Text(
timeConvertor(detail.applicationDeadline),
style: TextStyle(
color: AppColors.grey80,
fontWeight: FontWeight.w400,
fontSize: 14.0.sp(),
),
),
],
),
),
],
),
),
SizedBox(height: 8.0.h()),
Divider(color: AppColors.grey20),
],
),
)
: Padding(
padding: const EdgeInsets.symmetric(vertical: 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TenderDetailsStrings.tenderDeadlineLabel,
style: TextStyle(
color: AppColors.grey80,
fontWeight: FontWeight.w600,
fontSize: 16.0.sp(),
),
),
SizedBox(height: 12.0.h()),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
TenderDetailsStrings.pleaseReplyBy,
style: TextStyle(
color: AppColors.grey70,
fontWeight: FontWeight.w500,
fontSize: 14.0.sp(),
),
),
Text(
timeConvertor(detail.submissionDeadline),
style: TextStyle(
color: AppColors.grey70,
fontWeight: FontWeight.w400,
fontSize: 14.0.sp(),
),
),
],
),
SizedBox(height: 4.0.h()),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
TenderDetailsStrings.lastDayToPrepareProposal,
style: TextStyle(
color: AppColors.grey70,
fontWeight: FontWeight.w500,
fontSize: 14.0.sp(),
),
),
Text(
timeConvertor(detail.applicationDeadline),
style: TextStyle(
color: AppColors.grey70,
fontWeight: FontWeight.w400,
fontSize: 14.0.sp(),
),
),
],
),
SizedBox(height: 8.0.h()),
Divider(color: AppColors.grey20),
],
),
);
}
}