|
|
@ -9,6 +9,7 @@ import 'package:neon/src/bloc/result_builder.dart'; |
|
|
|
import 'package:neon/src/blocs/accounts.dart'; |
|
|
|
import 'package:neon/src/blocs/accounts.dart'; |
|
|
|
import 'package:neon/src/models/account.dart'; |
|
|
|
import 'package:neon/src/models/account.dart'; |
|
|
|
import 'package:neon/src/widgets/cached_image.dart'; |
|
|
|
import 'package:neon/src/widgets/cached_image.dart'; |
|
|
|
|
|
|
|
import 'package:neon/src/widgets/server_icon.dart'; |
|
|
|
import 'package:nextcloud/nextcloud.dart'; |
|
|
|
import 'package:nextcloud/nextcloud.dart'; |
|
|
|
import 'package:provider/provider.dart'; |
|
|
|
import 'package:provider/provider.dart'; |
|
|
|
import 'package:rxdart/rxdart.dart'; |
|
|
|
import 'package:rxdart/rxdart.dart'; |
|
|
@ -96,10 +97,9 @@ class _UserAvatarState extends State<NeonUserAvatar> { |
|
|
|
|
|
|
|
|
|
|
|
Widget _userStatusIconBuilder(final BuildContext context, final Result<UserStatusPublic?> result) { |
|
|
|
Widget _userStatusIconBuilder(final BuildContext context, final Result<UserStatusPublic?> result) { |
|
|
|
final hasEmoji = result.data?.icon != null; |
|
|
|
final hasEmoji = result.data?.icon != null; |
|
|
|
final scaledSize = size / (hasEmoji ? 2 : 3); |
|
|
|
final scaledSize = size / (hasEmoji ? 2 : 2.5); |
|
|
|
|
|
|
|
|
|
|
|
Widget? child; |
|
|
|
Widget? child; |
|
|
|
Decoration? decoration; |
|
|
|
|
|
|
|
if (result.isLoading) { |
|
|
|
if (result.isLoading) { |
|
|
|
child = CircularProgressIndicator( |
|
|
|
child = CircularProgressIndicator( |
|
|
|
strokeWidth: 1.5, |
|
|
|
strokeWidth: 1.5, |
|
|
@ -119,20 +119,16 @@ class _UserAvatarState extends State<NeonUserAvatar> { |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} else if (result.hasData) { |
|
|
|
} else if (result.hasData) { |
|
|
|
decoration = BoxDecoration( |
|
|
|
child = NeonServerIcon(icon: 'user-status-${result.data!.status}'); |
|
|
|
shape: BoxShape.circle, |
|
|
|
|
|
|
|
color: result.data!.color, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return SizedBox.square( |
|
|
|
return SizedBox.square( |
|
|
|
dimension: size, |
|
|
|
dimension: size, |
|
|
|
child: Align( |
|
|
|
child: Align( |
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
child: Container( |
|
|
|
child: SizedBox( |
|
|
|
width: scaledSize, |
|
|
|
width: scaledSize, |
|
|
|
height: scaledSize, |
|
|
|
height: scaledSize, |
|
|
|
decoration: decoration, |
|
|
|
|
|
|
|
child: child, |
|
|
|
child: child, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|