import 'package:flutter/material.dart';
import 'package:tm_app/core/theme/colors.dart';
import 'package:tm_app/core/utils/date_utils.dart';
import 'package:tm_app/core/utils/size_config.dart';
import 'package:tm_app/views/detail/strings/tender_details_strings.dart';

import '../../../data/services/model/tender_data/tender_data.dart';

class DeadlineItem extends StatelessWidget {
  final TenderData detail;
  final bool isScreenBig;

  const DeadlineItem({
    required this.detail,

    required this.isScreenBig,
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return isScreenBig
        ? Padding(
          padding: const EdgeInsets.symmetric(vertical: 0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              SizedBox(
                height: 45.0.h(),
                child: Text(
                  detail.title ?? '',
                  style: TextStyle(
                    color: AppColors.grey80,
                    fontWeight: FontWeight.w600,
                    fontSize: 16.0.sp(),
                  ),
                ),
              ),
              IntrinsicHeight(
                child: Row(
                  children: [
                    Expanded(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            TenderDetailsStrings.tenderApprovalText,
                            style: TextStyle(
                              color: AppColors.grey70,
                              fontWeight: FontWeight.w400,
                              fontSize: 14.0.sp(),
                            ),
                          ),
                          SizedBox(height: 4.0.h()),
                          Text(
                            timeConvertor(detail.submissionDeadline!),
                            style: TextStyle(
                              color: AppColors.grey80,
                              fontWeight: FontWeight.w400,
                              fontSize: 14.0.sp(),
                            ),
                          ),
                        ],
                      ),
                    ),
                    VerticalDivider(
                      color: AppColors.grey30,
                      thickness: 1,
                      width: 24,
                    ),
                    Expanded(
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            TenderDetailsStrings.tenderSubmissionText,
                            style: TextStyle(
                              color: AppColors.grey70,
                              fontWeight: FontWeight.w400,
                              fontSize: 14.0.sp(),
                            ),
                          ),
                          SizedBox(height: 4.0.h()),
                          Text(
                            timeConvertor(detail.applicationDeadline!),
                            style: TextStyle(
                              color: AppColors.grey80,
                              fontWeight: FontWeight.w400,
                              fontSize: 14.0.sp(),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
              SizedBox(height: 8.0.h()),
              Divider(color: AppColors.grey20),
            ],
          ),
        )
        : Padding(
          padding: const EdgeInsets.symmetric(vertical: 0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              SizedBox(
                height: 45.0.h(),
                child: Text(
                  detail.title ?? '',
                  style: TextStyle(
                    color: AppColors.grey80,
                    fontWeight: FontWeight.w600,
                    fontSize: 16.0.sp(),
                  ),
                ),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    TenderDetailsStrings.tenderApprovalText,
                    style: TextStyle(
                      color: AppColors.grey70,
                      fontWeight: FontWeight.w400,
                      fontSize: 14.0.sp(),
                    ),
                  ),
                  Text(
                    timeConvertor(detail.submissionDeadline!),
                    style: TextStyle(
                      color: AppColors.grey70,
                      fontWeight: FontWeight.w400,
                      fontSize: 14.0.sp(),
                    ),
                  ),
                ],
              ),
              SizedBox(height: 4.0.h()),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    TenderDetailsStrings.tenderSubmissionText,
                    style: TextStyle(
                      color: AppColors.grey70,
                      fontWeight: FontWeight.w400,
                      fontSize: 14.0.sp(),
                    ),
                  ),
                  Text(
                    timeConvertor(detail.applicationDeadline!),
                    style: TextStyle(
                      color: AppColors.grey70,
                      fontWeight: FontWeight.w400,
                      fontSize: 14.0.sp(),
                    ),
                  ),
                ],
              ),
              SizedBox(height: 8.0.h()),
              Divider(color: AppColors.grey20),
            ],
          ),
        );
  }
}
