Skip to content

Commit 425f716

Browse files
feat: 🌟 use column instead of stack to remove arbitrary paddings
1 parent 232214c commit 425f716

File tree

2 files changed

+82
-87
lines changed

2 files changed

+82
-87
lines changed

lib/src/widgets/chat_groupedlist_widget.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,18 +234,12 @@ class _ChatGroupedListWidgetState extends State<ChatGroupedListWidget>
234234
valueListenable: ChatViewInheritedWidget.of(context)!
235235
.chatController
236236
.newSuggestions,
237-
builder: (context, value, child) {
238-
return SuggestionList(
239-
suggestions: value,
240-
);
241-
},
237+
builder: (context, value, child) => SuggestionList(
238+
suggestions: value,
239+
),
242240
),
243241
),
244242
),
245-
246-
// Adds bottom space to the message list, ensuring it is displayed
247-
// above the message text field.
248-
const SizedBox(height: 100),
249243
],
250244
),
251245
);

lib/src/widgets/chat_view.dart

Lines changed: 79 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -220,85 +220,86 @@ class _ChatViewState extends State<ChatView>
220220
children: [
221221
if (widget.appBar != null) widget.appBar!,
222222
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+
chatViewState: chatViewState,
229+
)
230+
else if (chatViewState.noMessages)
231+
ChatViewStateWidget(
232+
chatViewStateWidgetConfig:
233+
chatViewStateConfig?.noMessageWidgetConfig,
234+
chatViewState: chatViewState,
235+
onReloadButtonTap:
236+
chatViewStateConfig?.onReloadButtonTap,
237+
)
238+
else if (chatViewState.isError)
239+
ChatViewStateWidget(
240+
chatViewStateWidgetConfig:
241+
chatViewStateConfig?.errorWidgetConfig,
242+
chatViewState: chatViewState,
243+
onReloadButtonTap:
244+
chatViewStateConfig?.onReloadButtonTap,
245+
)
246+
else if (chatViewState.hasMessages)
247+
ValueListenableBuilder<ReplyMessage>(
248+
valueListenable: replyMessage,
249+
builder: (_, state, child) {
250+
return ChatListWidget(
251+
showTypingIndicator:
252+
chatController.showTypingIndicator,
253+
replyMessage: state,
254+
chatController: widget.chatController,
255+
chatBackgroundConfig: widget.chatBackgroundConfig,
256+
reactionPopupConfig: widget.reactionPopupConfig,
257+
typeIndicatorConfig: widget.typeIndicatorConfig,
258+
chatBubbleConfig: widget.chatBubbleConfig,
259+
loadMoreData: widget.loadMoreData,
260+
isLastPage: widget.isLastPage,
261+
replyPopupConfig: widget.replyPopupConfig,
262+
loadingWidget: widget.loadingWidget,
263+
messageConfig: widget.messageConfig,
264+
profileCircleConfig: widget.profileCircleConfig,
265+
repliedMessageConfig: widget.repliedMessageConfig,
266+
swipeToReplyConfig: widget.swipeToReplyConfig,
267+
onChatListTap: widget.onChatListTap,
268+
assignReplyMessage: (message) => _sendMessageKey
269+
.currentState
270+
?.assignReplyMessage(message),
271+
emojiPickerSheetConfig:
272+
widget.emojiPickerSheetConfig,
273+
);
274+
},
275+
)
276+
else
277+
Container(),
278+
][0],
301279
),
280+
if (featureActiveConfig.enableTextField)
281+
Padding(
282+
padding: const EdgeInsets.only(top: 8),
283+
child: SendMessageWidget(
284+
key: _sendMessageKey,
285+
chatController: chatController,
286+
sendMessageBuilder: widget.sendMessageBuilder,
287+
sendMessageConfig: widget.sendMessageConfig,
288+
backgroundColor: chatBackgroundConfig.backgroundColor,
289+
onSendTap: (message, replyMessage, messageType) {
290+
if (context.suggestionsConfig?.autoDismissOnSelection ??
291+
true) {
292+
chatController.removeReplySuggestions();
293+
}
294+
_onSendTap(message, replyMessage, messageType);
295+
},
296+
onReplyCallback: (reply) => replyMessage.value = reply,
297+
onReplyCloseCallback: () =>
298+
replyMessage.value = const ReplyMessage(),
299+
messageConfig: widget.messageConfig,
300+
replyMessageBuilder: widget.replyMessageBuilder,
301+
),
302+
),
302303
],
303304
),
304305
);

0 commit comments

Comments
 (0)