mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-18 18:33:49 +02:00
feat: submit the chat message inputfield when enter is pressed
This commit is contained in:
parent
7a0fd49070
commit
02ae851d13
3 changed files with 6 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
- Added loadNewMessagesAfter, loadOldMessagesBefore and removed pagination from getMessages in the ChatRepositoryInterface to change pagination behavior to rely on the stream and two methods indicating that more messages should be added to the stream
|
||||
- Added chatTitleResolver that can be used to resolve the chat title from the chat model or return null to allow for default behavior
|
||||
- Added ChatPaginationControls to the ChatOptions to allow for more control over the pagination
|
||||
- Fixed that chat message is automatically sent when the user presses enter on the keyboard in the chat input
|
||||
|
||||
## 4.0.0
|
||||
- Move to the new user story architecture
|
||||
|
|
|
@ -106,6 +106,7 @@ typedef TextInputBuilder = Widget Function(
|
|||
TextEditingController textEditingController,
|
||||
Widget suffixIcon,
|
||||
ChatTranslations translations,
|
||||
VoidCallback onSubmit,
|
||||
);
|
||||
|
||||
/// The base screen builder
|
||||
|
|
|
@ -77,6 +77,8 @@ class ChatBottomInputSection extends HookWidget {
|
|||
],
|
||||
);
|
||||
|
||||
Future<void> onSubmitField() async => sendMessage();
|
||||
|
||||
var defaultInputField = TextField(
|
||||
textAlign: TextAlign.start,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
|
@ -106,6 +108,7 @@ class ChatBottomInputSection extends HookWidget {
|
|||
),
|
||||
suffixIcon: messageSendButtons,
|
||||
),
|
||||
onSubmitted: (_) async => onSubmitField(),
|
||||
);
|
||||
|
||||
return Padding(
|
||||
|
@ -117,6 +120,7 @@ class ChatBottomInputSection extends HookWidget {
|
|||
textController,
|
||||
messageSendButtons,
|
||||
options.translations,
|
||||
onSubmitField,
|
||||
) ??
|
||||
defaultInputField,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue