mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
chore: Use a contrasted color for text avatar (#19756)
This commit is contained in:
parent
56756baea2
commit
7e35e6985e
@ -5,9 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||
import 'package:immich_mobile/domain/models/user_metadata.model.dart';
|
||||
import 'package:immich_mobile/entities/store.entity.dart';
|
||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||
import 'package:immich_mobile/services/api.service.dart';
|
||||
import 'package:immich_mobile/widgets/common/transparent_image.dart';
|
||||
|
||||
@ -26,7 +24,7 @@ class UserCircleAvatar extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
bool isDarkTheme = context.themeData.brightness == Brightness.dark;
|
||||
final userAvatarColor = user.avatarColor.toColor();
|
||||
final profileImageUrl =
|
||||
'${Store.get(StoreKey.serverEndpoint)}/users/${user.id}/profile-image?d=${Random().nextInt(1024)}';
|
||||
|
||||
@ -34,14 +32,14 @@ class UserCircleAvatar extends ConsumerWidget {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
color: isDarkTheme && user.avatarColor == AvatarColor.primary
|
||||
color: userAvatarColor.computeLuminance() > 0.5
|
||||
? Colors.black
|
||||
: Colors.white,
|
||||
),
|
||||
child: Text(user.name[0].toUpperCase()),
|
||||
);
|
||||
return CircleAvatar(
|
||||
backgroundColor: user.avatarColor.toColor(),
|
||||
backgroundColor: userAvatarColor,
|
||||
radius: radius,
|
||||
child: user.profileImagePath == null
|
||||
? textIcon
|
||||
|
Loading…
x
Reference in New Issue
Block a user