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,})| Prop | Type | Default | Description |
|---|---|---|---|
configuration | BotConfiguration | — (required) | Identity + config. See the Configuration reference. |
fullPage | bool | false | Mount the chat as the whole surface (a tab/route) with no FAB and no close button. Omit for a floating FAB + panel. |
mobile | bool | true | Fill the viewport (mobile) vs. a capped 400×700 panel (desktop). |
onOpen | Function({bool isOpen})? | null | Fires when the panel opens/closes (FAB mode). |
fabWidget | Widget? | null | Custom FAB widget (replaces the default). |
onRichContentCallback | OnCustomCallback? | null | (callbackId, payload) for rich-content callback actions. |
imageUploader | ChatImageUploader? | null | Future<String> Function(Uint8List bytes, String mimeType) — upload attachments and return an HTTPS URL. Without it, images ride inline as base64. |
hostSlotBuilder | HostSlotBuilder? | null | Widget Function(String slotId, Map? payload) — render a bot-reserved host_slot. |
headerBuilder | ChatHeaderBuilder? | null | Replace 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:
| Field | Type | Notes |
|---|---|---|
configuration | BotConfiguration | Live merged config. |
botName | String | Resolved, localized (falls back to “Assistant”). |
avatar | Widget | Ready-to-use bot avatar. |
isOnline | bool | Live backend health status. |
currentThemeMode | ThemeMode | For a custom theme control. |
defaultHeader | Widget | The built-in header, to reuse/wrap. |
onClose | VoidCallback? | Null in full-page mode. |
onClearHistory | VoidCallback? | Null when disabled. |
onExportChat | VoidCallback? | Null when disabled. |
onChangeLanguage | void Function(String)? | Null when the picker is off. |
onChangeTheme | void 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), ]),);