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