aboutsummaryrefslogtreecommitdiff
path: root/lib/screens
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2023-05-22 23:16:49 -0600
committerIván Ávalos <avalos@disroot.org>2023-05-22 23:16:49 -0600
commitd0d54a9d6e7ac947ae86962b6bbc7eeb9ada5011 (patch)
tree620d6ce0d79118489e9515885e0ce7f651f4dbb8 /lib/screens
parent79bdf9cac504d35cf3cf671232b28b5b5ac03f12 (diff)
downloadlinkchat-d0d54a9d6e7ac947ae86962b6bbc7eeb9ada5011.tar.gz
linkchat-d0d54a9d6e7ac947ae86962b6bbc7eeb9ada5011.tar.bz2
linkchat-d0d54a9d6e7ac947ae86962b6bbc7eeb9ada5011.zip
Se implementa caché para ávatars
Diffstat (limited to 'lib/screens')
-rw-r--r--lib/screens/chat_screen.dart12
-rw-r--r--lib/screens/dashboard_screen.dart7
-rw-r--r--lib/screens/new_chat_screen.dart5
3 files changed, 11 insertions, 13 deletions
diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart
index 61f3f9e..64f8621 100644
--- a/lib/screens/chat_screen.dart
+++ b/lib/screens/chat_screen.dart
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:linkchat/firebase/auth.dart';
import 'package:linkchat/firebase/database.dart';
import 'package:linkchat/models/group.dart';
+import 'package:linkchat/widgets/cached_avatar.dart';
import '../models/favorite.dart';
import '../models/message.dart';
@@ -42,11 +43,12 @@ class _ChatScreenState extends State<ChatScreen> {
leadingWidth: 30,
title: Row(
children: [
- ClipRRect(
- borderRadius: BorderRadius.circular(30),
- child: CircleAvatar(
- backgroundImage: NetworkImage(user!.photoUrl),
- )),
+ // ClipRRect(
+ // borderRadius: BorderRadius.circular(30),
+ // child: CircleAvatar(
+ // backgroundImage: NetworkImage(user!.photoUrl),
+ // )),
+ CachedAvatar(user?.photoUrl),
Padding(
padding: const EdgeInsets.only(left: 10),
child: Text(user!.displayName),
diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart
index 97a9de6..4905b84 100644
--- a/lib/screens/dashboard_screen.dart
+++ b/lib/screens/dashboard_screen.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:linkchat/widgets/cached_avatar.dart';
import 'package:provider/provider.dart';
import '../firebase/auth.dart';
@@ -49,11 +50,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: ListView(
children: [
UserAccountsDrawerHeader(
- currentAccountPicture: CircleAvatar(
- backgroundImage: _auth.currentUser?.photoURL != null
- ? NetworkImage(_auth.currentUser!.photoURL!)
- : null,
- ),
+ currentAccountPicture: CachedAvatar(_auth.currentUser?.photoURL),
accountName: Text(_auth.currentUser?.displayName ?? "Lincite"),
accountEmail: _auth.currentUser?.email != null
? Text(_auth.currentUser!.email!)
diff --git a/lib/screens/new_chat_screen.dart b/lib/screens/new_chat_screen.dart
index bf7486f..3c37f2c 100644
--- a/lib/screens/new_chat_screen.dart
+++ b/lib/screens/new_chat_screen.dart
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:linkchat/firebase/database.dart';
import 'package:linkchat/models/group.dart';
+import 'package:linkchat/widgets/cached_avatar.dart';
import '../firebase/auth.dart';
import '../models/user.dart';
@@ -71,9 +72,7 @@ class _NewChatScreenState extends State<NewChatScreen> {
itemBuilder: (context, index) {
FsUser user = filteredUsers[index];
return ListTile(
- leading: CircleAvatar(
- backgroundImage: NetworkImage(user.photoUrl),
- ),
+ leading: CachedAvatar(user.photoUrl),
title: Text(user.displayName),
trailing: IconButton(
icon: const Icon(Icons.send),