This commit is contained in:
efrilm
2025-10-23 20:11:16 +07:00
parent 290360674f
commit e585cf4292
4 changed files with 40 additions and 26 deletions
+32 -20
View File
@@ -54,24 +54,8 @@ class ProductCard extends StatelessWidget {
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8.0)),
child: CachedNetworkImage(
imageUrl: (data.imageUrl ?? "").contains('http')
? data.imageUrl!
: '${Variables.baseUrl}/${data.imageUrl}',
fit: BoxFit.cover,
width: double.infinity,
height: 120,
memCacheHeight: 120,
memCacheWidth: 120,
errorWidget: (context, url, error) {
FirebaseCrashlytics.instance.recordError(
error,
StackTrace.current,
reason:
'Failed to load image from: $url, productId: ${data.id}, productName: ${data.name}',
fatal: false,
);
return Container(
child: data.imageUrl == ""
? Container(
width: double.infinity,
height: 120,
decoration: BoxDecoration(
@@ -81,8 +65,36 @@ class ProductCard extends StatelessWidget {
Icons.image,
color: AppColors.grey,
),
);
}),
)
: CachedNetworkImage(
imageUrl: (data.imageUrl ?? "").contains('http')
? data.imageUrl!
: '${Variables.baseUrl}/${data.imageUrl}',
fit: BoxFit.cover,
width: double.infinity,
height: 120,
memCacheHeight: 120,
memCacheWidth: 120,
errorWidget: (context, url, error) {
FirebaseCrashlytics.instance.recordError(
error,
StackTrace.current,
reason:
'Failed to load image from: $url, productId: ${data.id}, productName: ${data.name}, dataUrl: ${data.imageUrl}',
fatal: false,
);
return Container(
width: double.infinity,
height: 120,
decoration: BoxDecoration(
color: AppColors.disabled.withOpacity(0.4),
),
child: const Icon(
Icons.image,
color: AppColors.grey,
),
);
}),
),
const Spacer(),
Text(