Files
tm_app/lib/views/detail/widgets/tender_detail_header.dart
AmirReza Jamali 984f2e5139
continuous-integration/drone/push Build is passing
refactor: use GET tenders/recommend and improve tender title UX
Load the Recommended tab from GET /api/v1/tenders/recommend instead of the
AI POST flow with 503 fallback. Fix notification pagination offset, make
tender titles selectable across list and detail views, and ignore .cursor.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 12:23:53 +03:30

153 lines
4.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/price_extension.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
import 'package:tm_app/views/detail/widgets/tender_detail_info_section.dart';
import '../../../core/constants/assets.dart';
import '../../shared/flag.dart';
import '../strings/tender_details_strings.dart';
class TenderDetailHeader extends StatelessWidget {
final bool isScreenBig;
final TenderData detail;
const TenderDetailHeader({
required this.isScreenBig,
required this.detail,
super.key,
});
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 16.0.w(), vertical: 16.0.h()),
decoration: BoxDecoration(
color: AppColors.backgroundColor,
borderRadius: BorderRadius.circular(12),
border: Border.all(width: 0.5, color: AppColors.grey50),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_titleText(),
SizedBox(height: 4.0.h()),
_nameText(),
SizedBox(height: 4.0.h()),
_idText(),
SizedBox(height: 16.0.h()),
_locationBudgetRow(),
SizedBox(height: 24.0.h()),
Divider(color: AppColors.grey20),
TenderDetailInfoSection(isScreenBig: isScreenBig, detail: detail),
SizedBox(height: 24.0.h()),
_overViewTitle(),
SizedBox(height: 12.0.h()),
_descriptionText(),
],
),
);
}
Widget _descriptionText() {
return Text(
detail.description ?? '',
style: TextStyle(
color: AppColors.grey70,
fontSize: 16.0.sp(),
fontWeight: FontWeight.w400,
),
);
}
Widget _overViewTitle() {
return Text(
'Overview',
style: TextStyle(
color: AppColors.grey80,
fontSize: 16.0.sp(),
fontWeight: FontWeight.w600,
),
);
}
Widget _locationBudgetRow() {
return Row(
children: [
SvgPicture.asset(
AssetsManager.location,
height: 20.0.h(),
width: 20.0.w(),
),
SizedBox(width: 4.0.w()),
Text(
detail.countryCode ?? '',
style: TextStyle(
color: AppColors.grey70,
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
),
),
SizedBox(width: 8.0.w()),
detail.countryCode != null
? Flag(countryCode: detail.countryCode!)
: const Flag(countryCode: ''),
const Spacer(),
Visibility(
visible: detail.estimatedValue != null && detail.estimatedValue != 0,
child: Container(
height: 32.0.h(),
padding: EdgeInsets.symmetric(horizontal: 16.0.w()),
decoration: BoxDecoration(
color: AppColors.grey30,
borderRadius: BorderRadius.circular(8),
),
alignment: Alignment.center,
child: Text(
'${detail.estimatedValue?.formattedPrice} ${detail.currency ?? ''}',
style: TextStyle(
color: AppColors.grey60,
fontSize: 16.0.sp(),
fontWeight: FontWeight.w600,
),
),
),
),
],
);
}
Widget _idText() {
return Text(
'${TenderDetailsStrings.tenderIdLabel}: ${detail.tenderId}',
style: TextStyle(
color: AppColors.grey80,
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
),
);
}
Widget _nameText() {
return Text(
detail.buyerOrganization?.name ?? '',
style: TextStyle(
color: AppColors.grey80,
fontSize: 14.0.sp(),
fontWeight: FontWeight.w400,
),
);
}
Widget _titleText() => SelectableText(
detail.title ?? '',
style: TextStyle(
color: AppColors.grey80,
fontWeight: FontWeight.w600,
fontSize: 18.0.sp(),
),
);
}