import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';

class CardIcon extends StatelessWidget {
  const CardIcon({
    super.key,
    required this.title,
    required this.icon,
    this.onTap,
    this.titleColor = AppColor.blueNormal,
    this.titleStyle,
    this.borderColor = AppColor.blueNormal,
    this.backgroundColor = Colors.white,
    this.borderRadius = 8,
    this.width = 110,
    this.height = 110,
    this.borderWidth = 1,
  });

  final String title;
  final String icon;
  final VoidCallback? onTap;
  final Color titleColor;
  final TextStyle? titleStyle;

  final Color borderColor;
  final Color backgroundColor;
  final double borderRadius;
  final double borderWidth;

  final double width;
  final double height;

  @override
  Widget build(BuildContext context) {
    return Container(
      clipBehavior: Clip.hardEdge,
      padding: EdgeInsets.fromLTRB(17.w, 10.h, 17.w, 8.h),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(borderRadius.r),
        color: backgroundColor,
        border: Border.all(color: borderColor, width: borderWidth.w),
      ),
      child: InkWell(
        onTap: onTap,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Expanded(child: SvgGenImage(icon).svg(fit: BoxFit.fill)),
            SizedBox(height: 10.h),
            Text(
              title,
              textAlign: TextAlign.center,
              style: titleStyle ?? AppFonts.yekan16Bold.copyWith(color: titleColor, height: 1.20),
            ),
          ],
        ),
      ),
    );
  }
}
