|
|
@ -15,40 +15,38 @@ class NeonAccountAvatar extends StatelessWidget { |
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark; |
|
|
|
final isDark = Theme.of(context).brightness == Brightness.dark; |
|
|
|
final size = (kAvatarSize * MediaQuery.of(context).devicePixelRatio).toInt(); |
|
|
|
final size = (kAvatarSize * MediaQuery.of(context).devicePixelRatio).toInt(); |
|
|
|
final userStatusBloc = Provider.of<AccountsBloc>(context, listen: false).getUserStatusBloc(account); |
|
|
|
final userStatusBloc = Provider.of<AccountsBloc>(context, listen: false).getUserStatusBloc(account); |
|
|
|
return Stack( |
|
|
|
return SizedBox.square( |
|
|
|
alignment: Alignment.center, |
|
|
|
dimension: kAvatarSize, |
|
|
|
children: [ |
|
|
|
child: Stack( |
|
|
|
CircleAvatar( |
|
|
|
alignment: Alignment.center, |
|
|
|
radius: kAvatarSize / 2, |
|
|
|
children: [ |
|
|
|
child: ClipOval( |
|
|
|
CircleAvatar( |
|
|
|
child: NeonCachedApiImage( |
|
|
|
child: ClipOval( |
|
|
|
account: account, |
|
|
|
child: NeonCachedApiImage( |
|
|
|
cacheKey: 'avatar-${account.id}-${isDark ? 'dark' : 'light'}$size', |
|
|
|
account: account, |
|
|
|
download: () async { |
|
|
|
cacheKey: 'avatar-${account.id}-${isDark ? 'dark' : 'light'}$size', |
|
|
|
if (isDark) { |
|
|
|
download: () async { |
|
|
|
return account.client.core.getDarkAvatar( |
|
|
|
if (isDark) { |
|
|
|
userId: account.username, |
|
|
|
return account.client.core.getDarkAvatar( |
|
|
|
size: size, |
|
|
|
userId: account.username, |
|
|
|
); |
|
|
|
size: size, |
|
|
|
} else { |
|
|
|
); |
|
|
|
return account.client.core.getAvatar( |
|
|
|
} else { |
|
|
|
userId: account.username, |
|
|
|
return account.client.core.getAvatar( |
|
|
|
size: size, |
|
|
|
userId: account.username, |
|
|
|
); |
|
|
|
size: size, |
|
|
|
} |
|
|
|
); |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
ResultBuilder<UserStatusBloc, NextcloudUserStatusStatus?>( |
|
|
|
ResultBuilder<UserStatusBloc, NextcloudUserStatusStatus?>( |
|
|
|
stream: userStatusBloc.userStatus, |
|
|
|
stream: userStatusBloc.userStatus, |
|
|
|
builder: (final context, final userStatus) { |
|
|
|
builder: (final context, final userStatus) { |
|
|
|
final hasEmoji = userStatus.data?.icon != null; |
|
|
|
final hasEmoji = userStatus.data?.icon != null; |
|
|
|
final factor = hasEmoji ? 2 : 3; |
|
|
|
final factor = hasEmoji ? 2 : 3; |
|
|
|
return Align( |
|
|
|
return SizedBox( |
|
|
|
|
|
|
|
height: kAvatarSize, |
|
|
|
|
|
|
|
width: kAvatarSize, |
|
|
|
|
|
|
|
child: Align( |
|
|
|
|
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
child: Container( |
|
|
|
child: Container( |
|
|
|
height: kAvatarSize / factor, |
|
|
|
height: kAvatarSize / factor, |
|
|
@ -82,11 +80,11 @@ class NeonAccountAvatar extends StatelessWidget { |
|
|
|
) |
|
|
|
) |
|
|
|
: null, |
|
|
|
: null, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|