import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';

import '../../theme/colors.dart';

class ShowImageButton extends StatefulWidget {
  String icon, title;
  VoidCallback onClick;
  bool isDisabled;

  ShowImageButton({required this.icon, required this.title, required this.onClick, this.isDisabled = false});

  @override
  State<ShowImageButton> createState() => _ShowImageButtonState();
}

class _ShowImageButtonState extends State<ShowImageButton> {
  @override
  Widget build(BuildContext context) {
    return InkWell(
      highlightColor: widget.isDisabled ? Colors.transparent : null, // Semi-transparent blue highlight
      splashColor: widget.isDisabled ? Colors.transparent : null,
      onTap: widget.isDisabled
          ? () {
        if (kDebugMode) print("disabled");
      }
          : widget.onClick,
      child: Container(
        width: double.infinity,
        child: Column(
          children: [
            Container(
              width: double.infinity,
              height: 120,
              child: Card(
                color: widget.isDisabled ? MyColors.primaryColor : MyColors.darkPrimaryColor,
                shape: RoundedRectangleBorder(
                  side: const BorderSide(color: Colors.transparent, width: 1),
                  borderRadius: BorderRadius.circular(8),
                ),
                child: Padding(
                  padding: const EdgeInsets.all(26),
                  child: SvgPicture.asset(
                    widget.icon,
                    color: widget.isDisabled ? MyColors.chipColor : Colors.white,
                  ),
                ),
              ),
            ),
            6.height,
            widget.title.toText(color: widget.isDisabled ? MyColors.chipColor : Colors.black, isBold: true, fontSize: 16),
          ],
        ),
      ),
    );
  }
}
