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_text.dart';
import '../../../../../shared/components/text_widget.dart';

class InvestDetailDetailsSection extends StatelessWidget {
  final String type;
  const InvestDetailDetailsSection({super.key, required this.type});

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
          color: AppColor.plainWhite,
          child: Padding(
            padding: const EdgeInsets.all(20.0),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                TextWidget().text17W700(
                  'Multi Family Residental',
                  clr: AppColor.plainBlack,
                ),
                Gap(
                  10.h,
                ),
                TextWidget()
                    .text22W900("SAR 1,478,000", clr: AppColor.investTextColor),
                const Gap(8.0),
                LinearProgressIndicator(
                  value: type == "closed" ? 1 : 0.6,
                  borderRadius: BorderRadius.circular(2),
                  minHeight: 8.0,
                  backgroundColor: AppColor.txtBorderColor,
                  valueColor: const AlwaysStoppedAnimation<Color>(
                      AppColor.investTextColor),
                ),
                const Gap(8.0),
                TextWidget().text11W700(
                    type == "closed"
                        ? "100% ${AppText.fundedText}"
                        : "60% ${AppText.fundedText}",
                    clr: AppColor.portoflioCardTextColor),
                const Gap(8.0),
                TextWidget().text14W400(
                  'Forem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vulputate libero et velit interdum, ac aliquet odio mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur tempus urna at turpis condimentum lobortis.',
                  clr: Colors.grey,
                  txtAlign: TextAlign.start,
                )
              ],
            ),
          ),
        ),
        Container(
          decoration: const BoxDecoration(
            color: AppColor.portfolioCardBgColor,
            borderRadius: BorderRadius.only(
              bottomLeft: Radius.circular(20.0),
              bottomRight: Radius.circular(20.0),
            ),
          ),
          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(
                        "${AppText.sponsorNameText}:",
                        clr: AppColor.portoflioCardTextColor,
                        txtAlign: TextAlign.start,
                      ),
                    ),
                    TextWidget().text14W700(
                      'Silverlake',
                      clr: AppColor.plainBlack,
                      txtAlign: TextAlign.end,
                    )
                  ],
                ),
                SizedBox(
                  height: 8.h,
                ),
                type == "closed"
                    ? Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          SizedBox(
                            width: 200.w,
                            child: TextWidget().text14W500(
                              "${AppText.originalEstimatedReturnText}:",
                              clr: AppColor.portoflioCardTextColor,
                              txtAlign: TextAlign.start,
                            ),
                          ),
                          TextWidget().text14W700(
                            '20.0%',
                            clr: AppColor.plainBlack,
                            txtAlign: TextAlign.end,
                          ),
                        ],
                      )
                    : Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          SizedBox(
                            width: 150.w,
                            child: TextWidget().text14W500(
                              "${AppText.estimatedReturnText}:",
                              clr: AppColor.portoflioCardTextColor,
                              txtAlign: TextAlign.start,
                            ),
                          ),
                          TextWidget().text14W700(
                            '20.0%',
                            clr: AppColor.plainBlack,
                            txtAlign: TextAlign.end,
                          ),
                        ],
                      ),
                type == "closed"
                    ? Column(
                        children: [
                          SizedBox(
                            height: 8.h,
                          ),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              SizedBox(
                                width: 150.w,
                                child: TextWidget().text14W500(
                                  "${AppText.actualEstimatedReturnText}:",
                                  clr: AppColor.portoflioCardTextColor,
                                  txtAlign: TextAlign.start,
                                ),
                              ),
                              TextWidget().text14W700(
                                '22.5%',
                                clr: AppColor.plainBlack,
                                txtAlign: TextAlign.end,
                              ),
                            ],
                          ),
                          SizedBox(
                            height: 8.h,
                          ),
                        ],
                      )
                    : const SizedBox(),
                SizedBox(
                  height: type == "closed" ? 0 : 8.h,
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    SizedBox(
                      width: 150.w,
                      child: TextWidget().text14W500(
                        "${AppText.holdingPeriodText}:",
                        clr: AppColor.portoflioCardTextColor,
                        txtAlign: TextAlign.start,
                      ),
                    ),
                    TextWidget().text14W700(
                      '24 Months',
                      clr: AppColor.plainBlack,
                      txtAlign: TextAlign.end,
                    ),
                  ],
                ),
                SizedBox(
                  height: 8.h,
                ),
                type == "closed"
                    ? Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          TextWidget().text14W500(
                            "${AppText.payoutDateText}:",
                            clr: AppColor.portoflioCardTextColor,
                            txtAlign: TextAlign.start,
                          ),
                          TextWidget().text14W700(
                            'August 1, 2027',
                            clr: AppColor.plainBlack,
                            txtAlign: TextAlign.end,
                          ),
                        ],
                      )
                    : Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          TextWidget().text14W500(
                            "${AppText.minimumInvestmentText}:",
                            clr: AppColor.portoflioCardTextColor,
                            txtAlign: TextAlign.start,
                          ),
                          TextWidget().text14W700(
                            'SAR 1,000',
                            clr: AppColor.plainBlack,
                            txtAlign: TextAlign.end,
                          ),
                        ],
                      )
              ],
            ),
          ),
        )
      ],
    );
  }
}
