Last active
September 21, 2020 10:12
-
-
Save duytq94/8903181be61b4de727bf71a566218acd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StreamBuilder( | |
stream: Firestore.instance | |
.collection('messages') | |
.document(groupChatId) | |
.collection(groupChatId) | |
.orderBy('timestamp', descending: true) | |
.limit(_limit) | |
.snapshots(), | |
builder: (context, snapshot) { | |
if (!snapshot.hasData) { | |
return Center( | |
child: CircularProgressIndicator(valueColor: AlwaysStoppedAnimation<Color>(themeColor))); | |
} else { | |
listMessage = snapshot.data.documents; | |
return ListView.builder( | |
padding: EdgeInsets.all(10.0), | |
itemBuilder: (context, index) => buildItem(index, snapshot.data.documents[index]), | |
itemCount: snapshot.data.documents.length, | |
reverse: true, | |
controller: listScrollController, | |
); | |
} | |
}, | |
), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment