BubbleConfiguration class
Configuration class for message bubble appearance and behavior.
This class follows the Strategy Pattern by allowing customization of bubble rendering without modifying the core chat logic. It provides builder functions for different UI elements while maintaining sensible defaults.
Example usage:
BubbleConfiguration(
profileBuilder: (context, name) => CustomProfile(name),
senderBubbleBuilder: (context, child) => Container(
decoration: BoxDecoration(color: Colors.blue),
child: child,
),
)
Constructors
- BubbleConfiguration({Widget profileBuilder(BuildContext context, String name)?, Widget senderBubbleBuilder(BuildContext context, Widget child)?, Widget receiverBubbleBuilder(BuildContext context, Widget child)?, Widget timeBuilder(BuildContext context, String timestamp)?, Widget loadingWidget = const MessageLoading(), double maxWidth = double.infinity})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- loadingWidget → Widget
-
Widget displayed while messages are loading.
final
- maxWidth → double
-
Maximum width for message bubbles.
final
- profileBuilder → Widget Function(BuildContext context, String name)?
-
Builder function for user profile widgets.
final
- receiverBubbleBuilder → Widget Function(BuildContext context, Widget child)?
-
Builder function for receiver message bubbles.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- senderBubbleBuilder → Widget Function(BuildContext context, Widget child)?
-
Builder function for sender message bubbles.
final
- timeBuilder → Widget Function(BuildContext context, String timestamp)?
-
Builder function for timestamp display widgets.
final
Methods
-
buildBubble(
BuildContext context, Widget child, bool isSender) → Widget - Builds a message bubble with appropriate styling.
-
buildProfile(
BuildContext context, String name) → Widget - Builds a profile widget for the given user name.
-
buildTime(
BuildContext context, String timestamp) → Widget - Builds a timestamp widget for the given timestamp string.
-
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