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.
doctor_app_flutter/lib/screens/home/home_page_card.dart

56 lines
1.6 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.color,
this.opacity = 0.4,
this.margin})
: super(key: key);
final bool hasBorder;
final String imageName;
final Widget child;
final Function onTap;
final Color color;
final double opacity;
final EdgeInsets margin;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
width: 120,
height: MediaQuery.of(context).orientation == Orientation.portrait
? 100
: 200,
margin: this.margin,
decoration: BoxDecoration(
color: !hasBorder
? color != null
? color
: HexColor('#050705').withOpacity(opacity)
: Colors.white,
borderRadius: BorderRadius.circular(17.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,
),
);
}
}