rename AvatarOrHash.height to be more accurate
This commit is contained in:
parent
f23a29e7c1
commit
006008f61d
7 changed files with 14 additions and 14 deletions
|
|
@ -7,24 +7,24 @@ final class const AvatarOrHash(
|
||||||
final Uri? avatar,
|
final Uri? avatar,
|
||||||
final String title, {
|
final String title, {
|
||||||
final Widget? fallback,
|
final Widget? fallback,
|
||||||
final double height = 24,
|
final double dimension = 24,
|
||||||
super.key,
|
super.key,
|
||||||
}) extends ConsumerWidget {
|
}) extends ConsumerWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final box = ColoredBox(
|
final box = ColoredBox(
|
||||||
color: ColorHash(title).color,
|
color: ColorHash(title).color,
|
||||||
child: Center(child: Icon(Icons.person, size: height / 2)),
|
child: Center(child: Icon(Icons.person, size: dimension / 2)),
|
||||||
);
|
);
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: height,
|
width: dimension,
|
||||||
height: height,
|
height: dimension,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: .all(.circular((height - 8) / 2.5)),
|
borderRadius: .all(.circular((dimension - 8) / 2.5)),
|
||||||
child: SizedBox.square(
|
child: SizedBox.square(
|
||||||
dimension: height,
|
dimension: dimension,
|
||||||
child: avatar == null
|
child: avatar == null
|
||||||
? fallback ?? box
|
? fallback ?? box
|
||||||
: Image(
|
: Image(
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ class const MessageAvatar(
|
||||||
child: AvatarOrHash(
|
child: AvatarOrHash(
|
||||||
value.avatarUrl,
|
value.avatarUrl,
|
||||||
value.displayName ?? event.sender.localpart,
|
value.displayName ?? event.sender.localpart,
|
||||||
height: height,
|
dimension: height,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_ => AvatarOrHash(null, event.sender.localpart, height: height),
|
_ => AvatarOrHash(null, event.sender.localpart, dimension: height),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ class const MemberList(final String roomId, {super.key})
|
||||||
),
|
),
|
||||||
leading: AvatarOrHash(
|
leading: AvatarOrHash(
|
||||||
avatarUrl,
|
avatarUrl,
|
||||||
height: 36,
|
dimension: 36,
|
||||||
displayName ??
|
displayName ??
|
||||||
members[index]
|
members[index]
|
||||||
.stateKey!
|
.stateKey!
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ final class const RoomAppbar({
|
||||||
: AvatarOrHash(
|
: AvatarOrHash(
|
||||||
room.metadata?.avatar,
|
room.metadata?.avatar,
|
||||||
room.metadata?.name ?? "Unnamed Room",
|
room.metadata?.name ?? "Unnamed Room",
|
||||||
height: 24,
|
dimension: 24,
|
||||||
fallback: Icon(Icons.numbers),
|
fallback: Icon(Icons.numbers),
|
||||||
)
|
)
|
||||||
: DrawerButton(onPressed: onOpenDrawer),
|
: DrawerButton(onPressed: onOpenDrawer),
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ class const RoomList({super.key})
|
||||||
},
|
},
|
||||||
short: true,
|
short: true,
|
||||||
icon: AvatarOrHash(
|
icon: AvatarOrHash(
|
||||||
height: 28,
|
dimension: 28,
|
||||||
space.room?.metadata?.avatar,
|
space.room?.metadata?.avatar,
|
||||||
fallback: space.icon == null
|
fallback: space.icon == null
|
||||||
? null
|
? null
|
||||||
|
|
@ -285,7 +285,7 @@ class const RoomList({super.key})
|
||||||
subSpace.room.metadata?.avatar,
|
subSpace.room.metadata?.avatar,
|
||||||
subSpace.room.metadata?.name ??
|
subSpace.room.metadata?.name ??
|
||||||
"Unnamed Room",
|
"Unnamed Room",
|
||||||
height: 16,
|
dimension: 16,
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class const RoomSummaryDialog(
|
||||||
child: AvatarOrHash(
|
child: AvatarOrHash(
|
||||||
summary.avatarUrl,
|
summary.avatarUrl,
|
||||||
"",
|
"",
|
||||||
height: 64,
|
dimension: 64,
|
||||||
fallback: Icon(Icons.numbers),
|
fallback: Icon(Icons.numbers),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ final class const UserBottomSheet(
|
||||||
child: AvatarOrHash(
|
child: AvatarOrHash(
|
||||||
member.avatarUrl,
|
member.avatarUrl,
|
||||||
member.displayName ?? userId.localpart,
|
member.displayName ?? userId.localpart,
|
||||||
height: 200,
|
dimension: 200,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue