mirror of
https://github.com/immich-app/immich.git
synced 2025-03-11 02:23:09 -05:00
fix: use avatarColor as the text background when no avatar available (#5566)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
68c0112aaa
commit
3a794d7a2b
1 changed files with 4 additions and 2 deletions
|
@ -3,6 +3,7 @@ import 'dart:math';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.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/store.dart';
|
||||||
import 'package:immich_mobile/shared/models/user.dart';
|
import 'package:immich_mobile/shared/models/user.dart';
|
||||||
import 'package:immich_mobile/shared/ui/transparent_image.dart';
|
import 'package:immich_mobile/shared/ui/transparent_image.dart';
|
||||||
|
@ -34,15 +35,16 @@ class UserCircleAvatar extends ConsumerWidget {
|
||||||
color: isDarkTheme && user.avatarColor == AvatarColorEnum.primary
|
color: isDarkTheme && user.avatarColor == AvatarColorEnum.primary
|
||||||
? Colors.black
|
? Colors.black
|
||||||
: Colors.white,
|
: Colors.white,
|
||||||
|
backgroundColor: user.avatarColor.toColor(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return CircleAvatar(
|
return CircleAvatar(
|
||||||
backgroundColor: user.avatarColor.toColor(),
|
backgroundColor: context.primaryColor,
|
||||||
radius: radius,
|
radius: radius,
|
||||||
child: user.profileImagePath.isEmpty
|
child: user.profileImagePath.isEmpty
|
||||||
? textIcon
|
? textIcon
|
||||||
: ClipRRect(
|
: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(50),
|
borderRadius: const BorderRadius.all(Radius.circular(50)),
|
||||||
child: CachedNetworkImage(
|
child: CachedNetworkImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
cacheKey: user.profileImagePath,
|
cacheKey: user.profileImagePath,
|
||||||
|
|
Loading…
Add table
Reference in a new issue