We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Syncfusion Feedback

Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

The Flutter AI AssistView widget is a powerful and customizable tool designed to simplify the integration of AI assistant functionality. It allows users to customize message content, headers, footers, avatars, response toolbars, loading indicators, suggestion items, text editors, and action buttons.


Placeholder

Define a custom placeholder widget to display at the top of all messages, serving as a header, or to be shown when there are no messages in the chat.

AI AssistView placeholder UI.

Scroll with message

The placeholder acts as a header for all messages, remaining visible even as new messages are added.

AI AssistView placeholder UI.

Hide on message

Configure the placeholder to become visible when there are no messages in the AI AssistView and to be hidden when a new message is added.


Composer

This is the primary text editor where users can compose new request messages.

AI AssistView default composer UI.

Default composer

The default composer is a rounded rectangular text editor that allows users to compose request messages. You can customize its appearance by adding hint text, borders, prefix icons, suffix icons, and more.

AI AssistView composer and builder UI.

Builder

Specify a custom widget to serve as a composer, using this feature to enable multiple options for composing messages such as text, voice, and image messages.


Action button

Define buttons that perform actions such as sending a message, attaching a file, recording a voice message, and more.

AI AssistView default action button UI.

Default action button

The default action button is a send button. Pressing or clicking this button triggers a callback, allowing the user to request a response to their composed message from their preferred AI service.

AI AssistView action button builder UI.

Builder

Define a custom widget consisting of one or more interactive widgets to serve as action buttons, such as a send button, microphone button, or file attachment button.


Conversation area

The AI AssistView displays the content of user requests and AI responses. Each message includes details like the message’s text, sending time stamp, and author. The response message contains additional information, including suggestions and toolbar items.

AI AssistView request content bubble UI.

Request message

Customize the content of request messages by changing the background color, background shape, and other features based on the message, index, or specific conditions.

AI AssistView response content bubble UI.

Response message

Customize the content of response messages by changing the background color, background shape, and other features based on the message, index, or specific conditions.

AI AssistView header UI.

The header displays the username of the message’s author along with the time stamp of when the message was sent. Additionally, you can build a custom widget to display more information about messages.

AI AssistView footer UI.

Showcases additional functionalities and information, including feedback options, AI model details, and more.

AI AssistView avatar UI.

Avatar

The message author’s avatar displays either an image or the initials of their name. By default, if the avatar image source is not defined, the user’s initials will be displayed. Additionally, you can create a custom widget that shows more information about the user.


Alignment

By default, when directionality is set to LeftToRight, request messages are displayed on the right side and response messages on the left. This is reversed for RightToLeft directionality.

AI AssistView bubble alignment start UI.

Start

Both request and response messages are aligned to the left for LeftToRight and to the right for RightToLeft.

AI AssistView bubble alignment end UI.

End

Both request and response messages are aligned to the left for RightToLeft and to the right for LeftToRight.


Suggestions

Provide a list response suggestions. When the user selects one, it is considered a new request message. The suggestions’ layout, background, colors, and more can be customized.

AI AssistView suggestion UI.


Loading indicator

Indicates that the AI service’s response is in progress after a request has been submitted. By default, the indicator is a shimmer effect that is displayed until the response is received.

AI AssistView loading indicator UI.


Toolbar items

Append a toolbar to response messages that provides options to perform various actions, such as rating the response, sharing it, copying it, and more.

AI AssistView toolbar UI.


Flutter AI AssistView code example

Quickly get started with the Flutter AI AssistView widget by using just a few lines of Dart code, as demonstrated below. Also explore our Flutter AI AssistView example, which shows you how to render and configure widget.

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_chat/assist_view.dart';

class AssistViewSample extends StatefulWidget {
  const AssistViewSample({super.key});

  @override
  State<StatefulWidget> createState() => AssistViewSampleState();
}

class AssistViewSampleState extends State<AssistViewSample> {
  late List<AssistMessage> _messages;

  void _generateResponse(String data) async {
    final String response = await _getAIResponse(data);
    setState(() {
      _messages.add(AssistMessage.response(data: response));
    });
  }

  Future<String> _getAIResponse(String data) async {
    String response = '';
    // Connect with your preferred AI to generate a response to the prompt.
    return response;
  }

  @override
  void initState() {
    _messages = <AssistMessage>[];
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return SfAIAssistView(
      messages: _messages,
      composer: const AssistComposer(
        decoration: InputDecoration(
          hintText: 'Type a message',
        ),
      ),
      actionButton: AssistActionButton(
        onPressed: (String data) {
          setState(() {
            _messages.add(AssistMessage.request(data: data));
          });
          _generateResponse(data);
        },
      ),
    );
  }

  @override
  void dispose() {
    _messages.clear();
    super.dispose();
  }
}

Our Customers Love Us

Having an excellent set of tools and a great support team, Syncfusion reduces customers’ development time.
Here are some of their experiences.

Rated by users across the globe

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Up arrow icon