Skip to content

Commit 2cdfb35

Browse files
committed
🐛 fix: handle snackBar queue while reacting on message
- Fix if already snackBar is there then it open new snackBar on previous one.
1 parent 2f530e0 commit 2cdfb35

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

lib/src/widgets/chat_list_widget.dart

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -253,50 +253,50 @@ class _ChatListWidgetState extends State<ChatListWidget>
253253
}) {
254254
final replyPopup = widget.replyPopupConfig;
255255
ScaffoldMessenger.of(context)
256-
.showSnackBar(
257-
SnackBar(
258-
duration: const Duration(hours: 1),
259-
backgroundColor: replyPopup?.backgroundColor ?? Colors.white,
260-
content: replyPopup?.replyPopupBuilder != null
261-
? replyPopup!.replyPopupBuilder!(message, sentByCurrentUser)
262-
: ReplyPopupWidget(
263-
buttonTextStyle: replyPopup?.buttonTextStyle,
264-
topBorderColor: replyPopup?.topBorderColor,
265-
onMoreTap: () {
266-
_onChatListTap();
267-
replyPopup?.onMoreTap?.call(
268-
message,
269-
sentByCurrentUser,
270-
);
271-
},
272-
onReportTap: () {
273-
_onChatListTap();
274-
replyPopup?.onReportTap?.call(
275-
message,
276-
);
277-
},
278-
onUnsendTap: () {
279-
_onChatListTap();
280-
replyPopup?.onUnsendTap?.call(
281-
message,
282-
);
283-
},
284-
onReplyTap: () {
285-
widget.assignReplyMessage(message);
286-
if (featureActiveConfig?.enableReactionPopup ?? false) {
287-
showPopUp.value = false;
288-
}
289-
ScaffoldMessenger.of(context).hideCurrentSnackBar();
290-
if (replyPopup?.onReplyTap != null) {
291-
replyPopup?.onReplyTap!(message);
292-
}
293-
},
294-
sentByCurrentUser: sentByCurrentUser,
295-
),
296-
padding: EdgeInsets.zero,
297-
),
298-
)
299-
.closed;
256+
..clearSnackBars()
257+
..showSnackBar(
258+
SnackBar(
259+
duration: const Duration(hours: 1),
260+
backgroundColor: replyPopup?.backgroundColor ?? Colors.white,
261+
content: replyPopup?.replyPopupBuilder != null
262+
? replyPopup!.replyPopupBuilder!(message, sentByCurrentUser)
263+
: ReplyPopupWidget(
264+
buttonTextStyle: replyPopup?.buttonTextStyle,
265+
topBorderColor: replyPopup?.topBorderColor,
266+
onMoreTap: () {
267+
_onChatListTap();
268+
replyPopup?.onMoreTap?.call(
269+
message,
270+
sentByCurrentUser,
271+
);
272+
},
273+
onReportTap: () {
274+
_onChatListTap();
275+
replyPopup?.onReportTap?.call(
276+
message,
277+
);
278+
},
279+
onUnsendTap: () {
280+
_onChatListTap();
281+
replyPopup?.onUnsendTap?.call(
282+
message,
283+
);
284+
},
285+
onReplyTap: () {
286+
widget.assignReplyMessage(message);
287+
if (featureActiveConfig?.enableReactionPopup ?? false) {
288+
showPopUp.value = false;
289+
}
290+
ScaffoldMessenger.of(context).hideCurrentSnackBar();
291+
if (replyPopup?.onReplyTap != null) {
292+
replyPopup?.onReplyTap!(message);
293+
}
294+
},
295+
sentByCurrentUser: sentByCurrentUser,
296+
),
297+
padding: EdgeInsets.zero,
298+
),
299+
).closed;
300300
}
301301

302302
void _onChatListTap() {

0 commit comments

Comments
 (0)