import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class HomePageCard extends StatelessWidget { const HomePageCard({this.hasBorder = false, this.imageName, @required this.child, this.onTap, Key key, this.width, this.height, this.color, this.opacity = 0.4}) : super(key: key); final bool hasBorder; final String imageName; final Widget child; final Function onTap; final double width; final double height; final Color color; final double opacity; @override Widget build(BuildContext context) { return InkWell( onTap: onTap, child: Container( width: width != null ? width : MediaQuery.of(context).size.width * 0.29, height: height != null ? height : MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.height * 0.18 : MediaQuery.of(context).size.height * 0.36, decoration: BoxDecoration( color: !hasBorder ? color != null ? color : HexColor('#050705').withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(15.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: Center( child: child, ), ), ); } getDashboardWidget() {} }