fix: chat

This commit is contained in:
mso7nueh
2024-11-20 15:13:23 +03:00
parent 13db19a03c
commit c0fc3d9f33

View File

@@ -46,15 +46,13 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.chatRoom.users.toChatUser.profilePhotoPath == null
? buildAvatarByUsername(widget.chatRoom.users.toChatUser.name)
: CircleAvatar(
radius: 24,
backgroundImage: NetworkImage(
widget.chatRoom.users.toChatUser.profilePhotoUrl,
),
backgroundColor: Colors.white,
),
CircleAvatar(
radius: 24,
backgroundImage: NetworkImage(
widget.chatRoom.users.toChatUser.profilePhotoUrl,
),
backgroundColor: Colors.white,
),
const SizedBox(width: 12),
Expanded(
child: Column(
@@ -95,25 +93,4 @@ class _ChatEntryWidgetState extends State<ChatEntryWidget> {
),
);
}
buildAvatarByUsername(String username) {
username = username.trim();
return Container(
width: 48,
height: 48,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFFEBF4FF),
shape: BoxShape.circle,
),
child: Text(
username.split(' ').first[0] + username.split(' ')[1][0],
style: TextStyle(
color: Color(0xFF7F9CF5),
fontWeight: FontWeight.w400,
fontSize: 20,
),
),
);
}
}