placeholderBuilder property

WidgetBuilder? placeholderBuilder
final

A callback function creates a widget to display when there are no messages in the chat.

You can use the placeholderBuilder to create a custom widget that appears when the conversation is idle. This is particularly handy for presenting users with a relevant or visually appealing message indicating that the conversation is currently empty.

The callback accepts the BuildContext as a parameter and should return a Widget.


@override
Widget build(BuildContext context) {
  return SfChat(
    placeholderBuilder:
      (BuildContext context) {
        return Center(child: Text('No messages yet'));
      },
  );
}

Implementation

final WidgetBuilder? placeholderBuilder;