bubbleFooterBuilder property

ChatWidgetBuilder? bubbleFooterBuilder
final

A callback function creates a widget to display as a footer within each chat bubble.

The bubbleFooterBuilder allows you to specify a custom widget that will be shown as a footer within each chat bubble. This is particularly useful for displaying timestamps or other additional information related to the message.

The callback accepts three parameters: BuildContext, message index in the list, and ChatMessage and returns a Widget.

If a new instance is not assigned to this property, it will use the default footer widget.


@override
Widget build(BuildContext context) {
  return SfChat(
    bubbleFooterBuilder:
      (BuildContext context, int index, ChatMessage message) {
        return Padding(
          padding: EdgeInsets.all(4.0),
          child: Text(
            DateFormat('hh:mm a').format(message.time),
            style: TextStyle(fontSize: 12.0, color: Colors.grey),
          ),
        );
      },
  );
}

String _formatTimestamp(DateTime timestamp) {
  return DateFormat('h:mm a').format(timestamp);
}

See also:

  • The footerPadding in ChatBubbleSettings for adjusting the padding of the bubbleFooterBuilder.

Implementation

final ChatWidgetBuilder? bubbleFooterBuilder;