@@ -8,6 +8,8 @@ import 'package:flutter_twitter_clone/page/common/sidebar.dart';
8
8
import 'package:flutter_twitter_clone/page/message/newMessagePage.dart' ;
9
9
import 'package:flutter_twitter_clone/state/authState.dart' ;
10
10
import 'package:flutter_twitter_clone/state/chats/chatState.dart' ;
11
+ import 'package:flutter_twitter_clone/state/notificationState.dart' ;
12
+ import 'package:flutter_twitter_clone/state/searchState.dart' ;
11
13
import 'package:flutter_twitter_clone/widgets/customAppBar.dart' ;
12
14
import 'package:flutter_twitter_clone/widgets/customWidgets.dart' ;
13
15
import 'package:flutter_twitter_clone/widgets/newWidget/emptyList.dart' ;
@@ -29,7 +31,7 @@ class _ChatListPageState extends State<ChatListPage> {
29
31
chatState.setIsChatScreenOpen = true ;
30
32
31
33
// chatState.databaseInit(state.profileUserModel.userId,state.userId);
32
- chatState.getUserchatList (state.userModel.userId );
34
+ chatState.getUserchatList (state.user.uid );
33
35
super .initState ();
34
36
}
35
37
@@ -40,10 +42,11 @@ class _ChatListPageState extends State<ChatListPage> {
40
42
if (state.chatUserList == null ) {
41
43
return Padding (
42
44
padding: EdgeInsets .symmetric (horizontal: 30 ),
43
- child: EmptyList (
44
- 'No message available ' ,
45
- subTitle: 'When someonw sends you message,User list\' ll show up here \n To send message tap message.' ,
46
- )
45
+ child: EmptyList (
46
+ 'No message available ' ,
47
+ subTitle:
48
+ 'When someonw sends you message,User list\' ll show up here \n To send message tap message.' ,
49
+ ),
47
50
);
48
51
} else {
49
52
return ListView .separated (
@@ -66,7 +69,13 @@ class _ChatListPageState extends State<ChatListPage> {
66
69
contentPadding: EdgeInsets .symmetric (horizontal: 10 ),
67
70
onTap: () {
68
71
final chatState = Provider .of <ChatState >(context, listen: false );
72
+ final searchState = Provider .of <SearchState >(context, listen: false );
69
73
chatState.setChatUser = model;
74
+ if (searchState.userlist.any ((x) => x.userId == model.userId)) {
75
+ chatState.setChatUser = searchState.userlist
76
+ .where ((x) => x.userId == model.userId)
77
+ .first;
78
+ }
70
79
Navigator .pushNamed (context, '/ChatScreenPage' );
71
80
},
72
81
leading: RippleButton (
@@ -100,14 +109,22 @@ class _ChatListPageState extends State<ChatListPage> {
100
109
),
101
110
);
102
111
}
103
- FloatingActionButton _newMessageButton (){
112
+
113
+ FloatingActionButton _newMessageButton () {
104
114
return FloatingActionButton (
105
- onPressed: (){
115
+ onPressed: () {
106
116
Navigator .of (context).pushNamed ('/NewMessagePage' );
107
117
},
108
- child: customIcon (context,icon: AppIcon .newMessage,istwitterIcon: true , iconColor: Theme .of (context).colorScheme.onPrimary, size: 25 )
118
+ child: customIcon (
119
+ context,
120
+ icon: AppIcon .newMessage,
121
+ istwitterIcon: true ,
122
+ iconColor: Theme .of (context).colorScheme.onPrimary,
123
+ size: 25 ,
124
+ ),
109
125
);
110
126
}
127
+
111
128
void onSettingIconPressed () {
112
129
Navigator .pushNamed (context, '/DirectMessagesPage' );
113
130
}
0 commit comments