import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:gap/gap.dart';
import 'package:tanami_app/core/styles/app_color.dart';

import '../../../../../core/styles/app_images.dart';
import '../../../../../core/styles/app_text.dart';
import '../../../../../core/utils/date_time_formatter/date_time_formatter.dart';
import '../../../../../core/utils/language/localizations_delegate.dart';
import '../../../../../shared/components/text_widget.dart';
import '../../domain/model/closed_io_model.dart';

class InvestClosedDetailsSection extends StatelessWidget {
  final Rows closedIoModel;
  const InvestClosedDetailsSection({super.key, required this.closedIoModel});

  @override
  Widget build(BuildContext context) {
    var localizations = AppLocalizations.of(context);
    return Column(
      children: [
        Container(
          color: AppColor.plainWhite,
          child: Padding(
            padding: const EdgeInsets.only(
              left: 20.0,
              right: 20,
              top: 10,
              bottom: 20,
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    TextWidget().text17W700(
                      closedIoModel.investmentNameEnglish!,
                      clr: AppColor.plainBlack,
                    ),
                    Container(
                      height: 28,
                      padding: const EdgeInsets.symmetric(
                          horizontal: 12, vertical: 6),
                      decoration: ShapeDecoration(
                        color: const Color(0xFFE4F5E9),
                        shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(4)),
                      ),
                      child: Center(
                          child: TextWidget().text12W700(
                        closedIoModel.investmentType!.investmentTypeName!,
                        clr: AppColor.selectedItemColor,
                      )),
                    )
                  ],
                ),
                Gap(10.h),
                Container(
                  padding: const EdgeInsets.symmetric(
                      horizontal: 15.0, vertical: 10.0),
                  decoration: BoxDecoration(
                    color: Colors.white,
                    border: Border.all(color: const Color(0xFFE4F5E9)),
                    borderRadius: BorderRadius.circular(14.0),
                  ),
                  child: Row(
                    mainAxisSize: MainAxisSize.min,
                    mainAxisAlignment: MainAxisAlignment.start,
                    children: [
                      Image.asset(
                        AppImages.portfolioClock,
                        height: 15.h,
                      ),
                      Gap(
                        5.w,
                      ),
                      TextWidget().text12W700(
                        "${localizations.translate(AppText.closedDateText)}: ",
                        clr: AppColor.plainBlack,
                      ),
                      TextWidget().text12W500(
                        DateTimeFormatter()
                            .formatDate(closedIoModel.closingDate!),
                        clr: AppColor.plainBlack,
                      ),
                    ],
                  ),
                ),
                Gap(
                  10.h,
                ),
                TextWidget().text14W400(
                  closedIoModel.descriptionEnglish!,
                  clr: Colors.grey,
                  txtAlign: TextAlign.start,
                  maxLine: 2,
                )
              ],
            ),
          ),
        ),
        Padding(
          padding: const EdgeInsets.only(left: 12.0, right: 12, bottom: 12.0),
          child: Container(
            decoration: BoxDecoration(
                color: const Color(0xFFE4F5E9),
                borderRadius: BorderRadius.circular(22)),
            child: Padding(
              padding:
                  const EdgeInsets.symmetric(horizontal: 20.0, vertical: 16.0),
              child: Column(
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      SizedBox(
                        width: 150.w,
                        child: TextWidget().text14W500(
                          "${localizations.translate(AppText.sponsorNameText)}:",
                          clr: AppColor.portoflioCardTextColor,
                          txtAlign: TextAlign.start,
                        ),
                      ),
                      TextWidget().text14W700(
                        closedIoModel.sponsor!.sponsorName!,
                        clr: AppColor.plainBlack,
                        txtAlign: TextAlign.end,
                      )
                    ],
                  ),
                  SizedBox(
                    height: 8.h,
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      SizedBox(
                        width: 150.w,
                        child: TextWidget().text14W500(
                          "${localizations.translate(AppText.actualReturnToDate)}:",
                          clr: AppColor.portoflioCardTextColor,
                          txtAlign: TextAlign.start,
                        ),
                      ),
                      TextWidget().text14W700(
                        closedIoModel.expectedReturn!,
                        clr: AppColor.plainBlack,
                        txtAlign: TextAlign.end,
                      ),
                    ],
                  ),
                  SizedBox(
                    height: 8.h,
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      SizedBox(
                        width: 150.w,
                        child: TextWidget().text14W500(
                          "${localizations.translate(AppText.holdingPeriodText)}:",
                          clr: AppColor.portoflioCardTextColor,
                          txtAlign: TextAlign.start,
                        ),
                      ),
                      TextWidget().text14W700(
                        closedIoModel.holdingPeriod!,
                        clr: AppColor.plainBlack,
                        txtAlign: TextAlign.end,
                      ),
                    ],
                  ),
                  SizedBox(
                    height: 8.h,
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      TextWidget().text14W500(
                        "${localizations.translate(AppText.expectedExitDate)}:",
                        clr: AppColor.portoflioCardTextColor,
                        txtAlign: TextAlign.start,
                      ),
                      TextWidget().text14W700(
                        DateTimeFormatter()
                            .formatDate(closedIoModel.closingDate!),
                        clr: AppColor.plainBlack,
                        txtAlign: TextAlign.end,
                      ),
                    ],
                  )
                ],
              ),
            ),
          ),
        )
      ],
    );
  }
}
