Custom header (Flutter)
The Flutter ChatWidget takes a headerBuilder to render a fully custom header while still driving the SDK’s data and actions. Handy for a full-page chat that should match your app chrome.
A minimal header built with headerBuilder: just the name, with Export + Clear tucked behind the ⋮ menu, matching the chat’s background colour.
ChatWidget( configuration: config, fullPage: true, headerBuilder: (context, data) => DecoratedBox( decoration: const BoxDecoration(color: Color(0xFFFBEAEF)), // match the chat canvas child: SafeArea( bottom: false, child: Padding( padding: const EdgeInsets.fromLTRB(20, 12, 4, 12), child: Row(children: [ Expanded(child: Text(data.botName, style: myTitleStyle)), if (data.onExportChat != null || data.onClearHistory != null) PopupMenuButton<String>( icon: const Icon(Icons.more_vert), onSelected: (v) { if (v == 'export') data.onExportChat?.call(); if (v == 'clear') data.onClearHistory?.call(); }, itemBuilder: (_) => [ if (data.onExportChat != null) const PopupMenuItem(value: 'export', child: Text('Export chat')), if (data.onClearHistory != null) const PopupMenuItem(value: 'clear', child: Text('Clear chat')), ], ), ]), ), ), ),);What ChatHeaderData gives you
Everything the built-in header uses — see the full table in the ChatWidget API. Highlights:
botName,avatar,isOnline,currentThemeMode- action callbacks:
onClose,onClearHistory,onExportChat,onChangeLanguage,onChangeTheme— each null when unavailable, so you hide the control defaultHeader— the built-in header, to reuse or wrap