import 'package:flutter/material.dart';
import 'package:hmg_flutter_template/classes/size_config.dart';
import 'package:hmg_flutter_template/ui/dashboard/widgets/home_page_card.dart';

class HomePatientCard extends StatelessWidget {
  final Color? backgroundColor;
  final IconData? cardIcon;
  final String? cardIconImage;
  final Color? backgroundIconColor;
  final String? text;
  final Color? textColor;
  final VoidCallback? onTap;
  final double iconSize;
  final LinearGradient? gradient;

  HomePatientCard({
    this.backgroundColor,
    this.backgroundIconColor,
    this.cardIcon,
    this.cardIconImage,
    this.text,
    this.textColor,
    this.onTap,
    this.iconSize = 30,
    this.gradient,
  });

  @override
  Widget build(BuildContext context) {
    double width = SizeConfig.heightMultiplier! *
        (SizeConfig.isHeightVeryShort
            ? 16
            : SizeConfig.isHeightLarge
                ? 15
                : 13);
    return HomePageCard(
      color: backgroundColor??Colors.black,
      width: width,
      gradient: gradient??LinearGradient(colors: []),
      margin: EdgeInsets.all(SizeConfig.widthMultiplier! * 1.121),
      child: Container(
        padding: EdgeInsets.all(8),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Expanded(
              child: Stack(
                children: [
                  Container(
                    margin: EdgeInsets.only(top: 18, left: 10),
                    color: Colors.transparent,
                    child: cardIcon != null
                        ? Icon(
                            cardIcon,
                            size: iconSize * 2,
                            color: backgroundIconColor,
                          )
                        : IconButton(
                            icon: Image.asset(
                              'assets/images/patient/ucaf.png',
                              width: iconSize * 2,
                              height: iconSize * 2,
                              fit: BoxFit.fill,
                            ),
                            iconSize: iconSize * 2,
                            color: backgroundIconColor,
                            onPressed: () => null,
                          ),
                  ),
                  Container(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.end,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        cardIcon != null
                            ? Icon(
                                cardIcon,
                                size: SizeConfig.getWidthMultiplier(width: width) * 30,
                                color: textColor,
                              )
                            : Image.asset(
                                cardIconImage!,
                                height: iconSize,
                                width: iconSize,
                              ),
                        SizedBox(
                          height: 4,
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
            Expanded(
              child: Container(
                child: Text(
                  text!,
                  textAlign: TextAlign.start,
                  style: TextStyle(
                    color: textColor,
                    letterSpacing: -0.33,
                    fontWeight: FontWeight.w600,
                    fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width) * (SizeConfig.isHeightVeryShort ? 11 : 10),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
      hasBorder: false,
      onTap: onTap!,
      imageName: '',
    );
  }
}
