Bust cached Telegram avatars
All checks were successful
Build and deploy Flutter Web / build (push) Successful in 1m58s

This commit is contained in:
Ruslan Bakiev
2026-05-08 20:06:16 +07:00
parent f11cfd768f
commit f388b7a3d2

View File

@@ -155,6 +155,9 @@ class _UserAvatar extends StatelessWidget {
@override
Widget build(BuildContext context) {
final photoUrl = user?.photoUrl;
final imageUrl = photoUrl == null || photoUrl.isEmpty
? null
: _avatarImageUrl(photoUrl);
final fallback = _fallbackText();
return Padding(
@@ -185,10 +188,10 @@ class _UserAvatar extends StatelessWidget {
child: ClipOval(
child: SizedBox.square(
dimension: 44,
child: photoUrl == null || photoUrl.isEmpty
child: imageUrl == null
? _AvatarFallback(text: fallback)
: Image.network(
photoUrl,
imageUrl,
fit: BoxFit.cover,
errorBuilder: (_, _, _) => _AvatarFallback(text: fallback),
),
@@ -211,6 +214,11 @@ class _UserAvatar extends StatelessWidget {
return 'M';
}
String _avatarImageUrl(String photoUrl) {
final separator = photoUrl.contains('?') ? '&' : '?';
return '$photoUrl${separator}v=2';
}
}
enum _AvatarAction { logout }