fixed your tenders filters and service and home your tneders use your tenders service

This commit is contained in:
amirrezaghabeli
2025-09-08 09:53:21 +03:30
parent 326f2deeec
commit 9a1ec0b34e
23 changed files with 180 additions and 1279 deletions
+43 -43
View File
@@ -2,47 +2,47 @@ import 'package:country_flags/country_flags.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:tm_app/core/utils/date_utils.dart';
import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
import '../../../core/constants/assets.dart';
import '../../../core/theme/colors.dart';
import '../../../core/utils/size_config.dart';
class TenderCard extends StatelessWidget {
final String date;
final String title;
final String description;
final String location;
final String countryFlag;
final String status;
final String projectStatus;
final Color? backgroundColor;
final Color? borderColor;
final String? statusIcon;
final Color? statusCardColor;
final Color? statusTextColor;
final String countryCode;
final bool isDesktop;
final TenderData tender;
const TenderCard({
required this.date,
required this.title,
required this.description,
required this.location,
required this.countryCode,
required this.isDesktop,
this.countryFlag = 'assets/icons/SE.png',
this.status = 'Completed',
this.projectStatus = 'Self Control',
this.backgroundColor,
this.borderColor,
this.statusIcon,
this.statusCardColor,
this.statusTextColor,
super.key,
});
const TenderCard({required this.isDesktop, required this.tender, super.key});
@override
Widget build(BuildContext context) {
// Determine styling based on tender status
Color backgroundColor;
Color borderColor;
String? statusIcon;
Color statusCardColor;
Color statusTextColor;
if (tender.status == 'Won') {
backgroundColor = AppColors.green0;
borderColor = AppColors.green10;
statusIcon = AssetsManager.tickCircle;
statusCardColor = AppColors.green20;
statusTextColor = AppColors.green30;
} else if (tender.status == 'submitted') {
backgroundColor = AppColors.grey0;
borderColor = AppColors.grey30;
statusIcon = null;
statusCardColor = AppColors.green20;
statusTextColor = AppColors.green30;
} else {
backgroundColor = AppColors.red0.withValues(alpha: 0.2);
borderColor = AppColors.red0;
statusIcon = AssetsManager.closeCircle;
statusCardColor = AppColors.red0;
statusTextColor = AppColors.red10;
}
return Container(
height: isDesktop ? 182.0.h() : 240.0.h(),
width: double.infinity,
@@ -52,9 +52,9 @@ class TenderCard extends StatelessWidget {
bottom: 24.0.h(),
),
decoration: BoxDecoration(
color: backgroundColor ?? AppColors.grey0,
color: backgroundColor,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: borderColor ?? AppColors.borderColor),
border: Border.all(color: borderColor),
),
child: Padding(
padding: EdgeInsets.all(16.0.w()),
@@ -67,7 +67,7 @@ class TenderCard extends StatelessWidget {
children: [
// Date
Text(
unixToDate(int.parse(date)),
unixToDate(int.parse(tender.publicationDate!.toString())),
style: TextStyle(
color: AppColors.grey60,
fontSize: 12.0.sp(),
@@ -81,26 +81,26 @@ class TenderCard extends StatelessWidget {
vertical: 4.0.h(),
),
decoration: BoxDecoration(
color: statusCardColor ?? AppColors.green20,
color: statusCardColor,
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
if (statusIcon != null)
SvgPicture.asset(
statusIcon!,
statusIcon,
width: 16.0.w(),
height: 16.0.h(),
colorFilter: ColorFilter.mode(
statusTextColor ?? AppColors.green30,
statusTextColor,
BlendMode.srcIn,
),
),
SizedBox(width: 4.0.w()),
Text(
status,
tender.status!,
style: TextStyle(
color: statusTextColor ?? AppColors.green30,
color: statusTextColor,
fontSize: 12.0.sp(),
fontWeight: FontWeight.w500,
),
@@ -114,7 +114,7 @@ class TenderCard extends StatelessWidget {
// Title
Text(
title,
tender.title!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@@ -128,7 +128,7 @@ class TenderCard extends StatelessWidget {
// Description
Text(
description,
tender.description!,
maxLines: isDesktop ? 2 : 3,
style: TextStyle(
color: AppColors.grey70,
@@ -154,7 +154,7 @@ class TenderCard extends StatelessWidget {
),
SizedBox(width: 4.0.w()),
Text(
location,
tender.countryCode!,
style: TextStyle(
color: AppColors.grey80,
fontSize: 12.0.sp(),
@@ -167,7 +167,7 @@ class TenderCard extends StatelessWidget {
width: 32.0.w(),
height: 21.0.h(),
child: CountryFlag.fromCountryCode(
countryCode,
tender.countryCode!,
shape: RoundedRectangle(4),
),
),
@@ -187,7 +187,7 @@ class TenderCard extends StatelessWidget {
border: Border.all(color: AppColors.grey40),
),
child: Text(
projectStatus,
tender.procurementTypeCode!,
style: TextStyle(
color: AppColors.grey60,
fontSize: 12.0.sp(),