AssistMessageSuggestion class
Represents a suggestion related to a assist message.
The AssistMessageSuggestion class is used to provide a set of predefined request as suggestion along with the response. It contains a details about context text and selected field used to decide the suggestion is selected or not.
Example:
List<AssistMessage> _messages = <AssistMessage>[
AssistMessage.response(
data:
"Flutter is a UI toolkit for building natively compiled apps across"
"mobile, web, and desktop.",
suggestions: <AssistMessageSuggestion>[
AssistMessageSuggestion(
content: const TextSpan(text: 'Widgets'),
),
AssistMessageSuggestion(
content: const TextSpan(text: 'State management'),
),
AssistMessageSuggestion(
content: const TextSpan(text: 'Layouts and constraints'),
),
],
),
];
Builder
Example:
List<AssistMessage> _messages = <AssistMessage>[
AssistMessage.response(
suggestions: <AssistMessageSuggestion>[
AssistMessageSuggestion.builder(
builder: (BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.green,/
borderRadius: BorderRadius.circular(8.0),
),
child: const Text('State management'),
);
},
selected: true,
),
],
),
];
Constructors
- AssistMessageSuggestion({required String? data, bool selected = false})
-
Creates a new AssistMessageSuggestion with the
data
, and optionalselected
field.const - AssistMessageSuggestion.builder({required WidgetBuilder? builder, String? data = '', bool selected = false})
-
const
Properties
- builder → WidgetBuilder?
-
Optional builder function for creating a custom widget for the suggestion.
final
- data → String?
-
Holds the 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}) → AssistMessageSuggestion - 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