ChatMessageSuggestion class
Represents a chat message suggestion.
Example with default suggestion:
List<ChatMessage> _messages = <ChatMessage>[
ChatMessage(
text:
"Hi, I have planned to go on a trip. Can you suggest some places?",
suggestions: <ChatMessageSuggestion>[
ChatMessageSuggestion(
data: 'Paris',
),
ChatMessageSuggestion(
data: 'New York',
),
ChatMessageSuggestion(
data: 'Tokyo',
),
ChatMessageSuggestion(
data: 'London',
),
],
),
];
Example with builder suggestion:
List<ChatMessage> _messages = <ChatMessage>[
ChatMessage(
suggestions: <ChatMessageSuggestion>[
ChatMessageSuggestion.builder(
builder: (context) {
return const DecoratedBox(
decoration: BoxDecoration(
color: Colors.green,
),
child: Text('Paris'),
);
},
),
],
),
];
Constructors
- ChatMessageSuggestion({required String? data, bool selected = false})
-
Creates a ChatMessageSuggestion with the given
data
and optionalselected
.const - ChatMessageSuggestion.builder({required WidgetBuilder? builder, bool selected = false})
-
const
Properties
- builder → WidgetBuilder?
-
Optional builder function for creating a custom widget for the suggestion.
final
- data → String?
-
Text content for the suggestion.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selected → bool
-
Indicates whether the suggestion is initially selected.
final
Methods
-
copyWith(
{String? data, bool? selected, WidgetBuilder? builder}) → ChatMessageSuggestion - Creates a copy of this suggestion with the given fields replaced by the new values.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited