2022-09-05 04:32:36 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class CustomCard extends StatelessWidget {
|
2023-01-30 13:35:06 +01:00
|
|
|
const CustomCard({
|
2023-11-11 13:07:32 +01:00
|
|
|
super.key,
|
2023-01-30 13:35:06 +01:00
|
|
|
this.isFilled = true,
|
|
|
|
required this.child,
|
|
|
|
this.onTap,
|
|
|
|
this.padding,
|
|
|
|
this.backgroundColor,
|
2023-11-11 13:07:32 +01:00
|
|
|
});
|
2022-09-05 04:32:36 +02:00
|
|
|
final bool isFilled;
|
|
|
|
final Widget child;
|
2022-09-19 18:55:44 +02:00
|
|
|
final Function()? onTap;
|
|
|
|
final EdgeInsetsGeometry? padding;
|
2022-11-01 10:56:15 +01:00
|
|
|
final Color? backgroundColor;
|
2022-09-05 04:32:36 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-09-19 18:55:44 +02:00
|
|
|
return Material(
|
|
|
|
type: isFilled ? MaterialType.card : MaterialType.transparency,
|
|
|
|
color: isFilled
|
2022-11-01 10:56:15 +01:00
|
|
|
? backgroundColor?.withOpacity(0.4) ??
|
|
|
|
Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
|
|
|
|
: backgroundColor ?? Colors.transparent,
|
2022-09-19 18:55:44 +02:00
|
|
|
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
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|