ai_chat_composer

A polished, backend-neutral prompt composer for Flutter AI applications. It provides the interaction layer while your app controls file picking, speech recognition, models, and networking.

Features

  • Responsive multiline prompt input
  • Attachment chips with removal callbacks
  • Optional model selector and voice-input hook
  • Send and stop-generation states
  • Cmd+Enter and Ctrl+Enter submission shortcuts
  • External or internally managed text and focus controllers
  • Material 3 styling and semantic labels

Installation

dependencies:
  ai_chat_composer: ^0.1.0

Quick start

AiChatComposer(
  models: const [
    AiModelOption(id: 'fast', label: 'Fast'),
    AiModelOption(id: 'smart', label: 'Smart'),
  ],
  selectedModel: selectedModel,
  onModelChanged: (value) => setState(() => selectedModel = value),
  attachments: attachments,
  onAddAttachment: pickAttachment,
  onRemoveAttachment: removeAttachment,
  onVoiceInput: startSpeechRecognition,
  onSend: (prompt) => sendToBackend(prompt),
)

When a response is being generated, set isGenerating: true and provide onStop. The callback receives an AiPrompt containing trimmed text, an immutable attachment list, and the selected model ID.

Design philosophy

This package intentionally does not request device permissions or choose file, speech, or AI providers. Apps retain control over privacy-sensitive integrations while sharing a consistent composer UI.

License

MIT © 2026 Syed Waleed Nawaz

Libraries

ai_chat_composer
A polished, backend-neutral prompt composer for Flutter AI apps.