import '../../../../food_delivery_client.dart';

class WCategoryItem extends StatelessWidget {
  const WCategoryItem({
    super.key,
    required this.onTap,
    this.text,
    this.imgUrl,
    this.child,
  });

  final VoidCallback onTap;
  final String? text;
  final String? imgUrl;
  final Widget? child;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        InkWell(
          onTap: onTap,
          borderRadius: AppUtils.kBorderRadius10,
          child: Ink(
            decoration: BoxDecoration(
              borderRadius: AppUtils.kBorderRadius10,
              color: AppColors.cE6E6E6.newWithOpacity(.4),
            ),
            child: SizedBox(
              height: 55,
              width: 55,
              child: child ?? Image.asset(imgUrl!, fit: BoxFit.cover),
            ).paddingSymmetric(vertical: 8, horizontal: 12),
          ),
        ),
        3.verticalSpace,
        if (text != null)
          Text(
            text!,
            maxLines: 2,
            style: AppTextStyles.size14Medium,
            textAlign: TextAlign.center,
          ),
      ],
    );
  }
}
