Skip to content

Commit

Permalink
fix: use avatarColor as the text background when no avatar available (#…
Browse files Browse the repository at this point in the history
…5566)

Co-authored-by: shenlong-tanwen <[email protected]>
  • Loading branch information
shenlong-tanwen and shenlong-tanwen authored Dec 10, 2023
1 parent 68c0112 commit 3a794d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mobile/lib/shared/ui/user_circle_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:math';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/shared/models/store.dart';
import 'package:immich_mobile/shared/models/user.dart';
import 'package:immich_mobile/shared/ui/transparent_image.dart';
Expand Down Expand Up @@ -34,15 +35,16 @@ class UserCircleAvatar extends ConsumerWidget {
color: isDarkTheme && user.avatarColor == AvatarColorEnum.primary
? Colors.black
: Colors.white,
backgroundColor: user.avatarColor.toColor(),
),
);
return CircleAvatar(
backgroundColor: user.avatarColor.toColor(),
backgroundColor: context.primaryColor,
radius: radius,
child: user.profileImagePath.isEmpty
? textIcon
: ClipRRect(
borderRadius: BorderRadius.circular(50),
borderRadius: const BorderRadius.all(Radius.circular(50)),
child: CachedNetworkImage(
fit: BoxFit.cover,
cacheKey: user.profileImagePath,
Expand Down

0 comments on commit 3a794d7

Please sign in to comment.