Skip to content

Commit 9934ac2

Browse files
committed
cache authors avatars
1 parent 0f0658e commit 9934ac2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/widgets/author_avatar_icon.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:io';
22

3+
import 'package:cached_network_image/cached_network_image.dart';
34
import 'package:flutter/material.dart';
45
import 'package:flutter_svg/flutter_svg.dart';
56

@@ -47,8 +48,8 @@ class AuthorAvatarIcon extends StatelessWidget {
4748
if (avatar!.cached) {
4849
image = Image.file(File(avatar!.url!), height: height, width: width);
4950
} else {
50-
image = Image.network(
51-
avatar!.url!,
51+
image = CachedNetworkImage(
52+
imageUrl: avatar!.url!,
5253
height: height,
5354
width: width,
5455
);

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dependencies:
3333
crypto: ">=2.1.5"
3434
provider: ^6.0.0
3535
itertools: ">=0.1.0"
36+
cached_network_image: ^3.2.0
3637

3738
dependency_overrides:
3839
platform: ^3.1.0

0 commit comments

Comments
 (0)