|
|
@ -12,6 +12,7 @@ class AccountAvatar extends StatelessWidget { |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(final BuildContext context) { |
|
|
|
Widget build(final BuildContext context) { |
|
|
|
|
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark; |
|
|
|
final size = (kAvatarSize * MediaQuery.of(context).devicePixelRatio).toInt(); |
|
|
|
final size = (kAvatarSize * MediaQuery.of(context).devicePixelRatio).toInt(); |
|
|
|
return Stack( |
|
|
|
return Stack( |
|
|
|
alignment: Alignment.center, |
|
|
|
alignment: Alignment.center, |
|
|
@ -21,11 +22,20 @@ class AccountAvatar extends StatelessWidget { |
|
|
|
child: ClipOval( |
|
|
|
child: ClipOval( |
|
|
|
child: CachedAPIImage( |
|
|
|
child: CachedAPIImage( |
|
|
|
account: account, |
|
|
|
account: account, |
|
|
|
cacheKey: 'avatar-${account.id}-$size', |
|
|
|
cacheKey: 'avatar-${account.id}-${isDark ? 'dark' : 'light'}$size', |
|
|
|
download: () async => account.client.core.getAvatar( |
|
|
|
download: () async { |
|
|
|
userId: account.username, |
|
|
|
if (isDark) { |
|
|
|
size: size, |
|
|
|
return account.client.core.getDarkAvatar( |
|
|
|
), |
|
|
|
userId: account.username, |
|
|
|
|
|
|
|
size: size, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return account.client.core.getAvatar( |
|
|
|
|
|
|
|
userId: account.username, |
|
|
|
|
|
|
|
size: size, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|