|
|
|
@ -41,15 +41,18 @@ class AccountAvatar extends StatelessWidget {
|
|
|
|
|
), |
|
|
|
|
ResultBuilder<UserStatusBloc, NextcloudUserStatusStatus?>( |
|
|
|
|
stream: Provider.of<AccountsBloc>(context, listen: false).getUserStatusBloc(account).userStatus, |
|
|
|
|
builder: (final context, final userStatus) => SizedBox( |
|
|
|
|
builder: (final context, final userStatus) { |
|
|
|
|
final hasEmoji = userStatus.data?.icon != null; |
|
|
|
|
final factor = hasEmoji ? 2 : 3; |
|
|
|
|
return SizedBox( |
|
|
|
|
height: kAvatarSize, |
|
|
|
|
width: kAvatarSize, |
|
|
|
|
child: Align( |
|
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
|
child: Container( |
|
|
|
|
height: kAvatarSize / 3, |
|
|
|
|
width: kAvatarSize / 3, |
|
|
|
|
decoration: userStatus.loading || userStatus.error != null || userStatus.data == null |
|
|
|
|
height: kAvatarSize / factor, |
|
|
|
|
width: kAvatarSize / factor, |
|
|
|
|
decoration: userStatus.loading || userStatus.error != null || userStatus.data == null || hasEmoji |
|
|
|
|
? null |
|
|
|
|
: BoxDecoration( |
|
|
|
|
shape: BoxShape.circle, |
|
|
|
@ -63,15 +66,23 @@ class AccountAvatar extends StatelessWidget {
|
|
|
|
|
: userStatus.error != null && |
|
|
|
|
(userStatus.error is! NextcloudApiException || |
|
|
|
|
(userStatus.error! as NextcloudApiException).statusCode != 404) |
|
|
|
|
? const Icon( |
|
|
|
|
? Icon( |
|
|
|
|
Icons.error_outline, |
|
|
|
|
size: kAvatarSize / 3, |
|
|
|
|
size: kAvatarSize / factor, |
|
|
|
|
color: Colors.red, |
|
|
|
|
) |
|
|
|
|
: null, |
|
|
|
|
: hasEmoji |
|
|
|
|
? Text( |
|
|
|
|
userStatus.data!.icon!, |
|
|
|
|
style: const TextStyle( |
|
|
|
|
fontSize: 16, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
: null, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|