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 receiverEmail;
final String receiverID; final String receiverID;
final String chatTitle; final String chatTitle;
final String? profileImageUrl;
const ChatPage({ const ChatPage({
super.key, super.key,
required this.receiverEmail, required this.receiverEmail,
required this.receiverID, required this.receiverID,
required this.chatTitle, required this.chatTitle,
this.profileImageUrl,
}); });
@override @override
@ -90,8 +92,20 @@ class _ChatPageState extends State<ChatPage> {
@override @override
Widget build(BuildContext context) { 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( return Scaffold(
appBar: AppBar(title: Text(widget.chatTitle)), appBar: AppBar(title: chatHeader),
body: Column( body: Column(
children: [ children: [
// display all messages // display all messages

View File

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

View File

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

View File

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