widgetChatBuildListMessage static method
Widget
widgetChatBuildListMessage(
- dynamic groupChatId,
- dynamic listMessage,
- dynamic currentUserId,
- dynamic peerAvatar,
- dynamic listScrollController,
- dynamic stCollection,
Implementation
static Widget widgetChatBuildListMessage(groupChatId, listMessage,
currentUserId, peerAvatar, listScrollController, var stCollection) {
Stream<QuerySnapshot> _streamChatData;
_streamChatData =
ChatDBFireStore().streamChatDataList(stCollection, groupChatId);
return Flexible(
child: groupChatId == ''
? Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(themeColor)))
: StreamBuilder<QuerySnapshot>(
stream: _streamChatData,
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(
valueColor:
AlwaysStoppedAnimation<Color>(themeColor)));
} else {
listMessage = snapshot.data!.docs;
return ListView.builder(
padding: EdgeInsets.all(10.0),
itemBuilder: (context, index) =>
ChatWidget.widgetChatBuildItem(
context,
listMessage,
currentUserId,
index,
snapshot.data!.docs[index],
peerAvatar),
itemCount: snapshot.data!.docs.length,
reverse: true,
controller: listScrollController,
);
}
},
),
);
}