toolbarItems property

List<AssistMessageToolbarItem>? toolbarItems
final

Toolbar items for the assist message.

The toolbarItems is a list of AssistMessageToolbarItem. It is used to display custom widgets below the message bubble. Each toolbar item contains field content used to display a custom widget, tooltip used to show additional information about the item when hover, and isSelected to indicate if the item is currently selected.

Example:

List<AssistMessage> _messages = <AssistMessage>[
  AssistMessage.response(
    data: responseText,
    toolbarItems: <AssistMessageToolbarItem>[
      const AssistMessageToolbarItem(
        tooltip: 'Like',
        content: Icon(Icons.thumb_up_outlined),
      ),
      const AssistMessageToolbarItem(
        tooltip: 'DisLike',
        content: Icon(Icons.thumb_down_outlined),
      ),
      const AssistMessageToolbarItem(
        tooltip: 'Copy',
        content: Icon(Icons.copy_all),
      ),
      const AssistMessageToolbarItem(
        tooltip: 'Restart',
        content: Icon(Icons.restart_alt),
      ),
    ],
  )
];

Implementation

final List<AssistMessageToolbarItem>? toolbarItems;