bubbleContentBuilder property
A callback function creates a widget to display as the content of each message bubble.
The bubbleContentBuilder allows you to specify a custom widget to display as the content within each message bubble. This is useful for customizing how the message content is presented, such as using different background colors, borders, or padding.
The callback accepts three parameters: BuildContext, message index in the list, and AssistMessage and returns a Widget.
If a new instance is not assigned to this property, it will use the default content widget.
@override
Widget build(BuildContext context) {
return SfAIAssistView(
bubbleContentBuilder:
(BuildContext context, int index, AssistMessage message) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Text(message.text),
);
},
);
}
Implementation
final AssistWidgetBuilder? bubbleContentBuilder;