2022-09-05 04:32:36 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class CustomCard extends StatelessWidget {
|
|
|
|
final bool isFilled;
|
|
|
|
final Widget child;
|
2022-09-19 18:55:44 +02:00
|
|
|
final Function()? onTap;
|
|
|
|
final EdgeInsetsGeometry? padding;
|
2022-09-05 04:32:36 +02:00
|
|
|
|
|
|
|
const CustomCard({
|
|
|
|
Key? key,
|
|
|
|
this.isFilled = true,
|
|
|
|
required this.child,
|
2022-09-19 18:55:44 +02:00
|
|
|
this.onTap,
|
|
|
|
this.padding,
|
2022-09-05 04:32:36 +02:00
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-09-19 18:55:44 +02:00
|
|
|
return Material(
|
|
|
|
type: isFilled ? MaterialType.card : MaterialType.transparency,
|
|
|
|
color: isFilled
|
|
|
|
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
|
|
|
|
: Colors.transparent,
|
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
|
child: InkWell(
|
|
|
|
onTap: onTap,
|
2022-09-05 04:32:36 +02:00
|
|
|
borderRadius: BorderRadius.circular(16),
|
2022-09-19 18:55:44 +02:00
|
|
|
child: Padding(
|
|
|
|
padding: padding ?? const EdgeInsets.all(20.0),
|
|
|
|
child: child,
|
|
|
|
),
|
2022-09-05 04:32:36 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|