composer property

AssistComposer? composer
final

A primary text editor for composing the request messages.

The composer is a customizable text editor designed for typing new messages. It offers options to adjust the appearance and behavior of the text editor, including settings for the minimum and maximum number of lines, decoration, and text style.

By default, the text editor does not include hint text. Hint text can be added using the InputDecoration.hintText property within InputDecoration.

If the composer is disabled by setting InputDecoration.enabled to false.

@override
Widget build(BuildContext context) {
  return SfAIAssistView(
    composer: AssistComposer(
      minLines: 1,
      maxLines: 3,
      decoration: InputDecoration(
        hintText: 'Type a message...',
      ),
    ),
  );
}

Builder

@override
Widget build(BuildContext context) {
  return SfAIAssistView(
    composer: AssistComposer.builder(
      builder: (BuildContext context) {
        return TextFormField(
          decoration: InputDecoration(
            hintText: 'Type a message...',
            prefixIcon: IconButton(
              icon: Icon(Icons.attach_file),
              onPressed: () {
                // Handle attachment button click.
              },
            ),
            suffixIcon: IconButton(
              icon: Icon(Icons.mic),
              onPressed: () {
                // Handle mic button click.
              },
            ),
          ),
        );
      },
    ),
  );
}

Implementation

final AssistComposer? composer;