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';

class MedicalFileCard extends StatelessWidget {
  final String label;
  final Color textColor;
  final Color backgroundColor;
  final String svgIcon;
  final double? iconSize;
  final bool isLargeText;
  final bool isLocked;
  final Color? iconColor;

  const MedicalFileCard({
    super.key,
    required this.label,
    required this.textColor,
    required this.backgroundColor,
    this.svgIcon = "",
    this.iconSize,
    this.isLargeText = false,
    this.isLocked = false,
    this.iconColor,
  });

  @override
  Widget build(BuildContext context) {
    final iconS = iconSize ?? 30.w;
    return Container(
      decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: backgroundColor, borderRadius: 20.r, hasShadow: false),
      padding: EdgeInsets.all(12.w),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.center,
        mainAxisSize: MainAxisSize.min,
        children: [
          Opacity(
            opacity: isLocked ? 0.4 : 1.0,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Utils.buildSvgWithAssets(
                  icon: svgIcon,
                  width: iconS,
                  height: iconS,
                  fit: BoxFit.contain,
                  applyThemeColor: false,
                  iconColor: iconColor,
                ),
                SizedBox(height: 8.h),
                isLargeText ? label.toText13(color: textColor, isBold: true, maxLine: 2) : label.toText11(color: textColor, isBold: true, maxLine: 2),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
