144 lines
4.8 KiB
Dart
144 lines
4.8 KiB
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 'package:tm_app/views/home/strings/home_strings.dart';
|
|
import 'package:tm_app/views/home/widgets/tender_card_progress_bar.dart';
|
|
|
|
import '../../core/constants/assets.dart';
|
|
import '../../core/theme/colors.dart';
|
|
import '../../core/utils/size_config.dart';
|
|
import '../shared/base_button.dart';
|
|
import '../shared/flag.dart';
|
|
|
|
class TendersListItem extends StatelessWidget {
|
|
const TendersListItem({required this.tender, required this.onTap, super.key});
|
|
final TenderData tender;
|
|
final VoidCallback onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
color: AppColors.cardBackground,
|
|
borderRadius: BorderRadius.circular(4),
|
|
border: Border.all(color: AppColors.grey30),
|
|
),
|
|
margin: EdgeInsetsDirectional.only(end: 16.0.w()),
|
|
width: 320.0.w(),
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 16.0.w(), vertical: 16.0.h()),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
width: double.infinity,
|
|
child: Text(
|
|
timeConvertor(tender.publicationDate ?? 0),
|
|
style: TextStyle(
|
|
fontSize: 12.0.sp(),
|
|
fontWeight: FontWeight.w400,
|
|
color: AppColors.grey60,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 10.0.h()),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 10.0.w(),
|
|
vertical: 5.0.h(),
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.primary20,
|
|
borderRadius: BorderRadius.circular(4),
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'${HomeStrings.tenderDeadline} :',
|
|
style: TextStyle(
|
|
fontSize: 15.0.sp(),
|
|
fontWeight: FontWeight.w500,
|
|
color: AppColors.textBlue,
|
|
),
|
|
),
|
|
Text(
|
|
timeConvertor(tender.tenderDeadline ?? 0),
|
|
style: TextStyle(
|
|
fontSize: 14.0.sp(),
|
|
fontWeight: FontWeight.w500,
|
|
color: AppColors.grey80,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 12.0.h()),
|
|
Text(
|
|
tender.title ?? '',
|
|
style: TextStyle(
|
|
overflow: TextOverflow.ellipsis,
|
|
fontSize: 16.0.sp(),
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.grey80,
|
|
),
|
|
),
|
|
SizedBox(height: 8.0.h()),
|
|
SizedBox(
|
|
width: double.infinity,
|
|
child: Text(
|
|
tender.description ?? '',
|
|
textAlign: TextAlign.start,
|
|
maxLines: 4,
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
fontSize: 14.0.sp(),
|
|
fontWeight: FontWeight.w400,
|
|
color: AppColors.grey70,
|
|
),
|
|
),
|
|
),
|
|
const Spacer(),
|
|
const TenderCardProgressBar(),
|
|
SizedBox(height: 15.0.h()),
|
|
|
|
Expanded(
|
|
child: Row(
|
|
children: [
|
|
SvgPicture.asset(AssetsManager.location),
|
|
SizedBox(width: 1.0.w()),
|
|
Text(
|
|
tender.countryCode ?? '',
|
|
style: TextStyle(
|
|
fontSize: 12.0.sp(),
|
|
fontWeight: FontWeight.w400,
|
|
color: AppColors.grey80,
|
|
),
|
|
),
|
|
SizedBox(width: 8.0.w()),
|
|
tender.countryCode != null
|
|
? Flag(countryCode: tender.countryCode!)
|
|
: const Flag(countryCode: ''),
|
|
const Spacer(),
|
|
BaseButton(
|
|
text: HomeStrings.seeMoreButton,
|
|
backgroundColor: AppColors.primary20,
|
|
isEnabled: true,
|
|
width: 100.0.w(),
|
|
height: 40.0.h(),
|
|
textColor: AppColors.mainBlue,
|
|
fontSize: 12.0.sp(),
|
|
onPressed: onTap,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|