Show placeholder for broken activity images

When an activity image fails to load, display a placeholder with a "broken image" icon instead of the default error widget. This provides better visual feedback to the user.
pull/2769/head
NiazSagor 6 days ago
parent 344740a22c
commit 1d64d6990d

@ -30,6 +30,7 @@ class ActivityEntry extends StatelessWidget {
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: CachedNetworkImage(
errorWidget: (context, url, error) => _ActivityErrorPlaceholder(),
imageUrl: activity.imageUrl,
height: 80,
width: 80,
@ -66,3 +67,23 @@ class ActivityEntry extends StatelessWidget {
);
}
}
class _ActivityErrorPlaceholder extends StatelessWidget {
const _ActivityErrorPlaceholder({super.key});
@override
Widget build(BuildContext context) {
return Container(
width: 80,
height: 80,
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(8),
),
child: Icon(
Icons.broken_image_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
);
}
}

Loading…
Cancel
Save