ChatConfiguration class
Main configuration class for chat appearance and behavior.
This class implements the Strategy Pattern and Dependency Injection by providing customizable behaviors through builder functions and configuration objects. It centralizes all chat-related configuration to maintain the Single Responsibility Principle.
Example usage:
ChatConfiguration(
senderAlignment: ChatAlignment.start,
customInputField: (context, controller) => MyCustomInput(),
bubbleConfiguration: BubbleConfiguration(
maxWidth: 200,
),
)
Constructors
- ChatConfiguration({ChatAlignment senderAlignment = ChatAlignment.end, Widget customInputField(BuildContext, ChatController)?, Widget newReceiveMessageNotificationBuilder(BuildContext, Message)?, BubbleConfiguration bubbleConfiguration = const BubbleConfiguration(), double newMessageScrollThreshold = 300, Widget dateSeparatorBuilder(BuildContext, String)?, Widget? readOnlyWidget})
-
const
Properties
- bubbleConfiguration → BubbleConfiguration
-
Configuration for message bubble appearance.
final
- customInputField → Widget Function(BuildContext, ChatController)?
-
Builder for custom input field widget.
final
- dateSeparatorBuilder → Widget Function(BuildContext, String)?
-
Builder for date separator widgets.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isPrevProfile → bool
-
Whether profile should be displayed before the message bubble.
no setter
- newMessageScrollThreshold → double
-
Distance threshold for triggering new message scroll behavior.
final
- newReceiveMessageNotificationBuilder → Widget Function(BuildContext, Message)?
-
Builder for new message notification widget.
final
- readOnlyWidget → Widget?
-
Widget to display when chat is in read-only mode.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- senderAlignment → ChatAlignment
-
Alignment for sender profiles and messages.
final
Methods
-
buildDateDivider(
BuildContext context, String timestamp) → Widget - Builds a date divider widget for the given timestamp.
-
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