Files
tm_app/lib/views/your_tenders/widgets/tender_card.dart
T
2025-09-03 09:19:39 +03:30

202 lines
6.3 KiB
Dart

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 '../../../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;
const TenderCard({
required this.date,
required this.title,
required this.description,
required this.location,
required this.countryCode,
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,
});
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
margin: EdgeInsets.only(
left: 24.0.w(),
right: 24.0.w(),
bottom: 24.0.h(),
),
decoration: BoxDecoration(
color: backgroundColor ?? AppColors.grey0,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: borderColor ?? AppColors.borderColor),
),
child: Padding(
padding: EdgeInsets.all(16.0.w()),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Top section with date and status
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Date
Text(
unixToDate(int.parse(date)),
style: TextStyle(
color: AppColors.grey60,
fontSize: 12.0.sp(),
fontWeight: FontWeight.w400,
),
),
// Completed status badge
Container(
padding: EdgeInsets.symmetric(
horizontal: 16.0.w(),
vertical: 4.0.h(),
),
decoration: BoxDecoration(
color: statusCardColor ?? AppColors.green20,
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
if (statusIcon != null)
SvgPicture.asset(
statusIcon!,
width: 16.0.w(),
height: 16.0.h(),
colorFilter: ColorFilter.mode(
statusTextColor ?? AppColors.green30,
BlendMode.srcIn,
),
),
SizedBox(width: 4.0.w()),
Text(
status,
style: TextStyle(
color: statusTextColor ?? AppColors.green30,
fontSize: 12.0.sp(),
fontWeight: FontWeight.w500,
),
),
],
),
),
],
),
SizedBox(height: 12.0.h()),
// Title
Text(
title,
style: TextStyle(
color: AppColors.grey80,
fontSize: 16.0.sp(),
fontWeight: FontWeight.w600,
height: 1.3,
),
),
SizedBox(height: 8.0.h()),
// Description
Text(
description,
style: TextStyle(
color: AppColors.grey70,
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
height: 1.4,
),
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
SizedBox(height: 24.0.h()),
// Bottom section with location and action button
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// Location with flag
Expanded(
child: Row(
children: [
SvgPicture.asset(
AssetsManager.location,
width: 16.0.w(),
height: 16.0.h(),
),
SizedBox(width: 4.0.w()),
Text(
location,
style: TextStyle(
color: AppColors.grey80,
fontSize: 12.0.sp(),
fontWeight: FontWeight.w400,
),
),
SizedBox(width: 8.0.w()),
// Country flag
SizedBox(
width: 32.0.w(),
height: 21.0.h(),
child: CountryFlag.fromCountryCode(
countryCode,
shape: RoundedRectangle(4),
),
),
],
),
),
// Self Control button
Container(
padding: EdgeInsets.symmetric(
horizontal: 16.0.w(),
vertical: 4.0.h(),
),
decoration: BoxDecoration(
color: AppColors.grey20,
borderRadius: BorderRadius.circular(88),
border: Border.all(color: AppColors.grey40),
),
child: Text(
projectStatus,
style: TextStyle(
color: AppColors.grey60,
fontSize: 12.0.sp(),
fontWeight: FontWeight.w500,
),
),
),
],
),
],
),
),
);
}
}