@@ -14,174 +14,174 @@ visit [Chat View Example](https://chat-view-8f1b5.web.app/#/).
14
14
![ The example app running in iOS] ( https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_chat_ui/main/preview/chatview.gif )
15
15
16
16
## Migration guide for release 2.0.0
17
- Removed ` showTypingIndicator ` field from ` ChatView ` and replaced it with ` ChatController.showTypingIndicator ` .
18
17
19
- Before:
20
- ``` dart
21
- ChatView(
22
- showTypingIndicator:false,
23
- ),
24
- ```
18
+ - Renamed ` sendBy ` field to ` sentBy ` in ` Message ` class.
25
19
26
- After:
27
- ``` dart
28
- /// use it with your [ChatController] instance.
29
- _chatContoller.setTypingIndicator = true; // for showing indicator
30
- _chatContoller.setTypingIndicator = false; // for hiding indicator
20
+ - Renamed ` chatUsers ` field to ` otherUsers ` in ` ChatController ` class.
31
21
32
- ChatView(
33
- chatController: _chatController,
34
- ),
35
- ```
22
+ - Moved ` currentUser ` field from ` ChatView ` widget to ` ChatController ` class
36
23
37
- Renamed ` sendBy ` field to ` sentBy ` in ` Message ` class .
24
+ - Removed ` showTypingIndicator ` field from ` ChatView ` and replaced it with ` ChatController.showTypingIndicator ` .
38
25
39
- Updated ` ChatUser ` , ` Message ` and ` ReplyMessage ` Data Model's ` fromJson ` and ` toJson ` methods:
26
+ Before:
27
+ ``` dart
28
+ ChatView(
29
+ showTypingIndicator:false,
30
+ ),
31
+ ```
40
32
41
- in ` ChatUser.fromJson ` :
33
+ After:
34
+ ```dart
35
+ /// use it with your [ChatController] instance.
36
+ _chatContoller.setTypingIndicator = true; // for showing indicator
37
+ _chatContoller.setTypingIndicator = false; // for hiding indicator
38
+ ```
42
39
43
- Before:
44
- ``` dart
45
- ChatUser.fromJson(
46
- {
47
- ...
48
- 'imageType': ImageType.asset,
49
- ...
50
- },
51
- ),
52
- ```
40
+ - Updated `ChatUser`, `Message` and `ReplyMessage` Data Model's `fromJson` and `toJson` methods:
53
41
54
- After:
55
- ``` dart
56
- ChatUser.fromJson(
57
- {
58
- ...
59
- 'imageType': 'asset',
60
- ...
61
- },
62
- ),
63
- ```
42
+ ##### in `ChatUser.fromJson`:
64
43
65
- in ` ChatUser.toJson ` :
44
+ Before:
45
+ ```dart
46
+ ChatUser.fromJson(
47
+ {
48
+ ...
49
+ 'imageType': ImageType.asset,
50
+ ...
51
+ },
52
+ ),
53
+ ```
66
54
67
- Before:
68
- ``` dart
69
- {
70
- ...
71
- imageType: ImageType.asset,
72
- ...
73
- }
74
- ```
55
+ After:
56
+ ```dart
57
+ ChatUser.fromJson(
58
+ {
59
+ ...
60
+ 'imageType': 'asset',
61
+ ...
62
+ },
63
+ ),
64
+ ```
75
65
76
- After:
77
- ``` dart
78
- {
79
- ...
80
- imageType: asset,
81
- ...
82
- }
83
- ```
66
+ ##### in `ChatUser.toJson`:
84
67
85
- in ` Message.fromJson ` :
68
+ Before:
69
+ ```dart
70
+ {
71
+ ...
72
+ imageType: ImageType.asset,
73
+ ...
74
+ }
75
+ ```
86
76
87
- Before:
88
- ``` dart
89
- Message.fromJson(
90
- {
91
- ...
92
- 'createdAt': DateTime.now(),
93
- 'message_type': MessageType.text,
94
- 'voice_message_duration': Duration(seconds: 5),
95
- ...
96
- }
97
- )
98
- ```
77
+ After:
78
+ ```dart
79
+ {
80
+ ...
81
+ imageType: asset,
82
+ ...
83
+ }
84
+ ```
99
85
100
- After:
101
- ``` dart
102
- Message.fromJson(
103
- {
104
- ...
105
- 'createdAt': '2024-06-13T17:32:19.586412',
106
- 'message_type': 'text',
107
- 'voice_message_duration': '5000000',
108
- ...
109
- }
110
- )
111
- ```
86
+ ##### in `Message.fromJson`:
87
+
88
+ Before:
89
+ ```dart
90
+ Message.fromJson(
91
+ {
92
+ ...
93
+ 'createdAt': DateTime.now(),
94
+ 'message_type': MessageType.text,
95
+ 'voice_message_duration': Duration(seconds: 5),
96
+ ...
97
+ }
98
+ )
99
+ ```
112
100
113
- in ` Message.toJson ` :
101
+ After:
102
+ ```dart
103
+ Message.fromJson(
104
+ {
105
+ ...
106
+ 'createdAt': '2024-06-13T17:32:19.586412',
107
+ 'message_type': 'text',
108
+ 'voice_message_duration': '5000000',
109
+ ...
110
+ }
111
+ )
112
+ ```
114
113
115
- Before:
116
- ``` dart
117
- {
118
- ...
119
- createdAt: 2024-06-13 17:23:19.454789,
120
- message_type: MessageType.text,
121
- voice_message_duration: 0:00:05.000000,
122
- ...
123
- }
124
- ```
114
+ ##### in `Message.toJson`:
125
115
126
- After :
127
- ``` dart
128
- {
129
- ...
130
- createdAt: 2024-06-13T17:32 :19.586412 ,
131
- message_type: text,
132
- voice_message_duration: 5000000 ,
133
- ...
134
- }
135
- ```
116
+ Before :
117
+ ```dart
118
+ {
119
+ ...
120
+ createdAt: 2024-06-13 17:23 :19.454789 ,
121
+ message_type: MessageType. text,
122
+ voice_message_duration: 0:00:05.000000 ,
123
+ ...
124
+ }
125
+ ```
136
126
137
- in ` ReplyMessage.fromJson ` :
127
+ After:
128
+ ```dart
129
+ {
130
+ ...
131
+ createdAt: 2024-06-13T17:32:19.586412,
132
+ message_type: text,
133
+ voice_message_duration: 5000000,
134
+ ...
135
+ }
136
+ ```
138
137
139
- Before:
140
- ``` dart
141
- ReplyMessage.fromJson(
142
- {
143
- ...
144
- 'message_type': MessageType.text,
145
- 'voiceMessageDuration': Duration(seconds: 5),
146
- ...
147
- }
148
- )
149
- ```
138
+ ##### in `ReplyMessage.fromJson`:
150
139
151
- After :
152
- ``` dart
153
- ReplyMessage.fromJson(
154
- {
155
- ...
156
- 'message_type': ' text' ,
157
- 'voiceMessageDuration': '5000000' ,
158
- ...
159
- }
160
- )
161
- ```
140
+ Before :
141
+ ```dart
142
+ ReplyMessage.fromJson(
143
+ {
144
+ ...
145
+ 'message_type': MessageType. text,
146
+ 'voiceMessageDuration': Duration(seconds: 5) ,
147
+ ...
148
+ }
149
+ )
150
+ ```
162
151
163
- in ` ReplyMessage.toJson ` :
152
+ After:
153
+ ```dart
154
+ ReplyMessage.fromJson(
155
+ {
156
+ ...
157
+ 'message_type': 'text',
158
+ 'voiceMessageDuration': '5000000',
159
+ ...
160
+ }
161
+ )
162
+ ```
164
163
165
- Before:
166
- ``` dart
167
- {
168
- ...
169
- message_type: MessageType.text,
170
- voiceMessageDuration: 0:00:05.000000,
171
- ...
172
- }
173
- ```
164
+ in `ReplyMessage.toJson`:
174
165
175
- After :
176
- ``` dart
177
- {
178
- ...
179
- message_type: text,
180
- voiceMessageDuration: 5000000 ,
181
- ...
182
- }
183
- ```
166
+ Before :
167
+ ```dart
168
+ {
169
+ ...
170
+ message_type: MessageType. text,
171
+ voiceMessageDuration: 0:00:05.000000 ,
172
+ ...
173
+ }
174
+ ```
184
175
176
+ After:
177
+ ```dart
178
+ {
179
+ ...
180
+ message_type: text,
181
+ voiceMessageDuration: 5000000,
182
+ ...
183
+ }
184
+ ```
185
185
186
186
## Installing
187
187
@@ -203,14 +203,14 @@ import 'package:chatview/chatview.dart';
203
203
final chatController = ChatController(
204
204
initialMessageList: messageList,
205
205
scrollController: ScrollController(),
206
- chatUsers: [ChatUser(id: '2', name: 'Simform')],
206
+ currentUser: ChatUser(id: '1', name: 'Flutter'),
207
+ otherUsers: [ChatUser(id: '2', name: 'Simform')],
207
208
);
208
209
```
209
210
210
211
4 . Adding a ` ChatView ` widget.
211
212
``` dart
212
213
ChatView(
213
- currentUser: ChatUser(id: '1', name: 'Flutter'),
214
214
chatController: chatController,
215
215
onSendTap: onSendTap,
216
216
chatViewState: ChatViewState.hasMessages, // Add this state once data is available.
@@ -960,7 +960,7 @@ _chatController.addReplySuggestions([
960
960
``` dart
961
961
_chatController.removeReplySuggestions();
962
962
```
963
- * Update Sugestions Config
963
+ * Update suggestions Config
964
964
``` dart
965
965
replySuggestionsConfig: ReplySuggestionsConfig(
966
966
itemConfig: SuggestionItemConfig(
@@ -982,8 +982,8 @@ replySuggestionsConfig: ReplySuggestionsConfig(
982
982
```
983
983
984
984
34 . Added callback ` messageSorter ` to sort message in ` ChatBackgroundConfiguration ` .
985
- ``` dart
986
985
986
+ ``` dart
987
987
ChatView(
988
988
...
989
989
chatBackgroundConfig: ChatBackgroundConfiguration(
@@ -997,7 +997,6 @@ ChatView(
997
997
),
998
998
```
999
999
1000
-
1001
1000
## How to use
1002
1001
1003
1002
Check out [ blog] ( https://medium.com/simform-engineering/chatview-a-cutting-edge-chat-ui-solution-7367b1f9d772 ) for better understanding and basic implementation.
0 commit comments