Skip to content

Commit 1d64d69

Browse files
committed
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.
1 parent 344740a commit 1d64d69

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

compass_app/app/lib/ui/activities/widgets/activity_entry.dart

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class ActivityEntry extends StatelessWidget {
3030
ClipRRect(
3131
borderRadius: BorderRadius.circular(8),
3232
child: CachedNetworkImage(
33+
errorWidget: (context, url, error) => _ActivityErrorPlaceholder(),
3334
imageUrl: activity.imageUrl,
3435
height: 80,
3536
width: 80,
@@ -66,3 +67,23 @@ class ActivityEntry extends StatelessWidget {
6667
);
6768
}
6869
}
70+
71+
class _ActivityErrorPlaceholder extends StatelessWidget {
72+
const _ActivityErrorPlaceholder({super.key});
73+
74+
@override
75+
Widget build(BuildContext context) {
76+
return Container(
77+
width: 80,
78+
height: 80,
79+
decoration: BoxDecoration(
80+
color: Colors.grey[200],
81+
borderRadius: BorderRadius.circular(8),
82+
),
83+
child: Icon(
84+
Icons.broken_image_outlined,
85+
color: Theme.of(context).colorScheme.onSurfaceVariant,
86+
),
87+
);
88+
}
89+
}

0 commit comments

Comments
 (0)