import 'package:flutter/material.dart';
import 'package:loading_animation_widget/loading_animation_widget.dart';

import '../../app/constant.dart';
import '../../models/work_total_model.dart';

class InformationCard extends StatelessWidget {
  const InformationCard(
      {super.key,
      this.bgColor,
      this.elevation = false,
      required this.data,
      required this.loading});
  final Color? bgColor;
  final bool? elevation;
  final bool loading;
  final WorkTotalModel data;
  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(40),
        color: bgColor ?? Colors.white,
        // border: Border.all(width: 0),
        boxShadow: [
          if (elevation == true)
            BoxShadow(
              color: Colors.grey.shade200,
              offset: Offset(0.0, 1.0), //(x,y)
              blurRadius: 2,
            ),
          if (elevation == false)
            BoxShadow(
              color: Color(0XFF0000000F).withOpacity(0.06),
              offset: Offset(0.0, 2), //(x,y)
              blurRadius: 30,
            ),
        ],
      ),
      height: Constant.getActualY(context: context, y: 112),
      padding: EdgeInsets.symmetric(
          horizontal: Constant.getActualX(context: context, x: 32),
          vertical: Constant.getActualY(context: context, y: 12)),
      child: SizedBox(
        // color: Colors.blue,
        height: Constant.getActualY(context: context, y: 88),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            Column(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                Image.asset(
                    width: Constant.getActualX(context: context, x: 24),
                    height: Constant.getActualX(context: context, x: 24),
                    "assets/icon_home_total_yellow.png"),
                loading
                    ? SizedBox(
                        height: Constant.getActualX(context: context, x: 20),
                        width: Constant.getActualX(context: context, x: 20),
                        child: LoadingAnimationWidget.discreteCircle(
                            color: Constant.primaryBlue, size: 20))
                    : Text(
                        "${data.totalAll}",
                        textAlign: TextAlign.center,
                        overflow: TextOverflow.ellipsis,
                        style: Constant.body3(context: context)
                            .copyWith(fontWeight: FontWeight.w600),
                      ),
                Text(
                  "Total",
                  overflow: TextOverflow.ellipsis,
                  style: Constant.body3(context: context).copyWith(
                      fontWeight: FontWeight.w600,
                      color: Constant.textSecondary),
                )
              ],
            ),
            Column(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: [
                Image.asset(
                  "assets/icon_home_diterima_yellow.png",
                  width: Constant.getActualX(context: context, x: 24),
                  height: Constant.getActualX(context: context, x: 24),
                ),
                loading
                    ? SizedBox(
                        height: Constant.getActualX(context: context, x: 20),
                        width: Constant.getActualX(context: context, x: 20),
                        child: LoadingAnimationWidget.discreteCircle(
                            color: Constant.primaryBlue, size: 20))
                    : Text(
                        "${data.receive}",
                        overflow: TextOverflow.ellipsis,
                        style: Constant.body3(context: context).copyWith(
                          fontWeight: FontWeight.w600,
                        ),
                      ),
                Text(
                  "Diterima",
                  overflow: TextOverflow.ellipsis,
                  style: Constant.body3(context: context).copyWith(
                      fontWeight: FontWeight.w600,
                      color: Constant.textSecondary),
                )
              ],
            ),
            Column(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: [
                Image.asset(
                    width: Constant.getActualX(context: context, x: 24),
                    height: Constant.getActualX(context: context, x: 24),
                    "assets/icon_home_selesai_yellow.png"),
                loading
                    ? SizedBox(
                        height: Constant.getActualX(context: context, x: 20),
                        width: Constant.getActualX(context: context, x: 20),
                        child: LoadingAnimationWidget.discreteCircle(
                            color: Constant.primaryBlue, size: 20))
                    : Text(
                        "${data.done}",
                        overflow: TextOverflow.ellipsis,
                        style: Constant.body3(context: context).copyWith(
                          fontWeight: FontWeight.w600,
                        ),
                      ),
                Text(
                  "Selesai",
                  overflow: TextOverflow.ellipsis,
                  style: Constant.body3(context: context).copyWith(
                      fontWeight: FontWeight.w600,
                      color: Constant.textSecondary),
                )
              ],
            )
          ],
        ),
      ),
    );
  }
}
