import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:gap/gap.dart';
import 'package:tanami_app/features/MainScreens/Portfolio/domain/model/portfolio_model.dart';

import '../../../../../core/routes/route_name.dart';
import '../../../../../core/routes/routes.dart';
import '../../../../../core/styles/app_color.dart';
import '../../../../../core/styles/app_images.dart';
import '../../../../../core/styles/app_text.dart';
import '../../../../../shared/components/text_widget.dart';

class PendingCard extends StatelessWidget {
  final PortfolioModel portfolioModel;
  const PendingCard({
    super.key,
    required this.portfolioModel,
  });

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(10.0),
      child: GestureDetector(
        onTap: () {
          goRouter.pushNamed(RouteName.porfolioDetails);
        },
        child: Container(
          decoration: BoxDecoration(
            color: AppColor.plainWhite,
            borderRadius: const BorderRadius.all(Radius.circular(20.0)),
            boxShadow: [
              BoxShadow(
                color: AppColor.plainBlack.withOpacity(0.15),
                spreadRadius: 2,
                blurRadius: 10,
                offset: const Offset(0, 3), // changes position of shadow
              ),
            ],
          ),
          child: Column(
            children: [
              Padding(
                padding: const EdgeInsets.symmetric(
                    horizontal: 20.0, vertical: 16.0),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: [
                            Image.asset(
                              AppImages.portfolioClock,
                              height: 25.sp,
                            ),
                            Gap(
                              5.w,
                            ),
                            TextWidget().text12W500(
                              portfolioModel.date,
                              clr: AppColor.primaryColor2,
                            ),
                          ],
                        ),
                        Container(
                          padding: const EdgeInsets.symmetric(
                            horizontal: 15,
                            vertical: 3,
                          ),
                          decoration: BoxDecoration(
                            color: AppColor.stausBgColor,
                            borderRadius: BorderRadius.circular(15),
                          ),
                          child: TextWidget().text14W700(
                            portfolioModel.status,
                            clr: AppColor.plainWhite,
                          ),
                        ),
                      ],
                    ),
                    Gap(
                      8.h,
                    ),
                    TextWidget().text17W700(
                      portfolioModel.title,
                      clr: AppColor.plainBlack,
                    ),
                  ],
                ),
              ),
              Container(
                width: 1.sw,
                decoration: const BoxDecoration(
                  image: DecorationImage(
                      image: AssetImage(AppImages.portfolioCardBg),
                      fit: BoxFit.cover),
                  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: [
                          TextWidget().text14W500(
                            AppText.investmentamount,
                            clr: AppColor.portoflioCardTextColor,
                          ),
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.end,
                            children: [
                              TextWidget().text14W700(
                                portfolioModel.investmentAmountSAR,
                                clr: AppColor.plainBlack,
                              ),
                              TextWidget().text11W400(
                                ' \$ ${portfolioModel.investmentAmountUSD}',
                                clr: AppColor.plainBlack,
                              ),
                            ],
                          )
                        ],
                      ),
                      Gap(
                        8.h,
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          TextWidget().text14W500(
                            AppText.currentval,
                            clr: AppColor.portoflioCardTextColor,
                          ),
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.end,
                            children: [
                              TextWidget().text14W700(
                                portfolioModel.currentValuationSAR,
                                clr: AppColor.plainBlack,
                              ),
                              TextWidget().text11W400(
                                ' \$ ${portfolioModel.currentValuationUSD}',
                                clr: AppColor.plainBlack,
                              ),
                            ],
                          )
                        ],
                      ),
                      SizedBox(
                        height: 8.h,
                      ),
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          TextWidget().text14W500(
                            AppText.totalreturn,
                            clr: const Color(0xFF535353),
                          ),
                          TextWidget().text14W700(
                            '+ ${portfolioModel.totalReturnPercentage}',
                            clr: const Color(0xFF066123),
                          ),
                        ],
                      )
                    ],
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
