headerBuilder property

ChatHeaderBuilder? headerBuilder
final

Optional builder to render a fully custom chat header in place of the SDK's built-in one.

The builder receives a ChatHeaderData with everything the default header uses — the resolved bot name, a ready-to-use avatar widget, the live online status, the active theme mode — plus every action callback (close, clear history, export transcript, change language/theme). Each callback is null when that action is unavailable, so a custom header can hide the control. ChatHeaderData.defaultHeader is the built-in header itself, so a host can wrap or partially reuse it.

Example — a minimal header with just the name and Export/Clear actions:

ChatWidget(
  configuration: config,
  headerBuilder: (context, data) => Row(children: [
    Expanded(child: Text(data.botName)),
    if (data.onExportChat != null)
      IconButton(icon: const Icon(Icons.ios_share), onPressed: data.onExportChat),
    if (data.onClearHistory != null)
      IconButton(icon: const Icon(Icons.delete_outline), onPressed: data.onClearHistory),
  ]),
)

Implementation

final ChatHeaderBuilder? headerBuilder;