ui library
Optional, themeable Flutter UI kit for the VoiceBot SDK.
This library is separate from the headless core (voicebot_flutter.dart)
so apps that build their own UI never pull it in. It is fully replaceable:
every widget binds only to the public VoicebotSession streams, so you can
ignore the kit and build your own UI on the same headless API.
import 'package:voicebot_flutter/voicebot_flutter.dart';
import 'package:voicebot_flutter/ui.dart';
// Drop once near the app root — floats over every screen:
VoicebotLauncher(
client: VoicebotClient.init(baseUrl: '…', tokenProvider: …),
theme: const VoicebotTheme(corner: VoicebotCorner.bottomRight),
onClientReady: (c) => c.registerToolHandler('add_to_cart', myHandler),
);
Three widgets:
- VoicebotLauncher — turnkey: floating button + panel + lifecycle.
- VoiceButton — the floating launcher (use standalone for custom layouts).
- ChatPanel — the assistant window (use standalone for custom layouts).
Theme via VoicebotTheme (defaults blend with the ambient Material
ColorScheme); localize via VoicebotLabels.
Classes
- ChatPanel
- The assistant window — chat + voice in one panel.
- VoicebotLabels
- User-facing strings for the prebuilt UI kit, kept out of the widgets so they can be localized (HANDOFF: never hardcode user-facing strings). Defaults are English; pass a translated VoicebotLabels via VoicebotTheme.labels.
- VoicebotLauncher
- Turnkey, all-in-one VoiceBot UI. Drop it once near the app root and it floats a VoiceButton over every screen, manages the ChatPanel (open/minimize/close), and owns the full client/session lifecycle.
- VoicebotLauncherState
-
State for VoicebotLauncher. Exposed so callers holding a
GlobalKeycan drive the assistant programmatically (open / minimizePanel / close). - VoicebotResolvedTheme
- A VoicebotTheme with all nullable colors/styles resolved against the ambient Material theme. Built by VoicebotTheme.resolve; widgets read this.
- VoicebotTheme
- Theme for the prebuilt UI kit (VoiceButton, ChatPanel, VoicebotLauncher).
- VoicebotThemeProvider
-
Inherited widget that supplies a VoicebotTheme to a subtree, so the UI-kit
widgets pick it up without threading
theme:through every call site. Per-widgettheme:params still win over this. - VoiceButton
- Floating circular launcher (FAB) for the VoiceBot assistant.
Enums
- VoicebotCorner
- Where the floating VoiceButton sits on screen.
- VoiceButtonPhase
- Visual phase the VoiceButton renders, derived from the session streams.