You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.9 KiB
Dart
66 lines
1.9 KiB
Dart
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,
|
|
this.margin})
|
|
: 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;
|
|
final EdgeInsets margin;
|
|
@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,
|
|
margin: this.margin,
|
|
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() {}
|
|
}
|