@@ -43,18 +43,18 @@ class ChatWidget {
4343
4444 static Widget userListbuildItem (
4545 BuildContext context, String currentUserId, DocumentSnapshot document) {
46- print ('firebase ' + document[ 'userId' ] );
46+ print ('firebase ' + document. get ( 'userId' ) );
4747 print (currentUserId);
48- if (document[ 'userId' ] == currentUserId) {
48+ if (document. get ( 'userId' ) == currentUserId) {
4949 return Container ();
5050 } else {
5151 return Container (
5252 child: FlatButton (
5353 child: Row (
5454 children: < Widget > [
5555 Material (
56- child: document[ 'photoUrl' ] != null
57- ? widgetShowImages (document[ 'photoUrl' ] , 50 )
56+ child: document. get ( 'photoUrl' ) != null
57+ ? widgetShowImages (document. get ( 'photoUrl' ) , 50 )
5858 : Icon (
5959 Icons .account_circle,
6060 size: 50.0 ,
@@ -69,7 +69,7 @@ class ChatWidget {
6969 children: < Widget > [
7070 Container (
7171 child: Text (
72- 'Nickname: ${document [ 'nickname' ] }' ,
72+ 'Nickname: ${document . get ( 'nickname' ) }' ,
7373 style: TextStyle (color: primaryColor),
7474 ),
7575 alignment: Alignment .centerLeft,
@@ -89,7 +89,7 @@ class ChatWidget {
8989 ),
9090 child: new DecoratedBox (
9191 decoration: new BoxDecoration (
92- color: document[ 'online' ] == 'online'
92+ color: document. get ( 'online' ) == 'online'
9393 ? Colors .greenAccent
9494 : Colors .transparent),
9595 ),
@@ -103,8 +103,8 @@ class ChatWidget {
103103 builder: (context) => Chat (
104104 currentUserId: currentUserId,
105105 peerId: document.documentID,
106- peerName: document[ 'nickname' ] ,
107- peerAvatar: document[ 'photoUrl' ] ,
106+ peerName: document. get ( 'nickname' ) ,
107+ peerAvatar: document. get ( 'photoUrl' ) ,
108108 )));
109109 },
110110 color: viewBg,
@@ -193,13 +193,13 @@ class ChatWidget {
193193
194194 static Widget widgetChatBuildItem (BuildContext context, var listMessage,
195195 String id, int index, DocumentSnapshot document, String peerAvatar) {
196- if (document[ 'idFrom' ] == id) {
196+ if (document. get ( 'idFrom' ) == id) {
197197 return Row (
198198 children: < Widget > [
199- document[ 'type' ] == 0
200- ? chatText (document[ 'content' ] , id, listMessage, index, true )
199+ document. get ( 'type' ) == 0
200+ ? chatText (document. get ( 'content' ) , id, listMessage, index, true )
201201 : chatImage (
202- context, id, listMessage, document[ 'content' ] , index, true )
202+ context, id, listMessage, document. get ( 'content' ) , index, true )
203203 ],
204204 mainAxisAlignment: MainAxisAlignment .end,
205205 );
@@ -218,10 +218,10 @@ class ChatWidget {
218218 clipBehavior: Clip .hardEdge,
219219 )
220220 : Container (width: 35.0 ),
221- document[ 'type' ] == 0
221+ document. get ( 'type' ) == 0
222222 ? chatText (
223- document[ 'content' ] , id, listMessage, index, false )
224- : chatImage (context, id, listMessage, document[ 'content' ] ,
223+ document. get ( 'content' ) , id, listMessage, index, false )
224+ : chatImage (context, id, listMessage, document. get ( 'content' ) ,
225225 index, false )
226226 ],
227227 ),
@@ -232,7 +232,7 @@ class ChatWidget {
232232 child: Text (
233233 DateFormat ('dd MMM kk:mm' ).format (
234234 DateTime .fromMillisecondsSinceEpoch (
235- int .parse (document[ 'timestamp' ] ))),
235+ int .parse (document. get ( 'timestamp' ) ))),
236236 style: TextStyle (
237237 color: greyColor,
238238 fontSize: 12.0 ,
@@ -257,9 +257,9 @@ class ChatWidget {
257257 child: CircularProgressIndicator (
258258 valueColor: AlwaysStoppedAnimation <Color >(themeColor)))
259259 : StreamBuilder (
260- stream: Firestore .instance
260+ stream: FirebaseFirestore .instance
261261 .collection ('messages' )
262- .document (groupChatId)
262+ .doc (groupChatId)
263263 .collection (groupChatId)
264264 .orderBy ('timestamp' , descending: true )
265265 .limit (20 )
0 commit comments