A modern, customizable chat UI for AI applications built with Flutter. Features streaming responses, markdown support, and rich customization options.
- Features
- Quick Start
- Installation
- Usage
- Configuration
- Advanced Features
- Platform Support
- Examples
- Contributing
![]() Dark Mode |
![]() Chat Demo |
- π¨ Dark/light mode with adaptive theming
- π« Word-by-word streaming with animations
- π Enhanced markdown support with code highlighting
- π€ Optional speech-to-text integration
- π± Responsive layout with customizable width
- π RTL language support
- β‘ High performance message handling
- π Improved pagination support
- π Centralized configuration
- π¬ Customizable message bubbles
- β¨οΈ Rich input field options
- π Loading indicators with shimmer
- β¬οΈ Smart scroll management
- π Welcome message widget
- β Example questions component
- π¨ Enhanced theme customization
- π Better code block styling
import 'package:flutter_gen_ai_chat_ui/flutter_gen_ai_chat_ui.dart';
AiChatWidget(
config: AiChatConfig(
hintText: 'Type a message...',
enableAnimation: true,
inputOptions: InputOptions(
alwaysShowSend: true,
sendOnEnter: true,
margin: EdgeInsets.all(16),
),
messageOptions: MessageOptions(
showTime: true,
containerColor: Colors.grey[200],
),
// New in 1.3.0: Enhanced configuration options
paginationConfig: PaginationConfig(
enabled: true,
loadingIndicatorOffset: 100,
),
loadingConfig: LoadingConfig(
isLoading: false,
typingIndicatorColor: Colors.blue,
),
),
currentUser: ChatUser(id: '1', firstName: 'User'),
aiUser: ChatUser(id: '2', firstName: 'AI'),
controller: ChatMessagesController(),
onSendMessage: (message) async {
// Handle message
},
)
- Add dependency:
dependencies:
flutter_gen_ai_chat_ui: ^1.3.0
- Import:
import 'package:flutter_gen_ai_chat_ui/flutter_gen_ai_chat_ui.dart';
Optional: For speech recognition, add:
dependencies:
speech_to_text: ^6.6.0
- All widget-level configurations now flow through
AiChatConfig
- Improved input handling with standalone
InputOptions
- Enhanced pagination with
PaginationConfig
- Better loading states with
LoadingConfig
- Centralized callbacks in
CallbackConfig
- Enhanced markdown support with better code block styling
- Improved dark theme contrast and readability
- Better message bubble animations
- Fixed layout overflow issues
- Enhanced error handling
If you're upgrading from version 1.2.x:
// Old way (deprecated)
AiChatWidget(
enableAnimation: true,
loadingIndicator: MyLoadingWidget(),
inputDecoration: InputDecoration(...),
)
// New way (1.3.0+)
AiChatWidget(
config: AiChatConfig(
enableAnimation: true,
loadingConfig: LoadingConfig(
loadingIndicator: MyLoadingWidget(),
),
inputOptions: InputOptions(
inputDecoration: InputDecoration(...),
),
),
)
The new configuration system in 1.3.0 provides better organization and type safety:
AiChatConfig(
// Basic settings
userName: 'User',
aiName: 'AI',
hintText: 'Type a message...',
maxWidth: null,
// Feature flags
enableAnimation: true,
showTimestamp: true,
// Specialized configs
inputOptions: InputOptions(...),
messageOptions: MessageOptions(...),
paginationConfig: PaginationConfig(...),
loadingConfig: LoadingConfig(...),
callbackConfig: CallbackConfig(...),
// Welcome message
welcomeMessageConfig: WelcomeMessageConfig(...),
exampleQuestions: [...],
)
InputOptions(
// Basic options
sendOnEnter: true,
alwaysShowSend: true,
// Styling
margin: EdgeInsets.all(16),
inputTextStyle: TextStyle(...),
inputDecoration: InputDecoration(...),
// Advanced
maxLines: 5,
textCapitalization: TextCapitalization.sentences,
contextMenuBuilder: (context, editableTextState) => ...,
)
PaginationConfig(
enabled: true,
loadingIndicatorOffset: 100,
loadMoreIndicator: ({isLoading}) => CustomLoadingWidget(),
)
LoadingConfig(
isLoading: false,
loadingIndicator: CustomLoadingWidget(),
typingIndicatorColor: Colors.blue,
typingIndicatorSize: 24.0,
)
β Android
- Material Design 3
- Native permissions
- Adaptive colors
β iOS
- Cupertino animations
- Privacy handling
- Native feel
β Web
- Responsive design
- Keyboard support
- Cross-browser
β Desktop
- Window management
- Keyboard navigation
- High DPI support
- π Example Directory
- π Issue Tracker
- π‘ Contribution Guide
Flutter Version | Package Version |
---|---|
>=3.0.0 | ^1.3.0 |
>=2.5.0 | ^1.2.0 |
β If you find this package helpful, please star the repository!