Skip to content

FLUT-927696 - [Feature] Added UG docs and image for chat suggestion feature #1055

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

Merged
2 commits merged into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions Flutter/chat/message-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,50 @@ In the following example, included the user's display name additionally in the e

![Messages](images/message-content/customized-messages.png)

## Suggestions

The[`Suggestions`](https://pub.dev/documentation/syncfusion_flutter_chat/28.1.33-beta/chat/ChatMessage/suggestions.html) property allows you to add a list of suggestion items to a message in the message list. The selected suggestion item can be displayed in the chat interface as either an incoming or outgoing message, depending on the user who selected it. The suggestion layout, background color, and other properties can be customized.

{% tabs %}
{% highlight dart %}

@override
Widget build(BuildContext context) {
return Scaffold(
body: SfChat(
messages: <ChatMessage>[
ChatMessage(
text: 'Hi! How’s your day?',
time: DateTime(2024, 08, 07, 9, 0),
author: const ChatAuthor(
id: '123-001',
name: 'John Doe',
),
),
ChatMessage(
text: 'Good! Just relaxing. How are you?',
time: DateTime(2024, 08, 07, 9, 5),
author: const ChatAuthor(
id: '123-002',
name: 'Jane Smith',
),
suggestions: <ChatMessageSuggestion>[
const ChatMessageSuggestion(data: 'All good!'),
const ChatMessageSuggestion(data: 'Doing well!'),
const ChatMessageSuggestion(data: 'I\'m Fine'),
],
),
],
outgoingUser: '123-001',
),
);
}

{% endhighlight %}
{% endtabs %}

![Suggestions](images/message-content/suggestion-message.gif)

## Outgoing user

The [`outgoingUser`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/SfChat/outgoingUser.html) property represents the user who is sending messages. It should be set to the unique ID of the user, which corresponds to the [`id`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/ChatAuthor/id.html) property of the [`ChatAuthor`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/ChatAuthor-class.html). This property plays a crucial role in identifying and distinguishing messages sent by different users.
Expand Down
2 changes: 2 additions & 0 deletions Flutter/chat/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ The Syncfusion Flutter Chat widget displays conversations between two or more us

* **Message Bubble** - A list of [`ChatMessage`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/ChatMessage-class.html) objects that will be displayed in the chat interface as either incoming or outgoing messages based on the [`outgoingUser`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/SfChat/outgoingUser.html). Each [`ChatMessage`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/ChatMessage-class.html) includes details such as the message text, timestamp, and author information.

* **Suggestions** - The list of suggestion items can be added for a message in the message list. The selected suggestion item can be displayed in the chat interface as either incoming or outgoing messages based on the user who selected the suggestion item.

* **Bubble Header** - Displays the sender's name and the timestamp associated with each message. Using the [`bubbleHeaderBuilder`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/SfChat/bubbleHeaderBuilder.html), a custom widget can be specified to display as a header for each chat bubble with required details about the respective message.

* **Bubble Footer** - By default, no footer is added to the message bubble. Using the [`bubbleFooterBuilder`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/SfChat/bubbleFooterBuilder.html), a custom widget can be specified to display as a footer for each chat bubble with required details about the respective message.
Expand Down