import 'package:didvan/views/widgets/ink_wrapper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class DidvanIconButton extends StatelessWidget {
  final dynamic icon;
  final Color? color;
  final Color? backgroundColor;
  final double? size;
  final double? gestureSize;
  final VoidCallback onPressed;
  final bool isSvg;

  const DidvanIconButton({
    Key? key,
    required this.icon,
    required this.onPressed,
    this.color,
    this.size,
    this.gestureSize,
    this.backgroundColor,
    this.isSvg = false,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWrapper(
      onPressed: onPressed,
      borderRadius: BorderRadius.circular(200),
      child: Container(
        decoration: BoxDecoration(
          color: backgroundColor,
          shape: BoxShape.circle,
        ),
        height: gestureSize ?? 48,
        width: gestureSize ?? 48,
        child: Center(
          child: isSvg
              ? SvgPicture.asset(
                  icon as String,
                  width: size,
                  height: size,
                  colorFilter: color != null
                      ? ColorFilter.mode(color!, BlendMode.srcIn)
                      : null,
                )
              : Icon(
                  icon as IconData,
                  size: size,
                  color: color,
                ),
        ),
      ),
    );
  }
}
