From ecf8605310315aa57ce3b877efc1f748961fbe5e Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Tue, 6 Jul 2021 13:39:49 +0530 Subject: [PATCH] fix: added new docs --- .../guides/adding_custom_attachments.mdx | 5 ++ .../stream_chat_flutter/message_input.mdx | 50 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 docusaurus/docs/Flutter/guides/adding_custom_attachments.mdx diff --git a/docusaurus/docs/Flutter/guides/adding_custom_attachments.mdx b/docusaurus/docs/Flutter/guides/adding_custom_attachments.mdx new file mode 100644 index 00000000..677a2b85 --- /dev/null +++ b/docusaurus/docs/Flutter/guides/adding_custom_attachments.mdx @@ -0,0 +1,5 @@ +--- +id: adding_custom_attachments +sidebar_position: 3 +title: Adding Custom Attachments +--- \ No newline at end of file diff --git a/docusaurus/docs/Flutter/stream_chat_flutter/message_input.mdx b/docusaurus/docs/Flutter/stream_chat_flutter/message_input.mdx index 2d875eb9..d5f1bfbd 100644 --- a/docusaurus/docs/Flutter/stream_chat_flutter/message_input.mdx +++ b/docusaurus/docs/Flutter/stream_chat_flutter/message_input.mdx @@ -109,4 +109,54 @@ class _ChannelPageState extends State { ); } } +``` + +### Adding Custom Actions + +By default, the `MessageInput` has two actions: one for attachments and one for commands like giphy. +To add your own action, we use the `actions` parameter like this: + +```dart +MessageInput( + actions: [ + InkWell( + child: Icon( + Icons.location_on, + size: 20.0, + color: StreamChatTheme.of(context).colorTheme.grey, + ), + onTap: () { + // Do something here + }, + ), + ], +), +``` + +This will add on your action to the existing ones. + +### Disable Attachments + +To disable attachments being added to the message, set the `disableAttachments` parameter to true. + +```dart +MessageInput( + disableAttachments: true, +), +``` + +### Changing Position Of MessageInput Components + +You can also change the position of the TextField, actions and 'send' button relative to each other. + +To do this, use the `actionsLocation` or `sendButtonLocation` parameters which help you decide the location +of the buttons in the input. + +For example, if we want the actions on the right and the send button inside the TextField, we can do: + +```dart +MessageInput( + sendButtonLocation: SendButtonLocation.inside, + actionsLocation: ActionsLocation.right, +), ``` \ No newline at end of file