chore : change cardIcon widget

This commit is contained in:
2025-09-08 10:17:56 +03:30
parent 5e420440b5
commit e6930e3037

View File

@@ -5,9 +5,12 @@ class CardIcon extends StatelessWidget {
const CardIcon({
super.key,
required this.title,
required this.icon,
this.svgIcon,
this.vecIcon,
this.onTap,
this.titleColor = AppColor.blueNormal,
this.spacing = 20,
this.titleStyle,
this.borderColor = AppColor.blueNormal,
this.backgroundColor = Colors.white,
@@ -15,10 +18,16 @@ class CardIcon extends StatelessWidget {
this.width = 110,
this.height = 110,
this.borderWidth = 1,
});
this.iconWidth = 48,
this.iconHeight = 48,
this.iconColor = AppColor.blueNormal,
}) : assert((svgIcon != null) || (vecIcon != null), 'Either svgIcon or vecIcon must be provided');
final String title;
final String icon;
final int spacing;
final String? svgIcon;
final String? vecIcon;
final VoidCallback? onTap;
final Color titleColor;
final TextStyle? titleStyle;
@@ -30,10 +39,16 @@ class CardIcon extends StatelessWidget {
final double width;
final double height;
//icon
final double iconWidth;
final double iconHeight;
final Color iconColor ;
@override
Widget build(BuildContext context) {
return Container(
width: width.w,
height: height.h,
clipBehavior: Clip.hardEdge,
padding: EdgeInsets.fromLTRB(17.w, 10.h, 17.w, 8.h),
decoration: BoxDecoration(
@@ -45,9 +60,21 @@ class CardIcon extends StatelessWidget {
onTap: onTap,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: spacing.toDouble(),
children: [
Expanded(child: SvgGenImage(icon).svg(fit: BoxFit.fill)),
SizedBox(height: 10.h),
svgIcon != null
? SvgGenImage(svgIcon!).svg(
fit: BoxFit.cover,
width: iconWidth.w,
height: iconHeight.h,
colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn),
)
: SvgGenImage.vec(vecIcon!).svg(
fit: BoxFit.fill,
width: iconWidth.w,
height: iconHeight.h,
colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn),
),
Text(
title,
textAlign: TextAlign.center,