import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';

class HealthToolsCard extends StatelessWidget {
  final String label;
  final Color textColor;
  final String svgIcon;
  final double? iconSize;
  final Color? iconColor;

  const HealthToolsCard({
    super.key,
    required this.label,
    required this.textColor,
    required this.svgIcon,
    this.iconSize,
    this.iconColor,
  });

  @override
  Widget build(BuildContext context) {
    final iconS = iconSize ?? 24.w;

    return Container(
      decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
        color: AppColors.whiteColor,
        borderRadius: 20.r,
        hasShadow: false,
      ),
      padding: EdgeInsets.all(12.w),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          // Icon container with white background and border
          Container(
            decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
              color: AppColors.whiteColor,
              borderRadius: 12.r,
              side: BorderSide(
                color: AppColors.borderOnlyColor.withValues(alpha: 0.1),
                width: 1,
              ),
            ),
            height: 48.h,
            width: 48.h,
            child: Center(
              child: Utils.buildSvgWithAssets(
                icon: svgIcon,
                width: iconS,
                height: iconS,
                fit: BoxFit.contain,
                applyThemeColor: false,
                iconColor: iconColor,
              ),
            ),
          ),
          SizedBox(height: 6.h),
          label.toText13(color: textColor, isBold: true, maxLine: 2),
        ],
      ),
    );
  }
}

