-
Notifications
You must be signed in to change notification settings - Fork 211
fix: 🐛 reply configuration not working with a custom text field. #428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -95,83 +95,80 @@ class SendMessageWidgetState extends State<SendMessageWidget> { | |||||||||||||||||
| chatListConfig.scrollToBottomButtonConfig; | ||||||||||||||||||
| return Align( | ||||||||||||||||||
| alignment: Alignment.bottomCenter, | ||||||||||||||||||
| child: isCustomTextField | ||||||||||||||||||
| ? Builder( | ||||||||||||||||||
| // Assign the key only when using a custom text field to measure its height, | ||||||||||||||||||
| // to preventing overlap with the message list. | ||||||||||||||||||
| key: chatViewIW?.chatTextFieldViewKey, | ||||||||||||||||||
| builder: (context) { | ||||||||||||||||||
| WidgetsBinding.instance.addPostFrameCallback( | ||||||||||||||||||
| (_) => context.calculateAndUpdateTextFieldHeight(), | ||||||||||||||||||
| ); | ||||||||||||||||||
| return widget.sendMessageBuilder?.call(_replyMessage) ?? | ||||||||||||||||||
| const SizedBox.shrink(); | ||||||||||||||||||
| }, | ||||||||||||||||||
| ) | ||||||||||||||||||
| : SizedBox( | ||||||||||||||||||
| width: MediaQuery.of(context).size.width, | ||||||||||||||||||
| child: Stack( | ||||||||||||||||||
| child: SizedBox( | ||||||||||||||||||
| width: MediaQuery.of(context).size.width, | ||||||||||||||||||
| child: Stack( | ||||||||||||||||||
| children: [ | ||||||||||||||||||
| // This has been added to prevent messages from being | ||||||||||||||||||
| // displayed below the text field | ||||||||||||||||||
| // when the user scrolls the message list. | ||||||||||||||||||
| Positioned( | ||||||||||||||||||
| right: 0, | ||||||||||||||||||
| left: 0, | ||||||||||||||||||
| bottom: 0, | ||||||||||||||||||
| child: Container( | ||||||||||||||||||
| height: MediaQuery.of(context).size.height / | ||||||||||||||||||
| ((!kIsWeb && Platform.isIOS) ? 24 : 28), | ||||||||||||||||||
| color: chatListConfig.chatBackgroundConfig.backgroundColor ?? | ||||||||||||||||||
| Colors.white, | ||||||||||||||||||
| ), | ||||||||||||||||||
| ), | ||||||||||||||||||
| Positioned( | ||||||||||||||||||
| right: 0, | ||||||||||||||||||
| left: 0, | ||||||||||||||||||
| bottom: 0, | ||||||||||||||||||
| child: Column( | ||||||||||||||||||
| mainAxisSize: MainAxisSize.min, | ||||||||||||||||||
| children: [ | ||||||||||||||||||
| // This has been added to prevent messages from being | ||||||||||||||||||
| // displayed below the text field | ||||||||||||||||||
| // when the user scrolls the message list. | ||||||||||||||||||
| Positioned( | ||||||||||||||||||
| right: 0, | ||||||||||||||||||
| left: 0, | ||||||||||||||||||
| bottom: 0, | ||||||||||||||||||
| child: Container( | ||||||||||||||||||
| height: MediaQuery.of(context).size.height / | ||||||||||||||||||
| ((!kIsWeb && Platform.isIOS) ? 24 : 28), | ||||||||||||||||||
| color: | ||||||||||||||||||
| chatListConfig.chatBackgroundConfig.backgroundColor ?? | ||||||||||||||||||
| Colors.white, | ||||||||||||||||||
| if (chatViewIW | ||||||||||||||||||
| ?.featureActiveConfig.enableScrollToBottomButton ?? | ||||||||||||||||||
| true) | ||||||||||||||||||
| Align( | ||||||||||||||||||
| alignment: | ||||||||||||||||||
| scrollToBottomButtonConfig?.alignment?.alignment ?? | ||||||||||||||||||
| Alignment.bottomCenter, | ||||||||||||||||||
| child: Padding( | ||||||||||||||||||
| padding: scrollToBottomButtonConfig?.padding ?? | ||||||||||||||||||
| EdgeInsets.zero, | ||||||||||||||||||
| child: const ScrollToBottomButton(), | ||||||||||||||||||
| ), | ||||||||||||||||||
| ), | ||||||||||||||||||
| ), | ||||||||||||||||||
| Positioned( | ||||||||||||||||||
| right: 0, | ||||||||||||||||||
| left: 0, | ||||||||||||||||||
| bottom: 0, | ||||||||||||||||||
| child: Column( | ||||||||||||||||||
| mainAxisSize: MainAxisSize.min, | ||||||||||||||||||
| Padding( | ||||||||||||||||||
| key: chatViewIW?.chatTextFieldViewKey, | ||||||||||||||||||
| padding: EdgeInsets.fromLTRB( | ||||||||||||||||||
| bottomPadding4, | ||||||||||||||||||
| bottomPadding4, | ||||||||||||||||||
| bottomPadding4, | ||||||||||||||||||
| _bottomPadding, | ||||||||||||||||||
| ), | ||||||||||||||||||
| child: Stack( | ||||||||||||||||||
| alignment: Alignment.bottomCenter, | ||||||||||||||||||
| children: [ | ||||||||||||||||||
| if (chatViewIW?.featureActiveConfig | ||||||||||||||||||
| .enableScrollToBottomButton ?? | ||||||||||||||||||
| true) | ||||||||||||||||||
| Align( | ||||||||||||||||||
| alignment: scrollToBottomButtonConfig | ||||||||||||||||||
| ?.alignment?.alignment ?? | ||||||||||||||||||
| Alignment.bottomCenter, | ||||||||||||||||||
| child: Padding( | ||||||||||||||||||
| padding: scrollToBottomButtonConfig?.padding ?? | ||||||||||||||||||
| EdgeInsets.zero, | ||||||||||||||||||
| child: const ScrollToBottomButton(), | ||||||||||||||||||
| ), | ||||||||||||||||||
| ), | ||||||||||||||||||
| Padding( | ||||||||||||||||||
| key: chatViewIW?.chatTextFieldViewKey, | ||||||||||||||||||
| padding: EdgeInsets.fromLTRB( | ||||||||||||||||||
| bottomPadding4, | ||||||||||||||||||
| bottomPadding4, | ||||||||||||||||||
| bottomPadding4, | ||||||||||||||||||
| _bottomPadding, | ||||||||||||||||||
| ReplyMessageView( | ||||||||||||||||||
| key: _replyMessageTextFieldViewKey, | ||||||||||||||||||
| sendMessageConfig: widget.sendMessageConfig, | ||||||||||||||||||
| messageConfig: widget.messageConfig, | ||||||||||||||||||
| builder: widget.replyMessageBuilder, | ||||||||||||||||||
| onChange: (value) => _replyMessage = value, | ||||||||||||||||||
|
||||||||||||||||||
| onChange: (value) => _replyMessage = value, | |
| onChange: (value) { | |
| if (isCustomTextField) { | |
| setState(() => _replyMessage = value); | |
| } else { | |
| _replyMessage = value; | |
| } | |
| }, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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