65 lines
2.0 KiB
Dart
65 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:tm_app/core/constants/strings.dart';
|
|
import 'package:tm_app/data/services/model/tender_data/tender_data.dart';
|
|
import 'package:tm_app/views/detail/widgets/deadline_item.dart';
|
|
import 'package:tm_app/views/detail/widgets/info_item.dart';
|
|
|
|
class TenderDetailInfoSection extends StatelessWidget {
|
|
final bool isScreenBig;
|
|
final TenderData detail;
|
|
|
|
const TenderDetailInfoSection({
|
|
required this.isScreenBig,
|
|
required this.detail,
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
InfoItem(title: AppStrings.tenderIdLabel, value: detail.tenderId ?? ''),
|
|
DeadlineItem(
|
|
title: AppStrings.tenderDeadlineLabel,
|
|
approvalText: AppStrings.tenderApprovalText,
|
|
approvalDate: unixToDate(detail.submissionDeadline),
|
|
submissionText: AppStrings.tenderSubmissionText,
|
|
submissionDate: unixToDate(detail.applicationDeadline),
|
|
isScreenBig: isScreenBig,
|
|
),
|
|
InfoItem(
|
|
title: AppStrings.tenderClientLabel,
|
|
value: detail.buyerOrganization!.name ?? '',
|
|
),
|
|
InfoItem(
|
|
title: AppStrings.estimatedValue,
|
|
value: '${detail.estimatedValue} ${detail.currency ?? ''}',
|
|
),
|
|
InfoItem(
|
|
title: AppStrings.duration,
|
|
value: '${detail.duration} ${detail.durationUnit ?? ''}',
|
|
),
|
|
InfoItem(
|
|
title: AppStrings.tenderReferenceNumberLabel,
|
|
value: detail.noticePublicationId ?? '',
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
String unixToDate(int? unixTimestamp, {String format = 'yyyy-MM-dd'}) {
|
|
if (unixTimestamp == null) {
|
|
return '';
|
|
}
|
|
|
|
// Convert seconds to milliseconds if needed
|
|
int timestampInMs =
|
|
unixTimestamp > 1000000000000 ? unixTimestamp : unixTimestamp * 1000;
|
|
|
|
final DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestampInMs);
|
|
return DateFormat(format).format(dateTime);
|
|
}
|