Added ProfilePicture to ChatPage

master
Rafael 2024-06-16 01:41:42 +02:00
parent c0d0fc3943
commit 79c5b562cb
4 changed files with 19 additions and 2 deletions

View File

@ -11,12 +11,14 @@ class ChatPage extends StatefulWidget {
final String receiverEmail;
final String receiverID;
final String chatTitle;
final String? profileImageUrl;
const ChatPage({
super.key,
required this.receiverEmail,
required this.receiverID,
required this.chatTitle,
this.profileImageUrl,
});
@override
@ -90,8 +92,20 @@ class _ChatPageState extends State<ChatPage> {
@override
Widget build(BuildContext context) {
Widget chatHeader = Text(widget.chatTitle);
Widget? userPic;
if (widget.profileImageUrl != null && widget.profileImageUrl!.isNotEmpty) {
userPic =
CircleAvatar(backgroundImage: NetworkImage(widget.profileImageUrl!));
}
if (userPic != null) {
chatHeader = Row(
children: [userPic, const SizedBox(width: 7), Text(widget.chatTitle)],
);
}
return Scaffold(
appBar: AppBar(title: Text(widget.chatTitle)),
appBar: AppBar(title: chatHeader),
body: Column(
children: [
// display all messages

View File

@ -15,7 +15,7 @@ class ConversationsPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('My Chat Contacts'),
title: const Text('My Chat Connections'),
),
body: _buildUserMatchesList(),
);
@ -78,6 +78,7 @@ class ConversationsPage extends StatelessWidget {
receiverEmail: userData[Constants.dbFieldUsersEmail],
receiverID: userData[Constants.dbFieldUsersID],
chatTitle: userData[Constants.dbFieldUsersName],
profileImageUrl: userData[Constants.dbFieldUsersProfilePic],
),
),
);

View File

@ -340,6 +340,7 @@ class LikedUsersPageState extends State<LikedUsersPage> {
receiverEmail: user[Constants.dbFieldUsersEmail],
receiverID: user[Constants.dbFieldUsersID],
chatTitle: user[Constants.dbFieldUsersName],
profileImageUrl: user[Constants.dbFieldUsersProfilePic],
),
),
);

View File

@ -261,6 +261,7 @@ class UserMatchingPageState extends State<UserMatchingPage> {
receiverEmail: swipedUser.email,
receiverID: swipedUser.uid,
chatTitle: swipedUser.name,
profileImageUrl: swipedUser.profilePictureUrl,
),
),
);