Input Bar
Chat input bar with text field, send button, and attachment support. Handles multiline input, disabled state during streaming, and safe-area padding.
Preview
Preview
Installation
$
flai add input_bar
Import
import 'package:my_app/flai/components/input_bar/input_bar.dart';
Usage
FlaiInputBar(
onSend: (text) {
print('User sent: $text');
},
placeholder: 'Ask anything...',
onAttachmentTap: () {
// Show image picker or file picker
},
)
// Disabled during streaming
FlaiInputBar(
onSend: handleSend,
enabled: !isStreaming,
)
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| onSend | Function(String) | required | Called with the message text when send is tapped. |
| placeholder | String | 'Message...' | Placeholder text for the input field. |
| onAttachmentTap | VoidCallback? | null | Called when the attachment button is tapped. Button hidden if null. |
| enabled | bool | true | Whether the input is enabled. Set to false during streaming. |
Features
- Multiline input — Text field expands up to 5 lines, then scrolls
- Send on enter — Submits on Enter key (Shift+Enter for newline)
- Safe area — Respects bottom safe area inset for keyboard
- Auto-focus — Optional auto-focus when enabled
- Attachment button — Only shown when
onAttachmentTapis provided - Disabled state — Visual feedback when disabled during streaming