Chat Experience

AI chat experience with composer v2, model selector, voice modes, ghost mode, and animated empty state.

AI Assistant
GPT-4o
Write a function to parse JSON
Here's a type-safe JSON parser using pattern matching:
Regenerate
Message... Claude Sonnet

Installation

$ flai add chat_experience

Widgets

The chat experience flow includes these widgets:

WidgetDescription
FlaiComposerV2 Pill-shaped text input with embedded model chip, mic/send toggle button, and attachment menu trigger.
ModelSelectorSheet Bottom sheet displaying available AI models with selection state and model details.
AttachmentMenuSheet Bottom sheet with configurable attachment sections (camera, photo library, files, etc.).
VoiceRecorder Inline push-to-talk widget with live waveform visualization during recording.
FlaiVoiceConversationOverlay Full-screen voice conversation overlay with animated orb visualization.
GhostModeBanner Dismissible banner indicating ghost/incognito mode where conversations are not saved.
FlaiEmptyChatState Animated greeting screen with assistant avatar and name, shown when no messages exist.

Avatar System

AvatarConfig supports 5 rendering modes, all rendered by the FlaiAvatar widget:

ModeDescription
iconGradient Icon rendered on a gradient background circle.
iconSolid Icon rendered on a solid color background circle.
image Network or asset image clipped to a circle.
custom Builder callback for fully custom avatar widgets.
defaultAvatar Fallback avatar with a generic AI icon and theme-based colors.

Configuration

ChatExperienceConfig controls the assistant identity, available models, and enabled features:

PropertyTypeDefaultDescription
assistantName String required Display name of the AI assistant.
avatar AvatarConfig defaultAvatar Avatar configuration for the assistant.
greeting String? null Greeting text displayed on the empty chat state.
composerSections List<AttachmentSection> [] Sections displayed in the attachment menu bottom sheet.
models List<ModelOption> [] Available AI models shown in the model selector.
enableVoice bool false Enable voice recording and conversation modes.
enableGhostMode bool false Enable ghost/incognito mode toggle.

Usage

FlaiComposerV2(
  config: ChatExperienceConfig(
    assistantName: 'Atlas',
    avatar: AvatarConfig.iconGradient(Icons.bolt),
    models: [
      ModelOption(id: 'gpt-4o', label: 'GPT-4o'),
      ModelOption(id: 'claude-sonnet', label: 'Claude Sonnet'),
    ],
    enableVoice: true,
  ),
  onSend: (text) => controller.sendMessage(text),
)