Skip to content

Commit

Permalink
fix: 🐛 fix send message not working when texting start with newLine #182
Browse files Browse the repository at this point in the history
  • Loading branch information
apurva010 committed Jun 4, 2024
1 parent 585e943 commit d0a0c12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## [2.0.0] (Unreleased)

* **Fix**: [182](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/182) Fix
send message not working when user start texting after newLine.
* **Feat**: [156](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/156) Added
default avatar, error builder for asset, network and base64 profile image and
cached_network_image for network images.
Expand Down
20 changes: 10 additions & 10 deletions lib/src/widgets/send_message_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,16 @@ class SendMessageWidgetState extends State<SendMessageWidget> {
}

void _onPressed() {
if (_textEditingController.text.isNotEmpty &&
!_textEditingController.text.startsWith('\n')) {
widget.onSendTap.call(
_textEditingController.text.trim(),
replyMessage,
MessageType.text,
);
_assignRepliedMessage();
_textEditingController.clear();
}
final messageText = _textEditingController.text.trim();
_textEditingController.clear();
if (messageText.isEmpty) return;

widget.onSendTap.call(
messageText.trim(),
replyMessage,
MessageType.text,
);
_assignRepliedMessage();
}

void assignReplyMessage(Message message) {
Expand Down

0 comments on commit d0a0c12

Please sign in to comment.