Skip to content

Commit bb28072

Browse files
committed
Refactored the image loading for postcard Profile image
1 parent 0743a2d commit bb28072

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/widgets/post_card.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,15 @@ class _PostCardState extends State<PostCard> {
7575
.copyWith(right: 0),
7676
child: Row(
7777
children: [
78-
CircleAvatar(
79-
radius: 16,
80-
backgroundImage:
81-
CachedNetworkImageProvider(widget.snap['profImage']),
78+
CachedNetworkImage(
79+
imageUrl: widget.snap['profImage'],
80+
imageBuilder: (context, imageProvider) => CircleAvatar(
81+
radius: 16,
82+
backgroundImage: imageProvider,
83+
),
84+
placeholder: (context, url) => const Icon(Icons.image),
85+
errorWidget: (context, url, error) =>
86+
const Icon(Icons.error),
8287
),
8388
Expanded(
8489
child: Padding(

0 commit comments

Comments
 (0)