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