Skip to content

ChatWidget API (Flutter)

The Flutter ChatWidget is the most complete host API. Native ports expose a subset (see Feature parity).

ChatWidget({
required BotConfiguration configuration,
bool fullPage = false,
bool mobile = true,
Function({required bool isOpen})? onOpen,
Widget? fabWidget,
OnCustomCallback? onRichContentCallback,
ChatImageUploader? imageUploader,
HostSlotBuilder? hostSlotBuilder,
ChatHeaderBuilder? headerBuilder,
})
PropTypeDefaultDescription
configurationBotConfiguration— (required)Identity + config. See the Configuration reference.
fullPageboolfalseMount the chat as the whole surface (a tab/route) with no FAB and no close button. Omit for a floating FAB + panel.
mobilebooltrueFill the viewport (mobile) vs. a capped 400×700 panel (desktop).
onOpenFunction({bool isOpen})?nullFires when the panel opens/closes (FAB mode).
fabWidgetWidget?nullCustom FAB widget (replaces the default).
onRichContentCallbackOnCustomCallback?null(callbackId, payload) for rich-content callback actions.
imageUploaderChatImageUploader?nullFuture<String> Function(Uint8List bytes, String mimeType) — upload attachments and return an HTTPS URL. Without it, images ride inline as base64.
hostSlotBuilderHostSlotBuilder?nullWidget Function(String slotId, Map? payload) — render a bot-reserved host_slot.
headerBuilderChatHeaderBuilder?nullReplace the header. See below.

headerBuilder

Widget Function(BuildContext, ChatHeaderData). Render a fully custom header; each action callback is null when unavailable, so you can hide the control.

ChatHeaderData exposes:

FieldTypeNotes
configurationBotConfigurationLive merged config.
botNameStringResolved, localized (falls back to “Assistant”).
avatarWidgetReady-to-use bot avatar.
isOnlineboolLive backend health status.
currentThemeModeThemeModeFor a custom theme control.
defaultHeaderWidgetThe built-in header, to reuse/wrap.
onCloseVoidCallback?Null in full-page mode.
onClearHistoryVoidCallback?Null when disabled.
onExportChatVoidCallback?Null when disabled.
onChangeLanguagevoid Function(String)?Null when the picker is off.
onChangeThemevoid Function(ThemeMode)?Null when the toggle is off.
ChatWidget(
configuration: config,
fullPage: true,
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),
]),
);