ChatComposer class

A widget for composing chat messages.

The ChatComposer allows customization of text input areas, including text style, line limits, and decoration. It can also be initialized with a custom builder.

Example with default composer:


@override
Widget build(BuildContext context) {
  return SfChat(
    composer: ChatComposer(
      textStyle: TextStyle(fontSize: 16.0, color: Colors.black),
      minLines: 1,
      maxLines: 6,
      decoration: InputDecoration(
        border: OutlineInputBorder(
          borderRadius: BorderRadius.all(Radius.circular(42.0)))),
        hintText: 'Type a message...',
      ),
      margin: const EdgeInsets.only(top: 16.0),
    )
  );
}

Example with custom Composer:

@override
Widget build(BuildContext context) {
  return SfChat(
    composer: ChatComposer.builder(
      builder: (context) => CustomChatInputWidget(),
      margin: const EdgeInsets.only(top: 16.0),
    )
  );
}

Constructors

ChatComposer({TextStyle? textStyle, int minLines = 1, int maxLines = 6, InputDecoration? decoration = const InputDecoration(), EdgeInsetsGeometry margin = const EdgeInsets.only(top: 16.0)})
Creates a ChatComposer with the given textStyle, line limits, decoration, and margin.
const
ChatComposer.builder({required WidgetBuilder? builder, EdgeInsetsGeometry margin = const EdgeInsets.only(top: 16.0)})
Creates a ChatComposer using a custom builder for the widget's construction.
const

Properties

builder → WidgetBuilder?
Custom builder for constructing the widget.
final
decoration → InputDecoration?
Customizes the decoration of the text input field.
final
hashCode → int
The hash code for this object.
no setterinherited
margin → EdgeInsetsGeometry
Customizes the margin around the text input field.
final
maxLines → int
Maximum number of lines the text input field can contain.
final
minLines → int
Minimum number of lines the text input field can contain.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
textStyle → TextStyle?
Customizes the style of the text input field.
final

Methods

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