tenders refactor
This commit is contained in:
@@ -1,94 +0,0 @@
|
||||
class Tender {
|
||||
final String date;
|
||||
final String deadline;
|
||||
final String title;
|
||||
final String description;
|
||||
final String tenderId;
|
||||
final String location;
|
||||
final String country;
|
||||
final double matchPercentage;
|
||||
|
||||
Tender({
|
||||
required this.date,
|
||||
required this.deadline,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.tenderId,
|
||||
required this.location,
|
||||
required this.country,
|
||||
required this.matchPercentage,
|
||||
});
|
||||
|
||||
factory Tender.fromJson(Map<String, dynamic> json) {
|
||||
return Tender(
|
||||
date: json['date'] as String,
|
||||
deadline: json['deadline'] as String,
|
||||
title: json['title'] as String,
|
||||
description: json['description'] as String,
|
||||
tenderId: json['tenderId'] as String,
|
||||
location: json['location'] as String,
|
||||
country: json['country'] as String,
|
||||
matchPercentage: (json['matchPercentage'] as num).toDouble(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'date': date,
|
||||
'deadline': deadline,
|
||||
'title': title,
|
||||
'description': description,
|
||||
'tenderId': tenderId,
|
||||
'location': location,
|
||||
'country': country,
|
||||
'matchPercentage': matchPercentage,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
final List<Tender> sampleTenders = [
|
||||
Tender(
|
||||
date: '2025-05-20',
|
||||
deadline: '2025-06-10',
|
||||
title: 'Digital Services Tender',
|
||||
description:
|
||||
'A tender for digital services and IT infrastructure development. The project involves modernizing existing systems and implementing new digital solutions for improved efficiency.',
|
||||
tenderId: 'KLF 2025/119',
|
||||
location: 'Stockholm',
|
||||
country: 'SE',
|
||||
matchPercentage: 85.0,
|
||||
),
|
||||
Tender(
|
||||
date: '2025-04-15',
|
||||
deadline: '2025-05-01',
|
||||
title: 'Construction Project',
|
||||
description:
|
||||
'Seeking contractors for a large-scale construction project in the city center. Includes both residential and commercial buildings.',
|
||||
tenderId: 'CST 2025/042',
|
||||
location: 'Gothenburg',
|
||||
country: 'SE',
|
||||
matchPercentage: 72.0,
|
||||
),
|
||||
Tender(
|
||||
date: '2025-03-10',
|
||||
deadline: '2025-04-05',
|
||||
title: 'Healthcare Equipment Supply',
|
||||
description:
|
||||
'Supplying medical and healthcare equipment to regional hospitals. Includes installation and maintenance services.',
|
||||
tenderId: 'HLT 2025/301',
|
||||
location: 'Malmö',
|
||||
country: 'SE',
|
||||
matchPercentage: 90.0,
|
||||
),
|
||||
Tender(
|
||||
date: '2025-02-28',
|
||||
deadline: '2025-03-20',
|
||||
title: 'IT Consulting Services',
|
||||
description:
|
||||
'Looking for experienced IT consultants to support digital transformation initiatives for public sector organizations.',
|
||||
tenderId: 'ITC 2025/210',
|
||||
location: 'Uppsala',
|
||||
country: 'SE',
|
||||
matchPercentage: 78.0,
|
||||
),
|
||||
];
|
||||
@@ -8,6 +8,8 @@ import 'package:tm_app/view_models/tenders_view_model.dart';
|
||||
import 'package:tm_app/views/shared/desktop_navigation_widget.dart';
|
||||
import 'package:tm_app/views/tenders/widgets/main_tenders_slider.dart';
|
||||
|
||||
import '../../../core/constants/strings.dart';
|
||||
|
||||
class DesktopTendersPage extends StatefulWidget {
|
||||
const DesktopTendersPage({super.key});
|
||||
|
||||
@@ -91,6 +93,10 @@ class _DesktopTendersPageState extends State<DesktopTendersPage> {
|
||||
if (viewModel.errorMessage != null) {
|
||||
return Center(child: Text(viewModel.errorMessage!));
|
||||
}
|
||||
if (viewModel.tendersResponse?.data?.tenders == null ||
|
||||
viewModel.tendersResponse!.data!.tenders!.isEmpty) {
|
||||
return Center(child: Text(AppStrings.noData));
|
||||
}
|
||||
return SizedBox(
|
||||
width: 740,
|
||||
height: 800,
|
||||
|
||||
@@ -65,6 +65,11 @@ class _MobileTendersPageState extends State<MobileTendersPage> {
|
||||
return Center(child: Text(viewModel.errorMessage!));
|
||||
}
|
||||
|
||||
if (viewModel.tendersResponse?.data?.tenders == null ||
|
||||
viewModel.tendersResponse!.data!.tenders!.isEmpty) {
|
||||
return Center(child: Text(AppStrings.noData));
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 24.0.h()),
|
||||
child: MainTendersSlider(
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:tm_app/views/shared/tablet_navigation_widget.dart';
|
||||
import 'package:tm_app/views/tenders/widgets/main_tenders_slider.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/constants/strings.dart';
|
||||
|
||||
class TabletTendersPage extends StatelessWidget {
|
||||
const TabletTendersPage({super.key});
|
||||
@@ -73,6 +74,10 @@ class TabletTendersPage extends StatelessWidget {
|
||||
if (viewModel.errorMessage != null) {
|
||||
return Center(child: Text(viewModel.errorMessage!));
|
||||
}
|
||||
if (viewModel.tendersResponse?.data?.tenders == null ||
|
||||
viewModel.tendersResponse!.data!.tenders!.isEmpty) {
|
||||
return Center(child: Text(AppStrings.noData));
|
||||
}
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(right: 24.0.w(), top: 128.0.h()),
|
||||
child: MainTendersSlider(
|
||||
|
||||
@@ -154,59 +154,6 @@ class TenderCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// Widget _approvalStatusBadge() {
|
||||
// return Consumer<TendersViewModel>(
|
||||
// builder: (context, viewModel, child) {
|
||||
// final approvalStatus = viewModel.getApprovalStatusForTender(tender.id!);
|
||||
// final statusText = approvalStatus ?? 'Pending';
|
||||
|
||||
// Color statusColor;
|
||||
// switch (approvalStatus) {
|
||||
// case 'approved':
|
||||
// statusColor = AppColors.successColor;
|
||||
// break;
|
||||
// case 'rejected':
|
||||
// statusColor = AppColors.errorColor;
|
||||
// break;
|
||||
// default:
|
||||
// statusColor = AppColors.grey60;
|
||||
// }
|
||||
|
||||
// return Container(
|
||||
// width: double.infinity,
|
||||
// height: 24.0.h(),
|
||||
// padding: EdgeInsets.symmetric(horizontal: 8.0.w()),
|
||||
// decoration: BoxDecoration(
|
||||
// color: AppColors.grey20,
|
||||
// borderRadius: BorderRadius.circular(4),
|
||||
// border: Border.all(color: statusColor),
|
||||
// ),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// 'Approval Status',
|
||||
// style: TextStyle(
|
||||
// color: AppColors.grey80,
|
||||
// fontSize: 14.0.sp(),
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// statusText.toUpperCase(),
|
||||
// style: TextStyle(
|
||||
// color: statusColor,
|
||||
// fontSize: 14.0.sp(),
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
Widget _tenderTitle() {
|
||||
return Text(
|
||||
tender.title ?? '',
|
||||
|
||||
Reference in New Issue
Block a user