mirror of
https://github.com/immich-app/immich
synced 2026-08-29 13:15:45 +00:00
pull riverpod out of string interpolation
This commit is contained in:
parent
8d3a0f8c42
commit
ccf378419e
2 changed files with 4 additions and 3 deletions
|
|
@ -12,12 +12,12 @@ class PartnerUserAvatar extends ConsumerWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final url = "${ref.watch(authSessionProvider.select((s) => s.serverEndpoint))}/users/$userId/profile-image";
|
||||
final serverEndpoint = ref.watch(authSessionProvider.select((s) => s.serverEndpoint));
|
||||
final nameFirstLetter = name.isNotEmpty ? name[0] : "";
|
||||
return CircleAvatar(
|
||||
radius: 16,
|
||||
backgroundColor: context.primaryColor.withAlpha(50),
|
||||
foregroundImage: RemoteImageProvider(url: url),
|
||||
foregroundImage: RemoteImageProvider(url: "$serverEndpoint/users/$userId/profile-image"),
|
||||
// silence errors if user has no profile image, use initials as fallback
|
||||
onForegroundImageError: (exception, stackTrace) {},
|
||||
child: Text(nameFirstLetter.toUpperCase()),
|
||||
|
|
|
|||
|
|
@ -15,8 +15,9 @@ class UserCircleAvatar extends ConsumerWidget {
|
|||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final userAvatarColor = user.avatarColor.toColor().withValues(alpha: opacity);
|
||||
final serverEndpoint = ref.watch(authSessionProvider.select((s) => s.serverEndpoint));
|
||||
final profileImageUrl =
|
||||
'${ref.watch(authSessionProvider.select((s) => s.serverEndpoint))}/users/${user.id}/profile-image?d=${user.profileChangedAt.millisecondsSinceEpoch}';
|
||||
'$serverEndpoint/users/${user.id}/profile-image?d=${user.profileChangedAt.millisecondsSinceEpoch}';
|
||||
|
||||
final textColor = (user.avatarColor.toColor().computeLuminance() > 0.5 ? Colors.black : Colors.white).withValues(
|
||||
alpha: opacity,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue