Skip to content

Commit baa563a

Browse files
committed
add text indicate when no message was sent
1 parent c6ef5ba commit baa563a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

lib/pages/chat_page.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -664,13 +664,17 @@ class ChatPageState extends State<ChatPage> {
664664
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
665665
if (snapshot.hasData) {
666666
listMessage = snapshot.data!.docs;
667-
return ListView.builder(
668-
padding: EdgeInsets.all(10),
669-
itemBuilder: (context, index) => buildItem(index, snapshot.data?.docs[index]),
670-
itemCount: snapshot.data?.docs.length,
671-
reverse: true,
672-
controller: listScrollController,
673-
);
667+
if (listMessage.length > 0) {
668+
return ListView.builder(
669+
padding: EdgeInsets.all(10),
670+
itemBuilder: (context, index) => buildItem(index, snapshot.data?.docs[index]),
671+
itemCount: snapshot.data?.docs.length,
672+
reverse: true,
673+
controller: listScrollController,
674+
);
675+
} else {
676+
return Center(child: Text("No message here yet..."));
677+
}
674678
} else {
675679
return Center(
676680
child: CircularProgressIndicator(

0 commit comments

Comments
 (0)