import 'package:flutter/material.dart';

class HomePageCard extends StatelessWidget {
  const HomePageCard(
      {this.hasBorder = false,
      this.imageName,
      this.child,
      this.onTap,
      Key? key,
      this.color,
      this.opacity = 0.4,
      this.margin,
      this.width,
      this.gradient})
      : super(key: key);
  final bool hasBorder;
  final String? imageName;
  final Widget? child;
  final GestureTapCallback? onTap;
  final Color? color;
  final double? opacity;
  final double? width;
  final EdgeInsets? margin;
  final LinearGradient? gradient;

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      child: Container(
        width: width,
        margin: this.margin,
        decoration: BoxDecoration(
          gradient: gradient,
          borderRadius: BorderRadius.circular(20.0),
          border: hasBorder
              ? Border.all(width: 1.0, color: const Color(0xffcccccc))
              : Border.all(width: 0.0, color: Colors.transparent),
          image: imageName != null
              ? DecorationImage(
                  image: AssetImage('assets/images/dashboard/$imageName'),
                  fit: BoxFit.cover,
                  colorFilter: new ColorFilter.mode(
                      Colors.black.withOpacity(0.2), BlendMode.dstIn),
                )
              : null,
        ),
        child: child,
      ),
    );
  }
}
