@@ -213,85 +213,103 @@ class _ChatViewState extends State<ChatView>
213
213
children: [
214
214
if (widget.appBar != null ) widget.appBar! ,
215
215
Expanded (
216
- child: Stack (
217
- children: [
218
- if (chatViewState.isLoading)
219
- ChatViewStateWidget (
220
- chatViewStateWidgetConfig:
221
- chatViewStateConfig? .loadingWidgetConfig,
222
- chatViewState: chatViewState,
223
- )
224
- else if (chatViewState.noMessages)
225
- ChatViewStateWidget (
226
- chatViewStateWidgetConfig:
227
- chatViewStateConfig? .noMessageWidgetConfig,
228
- chatViewState: chatViewState,
229
- onReloadButtonTap:
230
- chatViewStateConfig? .onReloadButtonTap,
231
- )
232
- else if (chatViewState.isError)
233
- ChatViewStateWidget (
234
- chatViewStateWidgetConfig:
235
- chatViewStateConfig? .errorWidgetConfig,
236
- chatViewState: chatViewState,
237
- onReloadButtonTap:
238
- chatViewStateConfig? .onReloadButtonTap,
239
- )
240
- else if (chatViewState.hasMessages)
241
- ValueListenableBuilder <ReplyMessage >(
242
- valueListenable: replyMessage,
243
- builder: (_, state, child) {
244
- return ChatListWidget (
245
- showTypingIndicator:
246
- chatController.showTypingIndicator,
247
- replyMessage: state,
248
- chatController: widget.chatController,
249
- chatBackgroundConfig: widget.chatBackgroundConfig,
250
- reactionPopupConfig: widget.reactionPopupConfig,
251
- typeIndicatorConfig: widget.typeIndicatorConfig,
252
- chatBubbleConfig: widget.chatBubbleConfig,
253
- loadMoreData: widget.loadMoreData,
254
- isLastPage: widget.isLastPage,
255
- replyPopupConfig: widget.replyPopupConfig,
256
- loadingWidget: widget.loadingWidget,
257
- messageConfig: widget.messageConfig,
258
- profileCircleConfig: widget.profileCircleConfig,
259
- repliedMessageConfig: widget.repliedMessageConfig,
260
- swipeToReplyConfig: widget.swipeToReplyConfig,
261
- onChatListTap: widget.onChatListTap,
262
- assignReplyMessage: (message) => _sendMessageKey
263
- .currentState
264
- ? .assignReplyMessage (message),
265
- emojiPickerSheetConfig:
266
- widget.emojiPickerSheetConfig,
267
- );
268
- },
269
- ),
270
- if (featureActiveConfig.enableTextField)
271
- SendMessageWidget (
272
- key: _sendMessageKey,
273
- chatController: chatController,
274
- sendMessageBuilder: widget.sendMessageBuilder,
275
- sendMessageConfig: widget.sendMessageConfig,
276
- backgroundColor: chatBackgroundConfig.backgroundColor,
277
- onSendTap: (message, replyMessage, messageType) {
278
- if (context.suggestionsConfig
279
- ? .autoDismissOnSelection ??
280
- true ) {
281
- chatController.removeReplySuggestions ();
282
- }
283
- _onSendTap (message, replyMessage, messageType);
284
- },
285
- onReplyCallback: (reply) =>
286
- replyMessage.value = reply,
287
- onReplyCloseCallback: () =>
288
- replyMessage.value = const ReplyMessage (),
289
- messageConfig: widget.messageConfig,
290
- replyMessageBuilder: widget.replyMessageBuilder,
291
- ),
292
- ],
293
- ),
216
+ child: [
217
+ if (chatViewState.isLoading)
218
+ ChatViewStateWidget (
219
+ chatViewStateWidgetConfig:
220
+ chatViewStateConfig? .loadingWidgetConfig,
221
+ fallbackTitle: "Loading…" ,
222
+ chatViewState: chatViewState,
223
+ )
224
+ else if (chatViewState.noMessages)
225
+ ChatViewStateWidget (
226
+ chatViewStateWidgetConfig:
227
+ chatViewStateConfig? .noMessageWidgetConfig,
228
+ fallbackTitle: "No messages yet." ,
229
+ chatViewState: chatViewState,
230
+ onReloadButtonTap:
231
+ chatViewStateConfig? .onReloadButtonTap,
232
+ )
233
+ else if (chatViewState.isError)
234
+ ChatViewStateWidget (
235
+ chatViewStateWidgetConfig:
236
+ chatViewStateConfig? .errorWidgetConfig,
237
+ fallbackTitle: "Error" ,
238
+ chatViewState: chatViewState,
239
+ onReloadButtonTap:
240
+ chatViewStateConfig? .onReloadButtonTap,
241
+ )
242
+ else if (chatViewState.hasMessages)
243
+ Stack (
244
+ clipBehavior: Clip .none,
245
+ children: [
246
+ Positioned .fill (
247
+ bottom: - MediaQuery .of (context).size.height,
248
+ child: ValueListenableBuilder <ReplyMessage >(
249
+ valueListenable: replyMessage,
250
+ builder: (_, state, child) {
251
+ return Container (
252
+ color: Colors .amber,
253
+ child: ChatListWidget (
254
+ showTypingIndicator:
255
+ chatController.showTypingIndicator,
256
+ replyMessage: state,
257
+ chatController: widget.chatController,
258
+ chatBackgroundConfig:
259
+ widget.chatBackgroundConfig,
260
+ reactionPopupConfig:
261
+ widget.reactionPopupConfig,
262
+ typeIndicatorConfig:
263
+ widget.typeIndicatorConfig,
264
+ chatBubbleConfig: widget.chatBubbleConfig,
265
+ loadMoreData: widget.loadMoreData,
266
+ isLastPage: widget.isLastPage,
267
+ replyPopupConfig: widget.replyPopupConfig,
268
+ loadingWidget: widget.loadingWidget,
269
+ messageConfig: widget.messageConfig,
270
+ profileCircleConfig:
271
+ widget.profileCircleConfig,
272
+ repliedMessageConfig:
273
+ widget.repliedMessageConfig,
274
+ swipeToReplyConfig:
275
+ widget.swipeToReplyConfig,
276
+ onChatListTap: widget.onChatListTap,
277
+ assignReplyMessage: (message) =>
278
+ _sendMessageKey.currentState
279
+ ? .assignReplyMessage (message),
280
+ emojiPickerSheetConfig:
281
+ widget.emojiPickerSheetConfig,
282
+ ),
283
+ );
284
+ },
285
+ ),
286
+ )
287
+ ],
288
+ )
289
+ else
290
+ Container (),
291
+ ][0 ],
294
292
),
293
+ if (featureActiveConfig.enableTextField)
294
+ SendMessageWidget (
295
+ key: _sendMessageKey,
296
+ chatController: chatController,
297
+ sendMessageBuilder: widget.sendMessageBuilder,
298
+ sendMessageConfig: widget.sendMessageConfig,
299
+ backgroundColor: Colors .transparent,
300
+ onSendTap: (message, replyMessage, messageType) {
301
+ if (context.suggestionsConfig? .autoDismissOnSelection ??
302
+ true ) {
303
+ chatController.removeReplySuggestions ();
304
+ }
305
+ _onSendTap (message, replyMessage, messageType);
306
+ },
307
+ onReplyCallback: (reply) => replyMessage.value = reply,
308
+ onReplyCloseCallback: () =>
309
+ replyMessage.value = const ReplyMessage (),
310
+ messageConfig: widget.messageConfig,
311
+ replyMessageBuilder: widget.replyMessageBuilder,
312
+ ),
295
313
],
296
314
),
297
315
);
0 commit comments