From 9934ac209752429ba6621714e93651252d74c64e Mon Sep 17 00:00:00 2001 From: Nikita Avdosev Date: Tue, 3 May 2022 11:12:50 +0300 Subject: [PATCH] cache authors avatars --- lib/widgets/author_avatar_icon.dart | 5 +++-- pubspec.yaml | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/widgets/author_avatar_icon.dart b/lib/widgets/author_avatar_icon.dart index 0818a86..1dcea8d 100644 --- a/lib/widgets/author_avatar_icon.dart +++ b/lib/widgets/author_avatar_icon.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -47,8 +48,8 @@ class AuthorAvatarIcon extends StatelessWidget { if (avatar!.cached) { image = Image.file(File(avatar!.url!), height: height, width: width); } else { - image = Image.network( - avatar!.url!, + image = CachedNetworkImage( + imageUrl: avatar!.url!, height: height, width: width, ); diff --git a/pubspec.yaml b/pubspec.yaml index 3aecbdd..c0a46e0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,6 +33,7 @@ dependencies: crypto: ">=2.1.5" provider: ^6.0.0 itertools: ">=0.1.0" + cached_network_image: ^3.2.0 dependency_overrides: platform: ^3.1.0