Skip to content

fix: 🐛 reply configuration not working with a custom text field.#428

Open
japanshah-simform wants to merge 1 commit intomainfrom
fix/reply-configs-usage
Open

fix: 🐛 reply configuration not working with a custom text field.#428
japanshah-simform wants to merge 1 commit intomainfrom
fix/reply-configs-usage

Conversation

@japanshah-simform
Copy link
Contributor

Description

The repliedMessageConfig will now be used in case of custom text field also.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the send-message composer so reply UI/configuration is applied even when a custom text field (sendMessageBuilder) is used.

Changes:

  • Refactors SendMessageWidget to always render ReplyMessageView (and selected-image UI), while still supporting a custom text field widget.
  • Adds a post-frame scroll-to-bottom when assigning a reply message.
  • Updates the example custom chat bar to remove its manual reply UI, relying on the shared reply view instead, and documents the fix in the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lib/src/widgets/send_message_widget.dart Always composes reply + selected-image UI regardless of custom/default input; adds scroll-to-bottom on reply assignment.
example/lib/widgets/custom_chat_bar.dart Removes duplicated reply UI from the custom composer example.
CHANGELOG.md Adds an entry documenting the fix for custom text fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

sendMessageConfig: widget.sendMessageConfig,
messageConfig: widget.messageConfig,
builder: widget.replyMessageBuilder,
onChange: (value) => _replyMessage = value,
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With sendMessageBuilder (custom text field), the builder depends on the ReplyMessage argument to attach reply metadata when sending. After this refactor, _replyMessage is updated via ReplyMessageView(onChange: ...) without calling setState, so the custom sendMessageBuilder widget may not rebuild when the reply message is set/cleared. That can leave the custom UI holding a stale ReplyMessage and sending incorrect reply info.

Consider triggering a rebuild when the reply message changes (e.g., call setState inside onChange when widget.sendMessageBuilder != null, or otherwise make the custom builder listen to the reply message changes).

Suggested change
onChange: (value) => _replyMessage = value,
onChange: (value) {
if (isCustomTextField) {
setState(() => _replyMessage = value);
} else {
_replyMessage = value;
}
},

Copilot uses AI. Check for mistakes.
Comment on lines -65 to -118
if (_replyMessage?.message.isNotEmpty ?? false)
Container(
padding: const EdgeInsets.fromLTRB(8, 8, 7.5, 7.5),
decoration: const BoxDecoration(
border: Border(
left: BorderSide(
color: AppColors.uiTwoReplyLineColor,
width: 4,
),
),
),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
replyTo,
style: const TextStyle(
fontStyle: FontStyle.normal,
fontWeight: FontWeight.w600,
fontSize: 14,
height: 1.3571428571,
letterSpacing: -0.01,
color: Color(0xFFD42A66),
),
),
const SizedBox(height: 1.5),
Text(
_replyMessage?.message ?? '',
style: const TextStyle(
fontSize: 12,
height: 1.33,
color: Color(0xFF0A0A0A),
),
),
],
),
),
const SizedBox(width: 16),
SizedBox.square(
dimension: 32,
child: IconButton(
onPressed: () => ChatView.closeReplyMessageView(
context,
),
padding: EdgeInsets.zero,
icon: SvgPicture.asset(AppIcons.closeCircular),
),
),
],
),
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please migrate this reply view to replyMessageBuilder

Comment on lines +272 to +275
// Scroll to ensure the reply widget is visible and messages are not overlapped
WidgetsBinding.instance.addPostFrameCallback((_) {
chatViewIW?.chatController.scrollToLastMessage();
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review this, as the view scrolls down every time a user tries to reply to a message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants