ChatSuggestionSettings class

Represents the settings for chat message suggestions.

The ChatSuggestionSettings class allows you to customize the appearance of the entire suggestion area as well as each individual suggestion items in the suggestion list.

For the suggestion area, you can set the background color, shape and add padding to control the spacing around the suggestion list inside the suggestion area. You can also set the orientation of the suggestion area to be either vertical or horizontal.

For each individual suggestion item, you can customize the shape, background color, and item padding to add space around the each suggestion items. you can also add the space between the each items using the run spacing and spacing property.

Example:

List<ChatMessage> _messages = <ChatMessage>[
  ChatMessage(
    suggestionSettings: ChatSuggestionSettings(
      backgroundColor: Colors.grey[300],
      itemBackgroundColor: WidgetStateProperty.resolveWith<Color>(
        (states) {
          if (states.contains(WidgetState.hovered)) {
            return Colors.grey[400]!;
          }
          return Colors.grey;
        },
      ),
      shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(
          Radius.circular(4.0),
        ),
      ),
      itemShape: WidgetStateProperty.resolveWith<ShapeBorder>(
        (Set<WidgetState> states) {
          if (states.contains(WidgetState.hovered)) {
            return RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(20),
            );
          }
          return RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(5),
          );
        },
      ),
      textStyle: WidgetStateProperty.resolveWith<TextStyle?>(
       (Set<WidgetState> states) {
          if (states.contains(WidgetState.disabled)) {
            return const TextStyle(fontSize: 16);
          }
          return const TextStyle(fontSize: 14);
       },
      ),
      padding: const EdgeInsets.all(10),
      itemPadding:
          const EdgeInsets.symmetric(horizontal: 12, vertical: 8.0),
      orientation: Axis.horizontal,
      itemOverflow: ChatSuggestionOverflow.scroll,
      runSpacing: 10.0,
      spacing: 10.0,
    ),
  ),
];

Constructors

ChatSuggestionSettings({Color? backgroundColor, WidgetStateProperty<Color?>? itemBackgroundColor, ShapeBorder? shape, WidgetStateProperty<ShapeBorder?>? itemShape, WidgetStateProperty<TextStyle?>? textStyle, EdgeInsetsGeometry padding = const EdgeInsetsDirectional.symmetric(vertical: 5.0), EdgeInsetsGeometry itemPadding = const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), Axis orientation = Axis.horizontal, ChatSuggestionOverflow itemOverflow = ChatSuggestionOverflow.wrap, ChatSuggestionSelectionType selectionType = ChatSuggestionSelectionType.single, double runSpacing = 12.0, double spacing = 16.0})
Creates a ChatSuggestionSettings with the given customization options.
const

Properties

backgroundColor Color?
Background color of the suggestion area.
final
hashCode int
The hash code for this object.
no setterinherited
itemBackgroundColor WidgetStateProperty<Color?>?
The itemBackgroundColor property sets the background color for the individual suggestion items based on their state, such as hovered or pressed.
final
itemOverflow → SuggestionOverflow
The itemOverflow property determines whether suggestion items will wrap to fit within available space or scroll beyond it
final
itemPadding EdgeInsetsGeometry
Padding between the content of each individual suggestion item.
final
itemShape WidgetStateProperty<ShapeBorder?>?
Used to customize the shape of individual suggestion items based on their state, such as hovered or pressed.
final
orientation Axis
The orientation is used to determine the rendering orientation of the suggestion items and the direction in which the suggestions are scrolled.
final
padding EdgeInsetsGeometry
Padding between the suggestion area and individual suggestion items.
final
runSpacing double
The runSpacing determines a vertical spacing between runs of suggestion items.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionType → SuggestionSelectionType
The selectionType property specifies how many suggestion items can be selected at once.
final
shape ShapeBorder?
Used to customize the overall shape of the suggestion area.
final
spacing double
The spacing determines a horizontal spacing between individual suggestion items.
final
textStyle WidgetStateProperty<TextStyle?>?
The textStyle used to sets the text style for the suggestion item based on their state, such as hovered or pressed.
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