import 'package:flutter/material.dart';

class CustomIcon extends StatelessWidget {
  final String iconPath;
  final double? size;
  final Color? iconColor;
  final double opacity;

  const CustomIcon({
    super.key,
    required this.iconPath,
    this.size = 64,
    this.iconColor,
    this.opacity = 1.0,
  });

  @override
  Widget build(BuildContext context) {
    return Opacity(
      opacity: opacity,
      child: SizedBox(
        width: size ?? 64,
        height: size ?? 64,
        child: Stack(
          alignment: Alignment.center,
          children: [
            // Background Border (Always 000 for Battle/Default)
            SizedBox.expand(
              child: Image.asset(
                'assets/images/icons/borders/border_000.png',
                fit: BoxFit.contain,
                filterQuality: FilterQuality.high,
              ),
            ),
            // Inner Icon
            FractionallySizedBox(
              widthFactor: 0.6,
              heightFactor: 0.6,
              child: Image.asset(
                iconPath,
                fit: BoxFit.contain,
                filterQuality: FilterQuality.high,
                color: iconColor,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
