Skip to content

Commit 6e1c1ad

Browse files
committed
content [nfc]: Refactor Avatar a bit
1 parent 95b29e5 commit 6e1c1ad

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/widgets/content.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -830,12 +830,13 @@ class Avatar extends StatelessWidget {
830830
final store = PerAccountStoreWidget.of(context);
831831
final user = store.users[userId]!;
832832

833-
final avatarUrl = user.avatarUrl == null
834-
? null // TODO(#255): handle computing gravatars
835-
: resolveUrl(user.avatarUrl!, store.account);
836-
final avatar = (avatarUrl == null)
833+
final resolvedUrl = switch (user.avatarUrl) {
834+
null => null, // TODO(#255): handle computing gravatars
835+
var avatarUrl => resolveUrl(avatarUrl, store.account),
836+
};
837+
final avatar = (resolvedUrl == null)
837838
? const SizedBox.shrink()
838-
: RealmContentNetworkImage(avatarUrl, filterQuality: FilterQuality.medium);
839+
: RealmContentNetworkImage(resolvedUrl, filterQuality: FilterQuality.medium);
839840

840841
return SizedBox.square(
841842
dimension: size,

0 commit comments

Comments
 (0)