import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

class CollectionContainer extends StatelessWidget {
  final String? label;
  final String? imagesrc;
  final String? imageSvg;
  final double? width;
  final double? height;
  final VoidCallback onTapAc;
  final Color? textColor;
  const CollectionContainer({
    super.key,
    this.label,
    this.imagesrc,
    this.width,
    this.height,
    required this.onTapAc,
    this.textColor,
    this.imageSvg,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width ?? 130,
      height: height ?? 150,
      decoration: BoxDecoration(
        // color: const Color.fromARGB(26, 24, 24, 180),
        color: Colors.grey.withOpacity(0),
        borderRadius: BorderRadius.circular(10),
        // boxShadow: [
        //   BoxShadow(
        //     // color: Colors.grey.withOpacity(1),
        //     spreadRadius: 1,
        //     blurRadius: 5,
        //     offset: Offset(0, 3), // Changes position of shadow
        //   ),
        // ],
      ),
      child: GestureDetector(
        onTap: onTapAc,
        child: Card(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(10.0),
          ),
          elevation: 5,
          color: const Color.fromARGB(255, 255, 255, 255).withOpacity(0.5),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              ClipRRect(
                borderRadius: BorderRadius.circular(12),
                child:
                    imageSvg != null && imageSvg!.isNotEmpty
                        ? SvgPicture.asset(
                          imageSvg!,
                          width: 60,
                          height: 60,
                          colorFilter: const ColorFilter.mode(
                            Colors.white,
                            BlendMode.srcIn,
                          ),
                        )
                        : imagesrc != null && imagesrc!.isNotEmpty
                        ? Image.asset(
                          imagesrc!,
                          width: 60,
                          // height: 60,
                          fit: BoxFit.cover,
                        )
                        : const SizedBox(
                          width: 60,
                          height: 60,
                          child: Center(
                            child: Icon(
                              Icons.image_not_supported,
                              color: Colors.white,
                            ),
                          ),
                        ),
              ),
              SizedBox(height: 8),
              Positioned(
                bottom: 0,
                child: Container(
                  // color: Colors.amber,
                  child: Text(
                    label ?? '',
                    style: TextStyle(
                      fontSize: 14,
                      fontWeight: FontWeight.bold,
                      color: textColor,
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
