fixed logout at refresh failed

This commit is contained in:
amirrezaghabeli
2026-04-16 16:36:55 +03:30
parent 41bba5d32c
commit cc0032b21d
12 changed files with 475 additions and 344 deletions
@@ -14,161 +14,169 @@ import '../../shared/flag.dart';
class LikedListItem extends StatelessWidget {
const LikedListItem({
required this.tender,
required this.onTap,
this.isDesktop = false,
super.key,
});
final TenderData tender;
final bool isDesktop;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
final viewModel = context.read<LikedTendersViewModel>();
return Container(
decoration: BoxDecoration(
color: AppColors.cardBackground,
borderRadius: BorderRadius.circular(4),
border: Border.all(color: AppColors.grey30),
),
width: double.infinity,
height: 250.0.h(),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0.w(), vertical: 16.0.h()),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 10.0.h()),
isDesktop
? Row(
children: [
Expanded(
child: 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!),
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.grey80,
),
),
],
),
),
),
SizedBox(width: 8.0.w()),
InkWell(
child: SvgPicture.asset(
AssetsManager.trash,
width: 32.0.w(),
height: 32.0.h(),
),
onTap: () {
if (tender.id != null) {
viewModel.removeTenderById(tender.id!);
}
},
),
],
)
: 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,
return InkWell(
onTap: onTap,
child: Container(
decoration: BoxDecoration(
color: AppColors.cardBackground,
borderRadius: BorderRadius.circular(4),
border: Border.all(color: AppColors.grey30),
),
width: double.infinity,
height: 250.0.h(),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.0.w(),
vertical: 16.0.h(),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 10.0.h()),
isDesktop
? Row(
children: [
Text(
'${HomeStrings.tenderDeadline} :',
style: TextStyle(
fontSize: 15.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.textBlue,
Expanded(
child: 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!),
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.grey80,
),
),
],
),
),
),
Text(
timeConvertor(tender.tenderDeadline!),
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w500,
color: AppColors.grey80,
SizedBox(width: 8.0.w()),
InkWell(
child: SvgPicture.asset(
AssetsManager.trash,
width: 32.0.w(),
height: 32.0.h(),
),
onTap: () {
if (tender.id != null) {
viewModel.removeTenderById(tender.id!);
}
},
),
],
)
: 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!),
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.left,
maxLines: 4,
overflow: TextOverflow.ellipsis,
SizedBox(height: 12.0.h()),
Text(
tender.title!,
style: TextStyle(
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey70,
overflow: TextOverflow.ellipsis,
fontSize: 16.0.sp(),
fontWeight: FontWeight.w600,
color: AppColors.grey80,
),
),
),
const Spacer(),
Row(
children: [
SvgPicture.asset(AssetsManager.location),
SizedBox(width: 1.0.w()),
Text(
tender.countryCode!,
SizedBox(height: 8.0.h()),
SizedBox(
width: double.infinity,
child: Text(
tender.description!,
textAlign: TextAlign.left,
maxLines: 4,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.0.sp(),
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
color: AppColors.grey80,
color: AppColors.grey70,
),
),
SizedBox(width: 8.0.w()),
tender.countryCode != null
? Flag(countryCode: tender.countryCode!)
: const Flag(countryCode: ''),
const Spacer(),
),
const Spacer(),
SizedBox(width: 30.0.w()),
],
),
],
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(),
SizedBox(width: 30.0.w()),
],
),
],
),
),
),
);