Skip to content

Commit

Permalink
🐛 fix: handle snackBar queue while reacting on message
Browse files Browse the repository at this point in the history
- Fix if already snackBar is there then it open new snackBar on previous one.
  • Loading branch information
apurva010 committed Jul 2, 2024
1 parent 2c70e16 commit 278c6a3
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions lib/src/widgets/chat_list_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,50 +199,50 @@ class _ChatListWidgetState extends State<ChatListWidget>
}) {
final replyPopup = chatListConfig.replyPopupConfig;
ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar(
duration: const Duration(hours: 1),
backgroundColor: replyPopup?.backgroundColor ?? Colors.white,
content: replyPopup?.replyPopupBuilder != null
? replyPopup!.replyPopupBuilder!(message, sentByCurrentUser)
: ReplyPopupWidget(
buttonTextStyle: replyPopup?.buttonTextStyle,
topBorderColor: replyPopup?.topBorderColor,
onMoreTap: () {
_onChatListTap();
replyPopup?.onMoreTap?.call(
message,
sentByCurrentUser,
);
},
onReportTap: () {
_onChatListTap();
replyPopup?.onReportTap?.call(
message,
);
},
onUnsendTap: () {
_onChatListTap();
replyPopup?.onUnsendTap?.call(
message,
);
},
onReplyTap: () {
widget.assignReplyMessage(message);
if (featureActiveConfig?.enableReactionPopup ?? false) {
showPopUp.value = false;
}
ScaffoldMessenger.of(context).hideCurrentSnackBar();
if (replyPopup?.onReplyTap != null) {
replyPopup?.onReplyTap!(message);
}
},
sentByCurrentUser: sentByCurrentUser,
),
padding: EdgeInsets.zero,
),
)
.closed;
..clearSnackBars()
..showSnackBar(
SnackBar(
duration: const Duration(hours: 1),
backgroundColor: replyPopup?.backgroundColor ?? Colors.white,
content: replyPopup?.replyPopupBuilder != null
? replyPopup!.replyPopupBuilder!(message, sentByCurrentUser)
: ReplyPopupWidget(
buttonTextStyle: replyPopup?.buttonTextStyle,
topBorderColor: replyPopup?.topBorderColor,
onMoreTap: () {
_onChatListTap();
replyPopup?.onMoreTap?.call(
message,
sentByCurrentUser,
);
},
onReportTap: () {
_onChatListTap();
replyPopup?.onReportTap?.call(
message,
);
},
onUnsendTap: () {
_onChatListTap();
replyPopup?.onUnsendTap?.call(
message,
);
},
onReplyTap: () {
widget.assignReplyMessage(message);
if (featureActiveConfig?.enableReactionPopup ?? false) {
showPopUp.value = false;
}
ScaffoldMessenger.of(context).hideCurrentSnackBar();
if (replyPopup?.onReplyTap != null) {
replyPopup?.onReplyTap!(message);
}
},
sentByCurrentUser: sentByCurrentUser,
),
padding: EdgeInsets.zero,
),
).closed;
}

void _onChatListTap() {
Expand Down

0 comments on commit 278c6a3

Please sign in to comment.