One more thing

🎁 One more thing

On the chat window lets add who is sending message we will modify the app bar to include profile image and name

modify chat_screen.dart to accept touser as a AppUser

class ChatScreen extends StatefulWidget {
final String? currentUserId;
final AppUser toUser;
const ChatScreen({this.currentUserId, required this.toUser, Key? key})
: super(key: key);

Fix all the references

Create a private function for appbar

AppBar _appbar() {
return AppBar(
title: Row(
children: <Widget>[
profileImage(widget.toUser, avatarRadius: 25),
SizedBox(width: 10.0),
Text(
widget.toUser.name!,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
),
),
],
),
elevation: 10.0,
);
}

Update the build method to use the appbar

return Scaffold(
appBar: _appbar(),

Affiliates

Code with andrea Discount

https://nnbd.me/devfestui